Raspberry Pi QuadTempProbe: Temperature Measurement and Logging

A friend asked me a few days ago if I knew of a way to remotely monitor multiple different points of temperature, log the data, and generate an email alert if  sensor reading went out of bounds. Since I happened to have a ‘project-in-progress’ with just that goal, I decided I should finish it. Or, rather, get it to a working state.

QTP_Complete

Hardware:
Software:

To make installation easier, I built a custom…whatever they call things that attach to the Pi (“plates”?). It uses a ZVNL110A N-Channel MOSFET to do the level conversion for the sensors. They will actually work at 3.3V, but I wanted to use higher voltage due to the length of the wires (~20′), just to be on the safe side. Other than the MOSFET, the board has the 4.7K resistor for the sensors and 4 3-pin JST connections. I’ve included a schematic below that shows how all of this is wired up. Note that the JST connectors aren’t entirely necessary, but they do make installation/re-configuring/removal easier. You could always hard-wire the sensors to the board.QTP_BoardBottomQTP_BoardTopQTP_BoardCompleteQTP_Schematic

 

I used the DS18B20 digital temperature sensors for this project, and will probably use them again for similar projects. These things are awesome. No messing around with analog conversions, or having to worry about longer probe lines messing up the readings. And there’s a Pi library already built for them. All the sensors need to function is power and one resistor on the data line for all sensors (they can be wired up in parallel). They use some weird digital protocol to send data, but since it’s digital, there’s no big worries about line noise (there are limits, obviously). Each has it’s own unique ID hard-coded, so you can tell which sensor is reading which temperature.

 

To extend the reach of the sensors, I used about 20′ of telephone wire for each. I was able to find a 1000′ spool of the stuff on the cheap a while ago, and it’s perfect for this application. It’s flat and flexible, making it great for use in a refrigerator/chest freezer or closed in a door/window. There are 4 conductors, so for the 3-pin sensors, I just twisted two of the wires together on each end. I found that using small scraps of protoboard made the soldering MUCH easier, and added some additional strength to the connections. Judicious application of electrical tape and heat-shrink tubing should make them fairly weather-resistant, but some other sealing method might be preferred (keeping in mind not to interfere too much with the sensors).

 

QTP_ProbeQTP_Probe_CompleteQTP_ProbeConnectorQTP_ProbeConnectorComplete
So that’s all well and good, but what to do with the measurements? In short, I have a cron job running every 5 minutes that executes the script to poll each sensor and sends the data to a data.sparkfun.com stream. Also in that script, there are toggles and thresholds for alerts on each sensor. If the alert is enabled, an email will be sent to a defined address whenever the corresponding sensor reading goes above the defined temperature. My friend was looking to monitor a chest freezer that was suspected to be faulty. Having a “too warm” alert would indicate a possible failure of the cooling system and potentially give enough advanced warning to save the food inside.

 

To configure cron to run the python script:
sudo crontab -e -u root

 

Add the following line to the end of the file to run the script every 5 minutes
*/5 * * * * sudo python /home/pi/quadtemp.py

 

And that’s pretty much it. As with most of my projects, I plan on putting more polish on this one in the future. I’d like to design an actual PCB, as opposed to using protoboard and a bunch of wires. When I get that put together, I’ll post about it. If you have any questions or suggestions, let me know.

FG085 MiniDDS Function Generator Build Pics

Not much for today, just a few pics from my build of this nifty kit from Sparkfun: FG085 MiniDDS Function Generator. I figure an inexpensive function generator would be a good idea to buy first and see how much I actually use it before sinking bigger bucks into a piece of full-on test gear. Overall, I’m happy with this kit, aside from a few minor quirks here and there. No show-stoppers though.

FG085_inprogress

FG085_buttons

FG085_Testing

FG085_functioning

24×24 LED Matrix Build

