Finally getting closer to my goal of consolidating all my linux and avr devices down to the bare minimum, this weekend’s project was building and installing my IO board that will control my HVAC, talk to a bus of 1-Wire temperature sensors, control and monitor the garage door opener, and manage my greywater system. I bit off a little more than I could chew with trying to move the role of gateway device onto my Dockstar running Debian Wheezy (curse you XBox Live), but I thought I’d throw up some pictures and a blurb of what it’s all about to entertain myself.
This is the guts of the system, with my ugly home-made DIY wiring. At the heart of it (top right) is the Adafruit Boarduino – a miniaturized Arduino clone that I purchased in kit form for $17. Adafruit markets these more toward the prototyper market because they will fit on a standard sized breadboard and allow the hobbyist to build his Arduino application without having to buy shields or connect the Arduino to the circuit with jumpers. They’re also a really clean fit on a pair of female 0.1″ pin rails when I move my prototypes to Radio Shack pre-perfed circuit boards. This suits my needs perfectly because I don’t have the equipment, time, or patience to etch my own PCBs and by the time I get my circuitry working 100% reliably I would have three or four failed PCB attempts sitting in my parts bin.
Attached to the Boarduino on the far right is the FTDI usb>rs232 adapter that lets me program the boarduino and talk to the sketch when it’s running. The relays along the left side are general purpose ones I cobbed from some old phone switch cards, and control things like pulsing the garage door button and controlling the HVAC system. The larger blue relays are rated for 110vac / 6a and do things like interrupt power to the pressure pump and sump that fills my greywater catchment.
Here’s the LCD showing the water level, some zone temperatures, the HVAC setpoint and state and the “v” on the bottom left indicating that the garage door is down / closed.
Naturally, all this would be useless without some cool graphs to demonstrate what’s going on in color. Since I’ve completely hosed my rrd databases over the last few days, I really have nothing impressive to show except the high of 105F on July 7th, but I’ll update with better ones later.
This data is all collected by a shell script running on the aforementioned Debian Dockstar over a USB>serial adapter (see screen cap). Excuse the title on the water level graph, I’ve been busy with other stuff and can’t be bothered to correct it to what it’s actually showing.
In a previous incarnation, this functionality was all (well, mostly) controlled by a shell script powered HTML+CGI front-end complete with crappy looking icons and poor web design on a Linksys WRT-54g running good ol’ OpenWrt. Since working with HTML these last few years makes me want to gouge my eyes out with a rusty screwdriver, I think I’m going to forgo the pretty stuff and just do things like resetting the filter hours and scheduling the heat and cool setpoint changes the way a true geek would, in a bash shell over ssh.
Below you’ll see the P!ng ultrasonic sensor I picked up at RadioShack dangling precariously over my water barrel on whatever junk I could find in my basement to prop it on.
Also a pretty crumby picture of the control board’s sister that handles keeping the battery bank that powers all these gadgets charged from the miniscule solar array on my back deck.
Here’s a list of all the runtime parameters I’m monitoring / controlling from the shell script. I suppose I should wrap the word smart in the title with quotes, because there’s a lot the arduino code won’t do because it’s only as good as the idiot who cobbled it together. But for an investment of about $100 not including the 1-wire sensors, cable, the enclosure or the extensive collection of parts that came out of my junk bin, you’d be hard pressed to find something ready-made that compares for functionality. And let’s not talk about appearance – this one doesn’t require you to own an iPhone and post your thermostat setpoint changes to Facebook or Twitter, and it never will.
sensorRemovals=2
0:Indoor.senseMax=75.96
0:Indoor.senseMin=40.81
1:Outdoor.senseMax=85.10
1:Outdoor.senseMin=82.69
2:Garage.senseMax=87.01
2:Garage.senseMin=86.34
3:Basement.senseMax=70.58
3:Basement.senseMin=69.92
coolMins=16
heatMins=0
filterHours=0.3
wtrFillMins=0
freeMemory=204
params:
heatSet=66.0
coolSet=73.9
heatDwell=0.6
coolDwell=0.6
levelFull=4.0
levelEmpty=37.0
levelFill=20
levelAlarm=15
fillMinutes=30
Sensors:
waterLevel=100.0%
sumpCutoff=on
fillSolenoid=off
lowAlarm=off
OUTD.Outdoor=86.11
BSMT.HomeTheater=68.92
IND.MasterBedroom=72.52
IND.LivingRoom=73.18
IND.DiningRoom=72.32
IND.MasterBath=72.72
IND.MegBedroom=74.12
GRG.Garage=87.01
BSMT.Utility=70.93
IND.JoshBedroom=75.69
Zones:
0:Indoor=73.43
1:Outdoor=86.11
2:Garage=87.01
3:Basement=69.92
HVAC:runState=cool
garageDoor=(0)closed
Lastly, here are the current live graphs. I will be adding more as I refine the system.
Update: 8/1/2012 4:00 PM
Worked on the board today to install female pin headers so the boarduino can be removed separate of the relay board. Also added a diode to the boarduino to power an external rs232 level shifter so I could do away with the FTDI Friend USB>RS232 board. The FTDI Friend is a very useful gadget for working with lots of different rs232 devices, but it caused me numerous headaches in this application due to it’s improperly shielded USB connector shroud. I now have two $5 “cheap chinese crap” brand serial adapters acting as the interfaces to the I/O board and solar charger, and all is happy.
To update the EMI resets issue – turns out the FTDI Friend was only part of the problem here. After much trial and error I found that adding surge suppressor type capacitors across the power outlet lugs smoothed out the EMI spikes I was seeing when the sumps switched off, and the I/O board has been reset free since this change. I’ve seen a couple suprious events that looked like arduino resets on the solar charger, but this was during a thunderstorm so I believe I may need to add some DC filtering to the input that the solar panels connect to. It’s always something right?
Update: 8/7/2012 3:30 PM
Much to my frustration, the latest rainfall caused more sump cycling, which caused more controller resets. The surge suppressor caps definately reduced the severity of the problem, but unfortunately I’d rather not see the ‘duinos reset at all unless I tell them to. I think my next step is to remove the 110vac from the enclosure completely and see if things improve. In the mean time I’m attaching the polling scripts and Arduino sketches for both boards.
io_control_board_0_9_3.ino
solar_charger_0_8_4.ino
start_polling
poll_io
poll_solar
Update: 9/6/2012 3:30 PM
I’m reluctant to spell it out for fear of being proven wrong again, but I think I resolved the EMI issue by adding MOVs across the 110vac relay contacts. Credit for this idea goes to Adafruit – I shamelessly pilfered this from their Powerswitch Tail 2 schematic. So far it’s gone about 10 days without a reset and we’ve mercifully had rain about half of those days.


















