November 25, 2015

A project log for AquaPic - Aquarium Controller

Reef tank controller used to monitor various parameters such as temp and pH, and also control equipment such as pump and lights.

Skyler BrandtSkyler Brandt 11/25/2015 at 23:530 Comments

I'm 95% done with my first prototype. Everything is assembled, and mostly working. I had quite a few issues and bugs to get to this point though. As I highlighted in my post two days ago, my RS485 protocol didn't work on the Raspberry Pi because mark and space parity isn't implemented under the Mono frame work. I took the easy way out and simply counting the number of high bits in the byte. Then I set the parity to either odd or even to get the desired 9th bit.

The next issue was all because I sometimes buy cheap "quality" Chinese parts. The original power supply I ordered to power the controller didn't work like I wanted it to. It was a dual supply, +5Vdc and +12Vdc, but for some reason I couldn't tie the commons together. I didn't look into, or care why, and instead ordered two separate power supplies. Another nail in the coffin of the original power supply was the switching frequency. It's in audible range, probably around 10ish KHz, and extremely annoying.

The power strip went together fairly easy. I don't really like the case but it works. Its made out of ABS plastic sheets. I cut all the pieces out, then bent over tabs on the edges to make a surface to glue everything together.

I then used pipe cement to glue everything together. The top and bottom are held on by 6-32 machine screws. I threaded the plastic so I didn't have to use any nuts. It's definitely not elegant, but I don't cool machines to do anything prettier, like a CNC machine or a lazer cutter. And no, a home hobby 3D printer is not cool.

Before I wired all the outlets up to mains, I wired up the control circuity and tested that. I had to parallel 10K resisters between the relay control and ground pins of every relay board, because I left the gate of the MOSFET floating. The terminal strips are really close together so I layered the resisters between pieces of electrical tape to keep anything from shorting together. Added bonus though, it looks even more cobbled together.

I still need to figure out how to show the status, power, and AC power available (currently not wired up) LEDs on the outside of the enclosure. This will also probably require relocating the LEDs to somewhere else on the control board or to a separate LED board. Also, the power LED is soldered on backwards. Those are really hard to tell which end is the cathode or anode. Once all the control stuff was working. I moved onto the mains wiring.

When I first built the enclosure I thought I made it a little too tall, but it proved to the perfect size after I shoved all the wires in there and screwed it together. And with it plugged into mains and hooked up to the controller, everything worked like it was supposed to.

The dimming card gave me a little more trouble than the power strip. First, I complete screwed up the gain feedback for the filter opamp. The dimming card is supposed to take a 0-5Vdc PWM signal and turning it into 0-10Vdc constant voltage. However, I was only getting a filtered 0-5Vdc. Luckily, I found the issue fairly quickly. It's a pretty good indicator I did something wrong when the voltage on the inverting pin is the same as the output pin.

I was able to fix the problem witj the existing board I already had, but it required cutting traces and soldering bodge wires. After I had that fixed though I still couldn't get the output to go all the way to 10Vdc. Whenever I went above ~55% duty cycle the output would automatically clamped to ~7Vdc and stayed there until around 35% duty cycle. This issue turned out to be the little switch IC I was using. My original plan was to have either 0-10Vdc or PWM output, and this switch would be used to software select between the two. However, this plan had several plan in it. First, the switch I was using is only rated for 5Vdc and its normally-opened pin is tied to the output of the opamp. So anytime the output of the opamp went above ~5.5Vdc, weird things happen inside that switch. Hence the weird voltage outputs. Second issue I ran into was that when switching the output to PWM that same normally-opened pin is still electrically connected to the opamp output, and subsequently two capacitors. So I was unintentionally RC filtering my PWM output. So I desoldered those little ICs and place a blob of solder over the old common and normally-closed pad, ensuring this dimming board only does 0-10Vdc.

The last bit of progress was that I added a WiFi dongle to the RPi. I thought I would have to write a little script to get the time from a NTP server on boot, but the RPi automatically does this when it has internet. That was a nice surprise. Now the only thing holding me back from implementing this on my tank is some communication cable. I'm using regular USB cable but it is ridiculously hard to find plain USB cable without ends. So I ordered long pre-made USB cables and I'm going to chop them up into the lengths I need. I also need to clean up the inside of my tank cabinet so I have a nice place mount everything and make it pretty.