This project was briefly teased before, but it seemed like a good time for more details. Originally conceived as a coffee table build, it quickly morphed into what will eventually become a wall hanging and has been a test-bed for a lot of my LED work. Having worked a great deal with a variety of these digital LED strips, I noticed that in most cases they were manufactured in 0.5m sections and soldered together to form 5m strips. This is usually fine, but also means that the distance between pixels at the solder joint is 2-3mm shorter than the rest of the pixels. Being the type of person that wouldn’t be able to stop twitching over a few pixels in a matrix being misaligned from the rest, this just wouldn’t do. So the best solution was to make each row out of exactly one of these sub-sections so that all pixels are perfectly aligned. Not wanting to un-solder all of the joints to get at the 0.5m sections, I reached out to the manufacturer I typically order from in China about getting the strips in the raw sub-sections. Fortunately, they obliged. Armed with 24 half meter sections of LPD8806 strips, each with 24 pixels, I got to work laying out an evenly spaced grid on a sheet of acrylic.

After a couple laborious hours of laying out a perfect grid with a 24″ square and a lot of patience, I taped each of the LED strips with a rubber adhesive based strapping tape which I’ve found adheres extremely well to acrylic. Since it had to be wired as one continuous strip, the direction of each was alternated for every row. But first, power buses need to be created to provide the almost 34A (@5V) current the 576 pixels could draw. Originally, I wanted to design a 0.5m long PCB that would handle all of the power and signal routing. But I quickly figured out that I would need two separate designs (the signal pins are farther apart on one side than the other) and that a PCB that long, even a thin one, would cost nearly $75, per design, from OSHPark. $150 for power and signal routing was just too expensive for this project, so I had to find a simpler solution. Using large gauge wire seemed logical at first but stripping all of the insulation in the right place and soldering would be finicky. Copper tape came to the rescue; providing enough of a current capacity, in an extremely low profile. Not enough to carry all of the current on a single bus, but this many LEDs always works best with many small power buses since 5V doesn’t allow for much voltage loss over the length of the power run. The copper tape was laid out in 4 separate buses at the end of each row so that I could use very short jumpers to wire each strip to the bus. Soldering each jumper to took a bit of finesse, since each strip acted as a huge heat sink meaning heat had to be held to the joints for a long time, but not so long as to melt the adhesive or the acrylic beneath. I started by scuffing up the copper with some 100 grit sandpaper and then held my iron to the top of the wire (or the small bit of copper tape I used for the ground bus) and melting the solder into that from the top until it adhered to the bus.

Next up was wiring up all of the data and clock lines. Since the strips alternate directions with each row, one side of the matrix had data and clock pins right next to one another and the other required longer wires that jumped over the power lines. If you start twitching looking at the wire colors on each side… yes, I totally switched data and clock colors between sides. Oops. But with nearly 300 intricate joints to solder in total, it took me three long evenings and a couple movie trilogies to complete. Last was to connect the power bus wires that would connect to a 40A @5V supply and the input signal lines for hookup to the controller. The power lines were connected using some 10 gauge stranded core wire and the signals lines with a long length of phone cable. On the signal wire I also hooked up the ground, for a common signal ground, and 5V line to use for a level converter reference. I always use this converter from Adafruit for prototyping.

On top of all this, at least for now, was placed another sheet of acrylic to make sure nothing touches the power buses or signal lines (especially curious small fingers at the NC Maker Faire!). Matrix Display on Stand Check the video at the top of this post for an example of some of the animations I have programmed for the display. It is capable of being driven from an Arduino, Raspberry Pi, Beagle Bone, or similar. In the case of the above example, it is being driven directly by the SPI port on a Raspberry Pi Model B using a ground-up rewrite of my RPi-LPD8806 Library that has been modified to handle all of the hard tasks related to controlling matrices made of LED strips. More info on that new library will be coming soon in an exciting update!

Open Source PCB: ATTinyX5 Dev Board

