• Float Swithces

    One of the key components to monitor is the water level. I looked at a bunch of different ways to measure the level of the water, including things that gave variable resistance depending on how far up a fluid reached, ultrasonic solutions, infrared solutions, and many other methods. In all of my searching, I ended up finding someone's post that basically said "there are a bunch of options...but seriously, just use a float switch". So that is what I am doing :)

    In my design, I will have 3 float switches:

    1. One at the top to trigger a high water alert
    2. One at the bottom of the normal operating range to indicate water needs added
    3. One at the critical low point, where the pumps don't get water any more.

    This will allow me to throw an alarm if the water falls out of normal operating range, and will allow me to cut power to the pumps if the water gets critically low.

    Up next

    • This float switch circuit will be finalized on a soldered breadboard
    • Special part has been shipped and will be writing about it next time ;)

  • Relay Complete!

    I had hoped to get a bunch of pictures of things happening along the way, but it got really tedious to take pictures and work on the things because I don't really have a lot of things to help hold projects in place while taking pics. Although I think it looks less impressive when it is completely together...Here is the power module completed:

    In this image the powerpod is "on". I added the switch because it seemed like a thing that needed to be there (thinking of it like a surge strip), but honestly, that is probably never going to be in any other position but on.


    In this picture, you can pretty much see everything that is inside the box

    • The outlets
    • The wiring (obviously)
    • The relay board

    Apart from the wiring coming in from the mains power, the only other thing in this box is the switch. I used a decora blank insert and cut the holes for the fuse and the switch. Outside of the box it looks like this:


    This is the birth of Hydra. This is the name I have chosen to give this project. A hydra is a freshwater jellyfish (and also a mythical, many-headed serpent). The general tie-in is that there are a bunch of parts that make up the whole animal. For this reason, I thought it was a fitting name since it is going to start as the controller, power, and temperature components but will keep budding new offshoots (like the real hydra) as I get new things I want to do. Some of the modules that are in consideration are:

    • Water Sensing
      • pH
      • ORP?
      • Conductivity
    • Water levels

    • Auto feeder

    • Dosing

    • Top-off

  • Rdio and Linux Part II

    For whatever reason, my original rdio work-around (from this post) didn't work when I upgraded to Fedora 22. I'm sure it has something to do with the way Gnome 3.16 is handling window events, but I'm not spending the time to actually figure it out, because I've got a functiong work-around that is actually kind of cooler anyway.

    I changed my .xbindkeys to this

    "$(grep '^Exec' rdio.desktop | tail -1 | sed 's/^Exec=//' | sed 's/%.//')"
            Mod2 + XF86AudioMedia
    "sleep 0.3 && ~/bin/mediacon play"
            Mod2 + XF86AudioPlay
    "sleep 0.3 && ~/bin/mediacon prev"
            Mod2 + XF86AudioPrev
    "sleep 0.3 && ~/bin/mediacon next"
            Mod2 + XF86AudioNext

    All of the events have been moved into a script file that controls the actual events. This was done because I added a bit more logic to the events, and it was difficult to keep all that readable in the file. The other important thing to note is that all of the commands here are prefixed with a sleep. I had to do this because the events were firing too quickly and I had to slow that down just a tiny bit. I started with sleep 0.1, which worked when I used windowactivate in the script, but needed an additional time when I used windowfocus. I'm not really sure how the timing here differed when the commands in the script were called, but for whatever reason, this version is working.

    The only other thing is my new mediacon script which is this:

    CUR=$(xdotool getactivewindow)
    xdotool windowfocus --sync $(xdotool search --limit 1 --name Rdio)
    if [ $1 == "play" ]; then
            xdotool key space
    elif [ $1 == "prev" ]; then
            xdotool key Left
    elif [ $1 == "next" ]; then
            xdotool key Right
    xdotool windowfocus $CUR

    This is grabbing the id of the current window, activating the rdio window, sending whatever command you bound the key to, and then returning focus back to the window you started from.

  • Relay Update

    I am now waiting for the 5-gang box from homedepot to get started on the actual build. I'm a little concerned with the overall size of the project with the box I've got, but I already tried a 4-gang box and it wasn't really big enough for the guts plus the switch, fuse, and signal cables.

    I wired up a test circuit and was able to verify that I know how to wire this thing for mains power. The test was a success.

    I ran the following in an interactive python session:

    import Adafruit_BBIO.GPIO as GPIO
    GPIO.setup("P8_10", GPIO.OUT)
    GPIO.output("P8_10", GPIO.HIGH
    GPIO.output("P8_10", GPIO.LOW)

    Something else

  • Aquarium Controller Update


    It's been a while since I've updated this blog, but there has actually been quite a bit happening and hopefully I'll be able to actually detail out the steps of the things I've worked on, but I'll talk about the things I have accomplished so far

    Overall Design

    My design is going to use a single control module that expands with extra pods to handle the other tasks. So there will be probes, power, and possibly motors (for auto feeders or dosing). This made sense to me because I'm not going to be able to afford to do everything at once, and it will also allow me to deploy portions of it while I'm designing the rest.

    As it turns out (though I didn't know it when I started down this path) Neptune Systems has a similar design in their Apex line. So I guess I'm on the right path since someone else has already done it :)

    Temperature Sensing

    One of the key, basic things I wanted was temperature sensing. I was able to get the Dallas 1-wire (DS18B20) working, though at this point just in a test capacity. You can see my temps.py code.

    The 1-wire interface generates a unique ID for each temperature sensor. In the code linked above, they are hard-coded. I am rewriting the code now to scan through the directory and pick up whatever is attached so that it will eventually just be a process like:

    1. Plug in a device
    2. Assign it to a location

    The 1-wire temperature modules (in parasitic mode) need 3 wires (2 for power and one for data). Due to this, I decided to use rj11 phone wires. The connectors are small, readily available, and can be split so that I can use one connector on the controller side and have many sensors on the front side. Though I only plan on using 2 for my installation, it should be extendable up to whatever 1-wire protocol supports.

    In the process of moving my breadboard design over to a soldered perfboard, I managed to miss a connection. So I need to fix that and then I should have temperature measurements working.


    Another key component of this whole solution is controlling power, so getting a bunch of relays to control outlets was the best option here. I was looking at components and was prepared to build the circuits myself, especially because I thought I was limited to 3V coil relays. As it turns out, the BeagleBone does have 5V on the board, so I ended up getting this SainSmart 8 Channel Relay.

    As soon as I figure out how to make fancy diagrams I'll show how I got this connected. In the mean time, I do have a youtube video showing my relaytest.py in action.

  • A New Year...New Projects

    So it's been quite a while since I have posted anything here. I've been quite busy with "life" things, and also a side project or two. For Christmas, I got new lights for my aquarium. So that has spun up a new project of restocking the aquarium and breathing life back into my love of saltwater tanks.

    For a really long time, I have wanted to get an aquarium controller. These are things that can control whatever aspect of the aquarium you need. Things like lighting and temperature are simple ones, but you can get even more complicated with wave generators, pH metering, dosing, top off, etc. In my system administrator mind, anything that can do the work for me is that much better.

    Basic controllers cost around $100 and go up to many hundreds of dollars, and then that doesn't include the additional probes or devices you need to buy. So it can get really expensive really quickly. So I thought "hey! I can program stuff, I just need some way to interact with the hardware". And that brings me to my new project.

    The Beaglebone

    Why did I choose this over arduino, or rasberry pi, or any of the other similar controllers on the market? Price was a factor, I got this for $40 at my friendly neighborhood Microcenter. It is also built with the open source mentality at heart. The biggest factor is that, out of the box, this just runs linux. Adafruit provides some python libraries that make interacting with the pins through Python pretty easy too. So I am looking forward to getting going with this. So far I have only booted the thing. I still need to acquire some basic breadboard tools and random electronics to start experimenting with it. Definitely looking forward to posting more stuff as I discover it.

  • Python Printer Peril

    I remembered a while back that there was this little PERL utility to set the status message on HP printers using the printer's job language. I decided that I wanted to try to do that with Python, and this is what I came up with:

    #!/usr/bin/env python
    import socket
    import sys
    def sendcmd(MESSAGE, IP, PORT=9100):
        """Opens the socket to the printer and sends the strings"""
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.connect((IP, PORT))
        s.send("@PJL RDYMSG DISPLAY=\""+MESSAGE+"\"\n")
    if len(sys.argv) < 2 or len(sys.argv) > 3:
        sys.exit('Usage: %s "MESSAGE" IPADDRESS [PORT]' % sys.argv[0])
    elif len(sys.argv) == 3:
        sendcmd(sys.argv[1], sys.argv[2])
        sendcmd(sys.argv[1], sys.argv[2], sys.argv[3])

    This actually turned out to be pretty simple. There are really only 2 parts: The socket part that sends the commands, and the sys.argv stuff that grabs the command line options and passes it to the sendcmd() function. I added an option to specify a port, but if none is specificed, it will default to 9100. So then all you need to do is:

    ./hpprint.py "Your crafty message"

  • Hosting Experiment

    I am experimenting with Pelican to create the web page content. I was using wordpress, and while it is amazingly simple to setup and is also amazingly powerful in the things it can do; it is also a pain to maintain and is written in PHP. That became a problem when I tried to serve it behind PHP-FPM on nginx. I couldn't get all the pieces to work. So in true sysadmin style I said "screw it!" and tried something completely different :)

Page 1 / 1

beaglebone hydra beaglebone announce python programming aquarium