Ghetto Labs: 1wire to rule them all

0xc0ffee

Member
Although this all isn't LED related, we hope you still enjoy it. We don't just spend all our time building lamps.

Ghetto labs is chock full of homemade electronics that end up getting purpose built to fulfill our monitoring and control needs. Sometimes we do this because there isn't something on the market already that accomplishes what we're looking for, but most of the time its just because we're cheap.

One of our favorites components is a small, water tight tempeture sensor (DS18B20) that cost about $2 each. Not only do they offer super accurate , 12bit precision, but as the name implies, they do it on 1 wire (well, two actually). This offers a huge advantage, as you can just bus them together, rather than bringing 20 individual sets of wires back to whatever is taking measurements.

For overall environmental monitoring, that 'whatever is taking measurements' is a LinkUSB and a PC. We take readings once per minute on about 15 of these staged in various key locations around the garden and store the values for later. This gives us a nice visual representation of how any changes made are affecting the overall system. As we swap in new lights, re-work fans, or the weather outside changes, we're able to plot these difference out into graphs to really understand the impact.



The task of reading the temps and recording them is taken care of by a small python script to grab the temps and push them to Xivley to be stored and graphed. That's pretty much all it takes. We shoot values to Xivley, they store and graph them. They even provide an API to fetch all this data back from them.

We've gone ahead and added a Cacti install to the mix that feeds off this API. There are a few reasons for this; one, we can make neat overlay graphs on multiple sensors like the one above and two, Xively can get a little bit slow to query if you're asking for huge date ranges (like months or years) to generate an image. With Cacti, we just go ahead and generate those images in advance with the most current data. These are used by a small web front end to tie everything together. There's lots of work left to be done on this front, but so far, its coming along nicely.

Another use we've found for these DS18B20, is in thermostats. We've built some simple Arduino rigs to measure temperatures and enable exhaust fans when they get too high. In this case, we're not recording the output of the temp probe, but just using it to decide if the fan should be on or not. When the temperature reaches the set point (defined by a simple pot and an Arduino analogRead) the micro controller kicks on an SSR and the fan starts.



The SSR is a pretty simple circuit, but I should caution that not all are created the same. I tried some 'hockey puck' style SSRs off eBay and didn't have good luck. The would run a string of Christmas lights, but had trouble getting large fan motors to start. We had more luck with this circuit. Its a nice opto-isoloated circuit that is simple and effective. 5V goes in, AC goes out, fan goes on. Just that simple. One gotcha, is that the circuit is ground triggered in their design, so you have to invert the inputs to the optos when triggering it with an Arduino.

In the end, we're left with a two channel thermostat for about 35 bucks. It could easily be a 4 channel for about 40 or an eight for 50, you just need to add more SSR parts.
 
Top