While the standard Arduino (especially variants like the Pro Mini) truly is a lilliputian computing device, even it sometimes seems like trying to swat a fly with a sledgehammer. Sometimes you just need a few I/O pins for a status light, timer, tiny sensor, etc. Enter the ATTinyX5 series of chips.

The ATTiny25, ATTiny45, and ATTiny85 have 8 pins, 6 I/O and 2048/128, 4096/256 and 8192/512 bytes of flash/RAM respectively. The ’85 can be had for just over $1 from sites like Mouser. There’s even an Arduino core available for them so you can use most* of the code and libraries you already know and love. The only problem is that, without a complicated setup and boot-loader, they require an ICSP device like the AVR ISP MkII to upload your code.

After getting sick of having to wire up the 6-pin ICSP header of a breadboard every time I wanted to use one I finally decided to create this:

This tiny PCB takes some of the pain out of all the hookup needed for prototyping with the ATTinyX5. It only requires 2 components, the IC and a 0.1uF decoupling capacitor. On the underside of the board, there is an ICSP header that uses offset pin holes so that the 2×3 header doesn’t actually need to be soldered on. Simple press fit the header into the holes and then connect the ICSP cable. When you are done programming you can remove the header and the cable. The headers on the side are spaced to fit nicely on a breadboard and are also offset so that they can be press fit and work without permanently soldering them on.

By placing the board onto your breadboard up-side-down, you have easy access to the ICSP header for programming. Once the code is good, you can then easily remove the press fit headers and solder everything on permanently.

Best of all, you can have 3 of these made by OSHPark for only $1.65, shipped. They can be easily ordered directly from their project page here.

Also, you can grab the KiCad design files from our GitHub repository.

*Many libraries require features the ATTiny series simply is missing or more RAM/Flash than available on the chip. However, there are also many libraries written specifically for these chips.

**Note: The silkscreen labels has been tweaked since what you see in the picture (see the OSH Park renders) as they were not very visible. They have been increased in size and re-oriented for better visibility.

NeoPixel Glass Skull Lighting Effect (A.K.A Mr. BlinkySkull)

Awesome skull-shaped vodka bottle plus Arduino Pro Mini plus NeoPixels equals:

 

 

I’ve had this (empty) bottle of Crystal Head vodka for a while. Admittedly I mostly bought it because the bottle was really neat and I wanted to make it light up. Up until this point, I was using a small version of the RGB clock to illuminate it. It was a neat effect, but not very bright. It was time for an upgrade.

I have used before and really like the Arduino Pro Mini. All the Arduino power and flexibility in a cheap, tiny package. I picked up a 16 LED NeoPixel Ring not too long ago, and I really like how neatly the APM fits inside of the ring (held in place with some solid-core wire. I can definitely see using this combination in other projects. For this project, the wiring is pretty basic. The ring power and ground are soldered to extra VCC and Ground pins respectively on the APM, and a barrel jack is soldered to the RAW (voltage regulator input) pin and another extra ground pin. Yet another nice thing about this configuration: the APM has enough extra pins to attach a peripheral and an extra power tap. The ring Data pin is connected to digital pin 7.

As you’ll notice, the “enclosure” is a re-purposed SparkFun box. For quick enclosures where heat dissipation an looks aren’t a top concern, these work pretty well. Note that I did end up cutting vent holes in this one since the LEDs can generate a bit of heat if the animation has the lights on all the time. The hardware is held in place by a piece of clear packing tape over the cutout and another piece across the back as a bit of insurance.

The animations are all done in code, with help from the Most Excellent FastLED library. If you do anything with programmable LEDs on the Arduino, this library is worth a look. The code (such as it is) for this project can be found here. This was a quick one-off thing, so please excuse the crudeness of the code. I didn’t have time to build it to scale. Or paint it.

I guess the main take-away from this how well the Arduino Pro Mini and the NeoPixel ring work together. And glass vodka bottles are cool.

-Dan