The TeensyPi™ is a Teensy 3.0 board combined with a Raspberry Pi board, that utilizes Maxim® 1-wire devices to monitor and control the temperature of various devices. This started out as a networked temperature monitor for two freezers I use as beer coolers, and has morphed into what it is today.
As this site develops, I will show the steps necessary to create a working TeensyPi™.
If you are a TeensyPi™ user, and have created a useful addition, either software or hardware, feel free to contact me and I will give you author status to add your feature.
I’ve been working on numerous boards that will work with the TeensyPi™, and as a result have a bunch of boards that I’ll never use. I’ve decided to make these boards available to folks that may find them useful. I have several iterations of the main board, the switch boards, the LCD boards, and the combo boards.
Here’s what I’m going to do: If you donate at least $10, I’ll send you an unpopulated PC board of my choice via USPS. Make it $15, and I’ll send you an unpopulated board of your choice.
If you donate more than $25, I’ll contact you via e-mail with some additional options.
Let me know what you think.
This is a very small board that uses the DS2762 chip as a 1-wire K-type thermocouple reader:
The two capacitors are 0.1uf, and the resistor is 1K.
I’ve added or updated the Teensypi.ino file for the Teensy 3.0, some files on the RPi, and the eagle/gerber files (DS2762.zip) on my github account.
Since we are dealing with microvolt variations, noise is a problem. This board has ground plane pours on both sides of the board to help alleviate this, but it may be necessary to put a small (.001uf to .1uf) capacitor in parallel with the thermocouple. It also helps if the thermocouple leads are a twisted pair.
This probably won’t work with a grounded thermocouple. It also seems to work better with better quality thermocouples. Some that I bought off eBay were very erratic.
Right now, the thermocouple only registers down to 0 degrees celsius (32 degrees Fahrenheit), any value below that just comes back as 0 degrees C. The upper temp range is 1024 degrees C, but I haven’t tested it at anywhere near that range.
Let me know how it works for you if anyone builds one…
This is my latest version of the TeensyPi™ main board. This version does away with the need for a separate 3V3 regulator and 3V3 cable:
The 1-Wire® mini-lan and both I2C channels are now buffered with level shifters that convert the 3V3 signals from the Teensy 3.0 and RPi to 5V signals to the outside world and vice-versa. The level shifters are comprised of BS170 N-Channel MOSFETS and 10K resistors. Each signal channel is designed per this diagram:
There are 10 – BS170 and 10 – 10k resistors on the board. I went with this design to eliminate the separate 3V3 regulator and additional cable line required in my previous design. The added feature is that it provides better resistance to noise and reflections on a heavily-loaded or non-optimal 1-Wire® mini-lan.
This board is compatible with all of the other 1-Wire® and I2C boards by simply jumpering the 5V and 3V3 terminal block on the boards.
The Eagle and Gerber files are available on my github account.
I just got back my latest board from Seeed Studios, a Combo Switchboard that contains everything needed to get an Action started on the TeensyPi. Here’s a photo:
With this board you can connect one or more DS18B20 Tenp Sensor Probes available from ebay, Brewers Hardware and other vendors, and two DS2406 switches, and hook it right up to the TeensyPi.
The outputs to the SSR can sink about 20ma. If you need more juice, use the LED outputs, replacing the LEDs with wires to your device. The transistors can sink about 50 ma @ 5VDC safely.
I’ve posted the Eagle and Gerber files in a single Switchboard.zip file on my github site.
I’ve reverse-engineered the Adafruit I2C RGB LCD Board and created my own versions. Here’s a photo:
The bottom board was my first iteration, and since I forgot to include mounting holes, I made the upper board. The missing resistors are the I2C pullup resistors and are needed only if pullup resistors are not already installed on the I2C bus.
The board can be run directly by the Teensy 3.0 or Raspberry Pi by selecting the 3v3 option on the PWRSEL jumpers, and providing 3v3 at the terminal block. The LCD display still requires 5v as well.
The board should function with Adafruit’s Python Code, as well as their Arduino Code provided you jumper all three of the address pins. This creates an I2C address of 0x20 with the Adafruit code uses.
For my purposes, I’m using the WiringPi library to create a C program that allows me to access up to eight of the boards at addresses 0x20 through 0x27. This is in turn used by the TeensyPi software on the RPi to send Action status to one or more LCDs. My software also allows the boards to be used with either AdaFruit’s RGB LCD boards, or the less expensive HD44780 single color LCDs. The option is selectable in the Action setup.
I’ve posted the Eagle and Gerber files for the upper board in a zip file on my github site, if you’d like to give it a go. I’m also willing to part with my first generation boards if anyone is interested. I just want to recoup some of my costs developing these boards. I have both populated boards and blank boards.
If you’re interested, drop me a line.
First the software update: I noticed that when I’m looking for new chips, I wasn’t removing chips that were no longer on the mini-lan, so I fixed that. The new TeenspPiPidDebug.ino file for the Teensy 3.0 is available at my github account. The version is 0.0.4
Now the new board: I’ve created a printed circuit board that can be populated with up to four DS2406+ digital switches. These digital switches can be used alone to control most solid state relays that use voltage levels of 3-5VDC. The board also accepts a 2n3906 transisitor to allow control of either an LED or devices that require higher voltages or currents. The circuits are independent of one another so they can be populated with one, two, three, or four chips. Here’s a photo of the board:
If you’d like to make your own board, I’ve uploaded the Eagle and Gerber file in a zip format. I use SeeedStudios Fusion 2-layer PCB Service for my pcb fabrication, but OSHPark provides a similar service.
I’ve had a few requests for the parts list, so I’ve updated the photo to show parts placement as well. To fully populate the board you’ll need:
- 4 – 100k ohm Resistors
- 4 – 10K ohm resistors
- 4 – 220 ohm
- 4 – DS2406 1-Wire Switches
- 4 – LEDs
- 4 – 2N3906 Transistors
- 8 – 2 Position 3.5MM Terminal Blocks (Adafruit carries these.
If you don’t need the full complement of switches, just reduce the number accordingly, each switch set operates independently of the others.
There was an insidious bug in the PID Software Update that I didn’t catch. It’s (hopefully) been corrected, along with some other cleanup. You can download the TeensyPiPidDebug.ino and *.php files from my github account.
Sorry for any inconvenience.
I’ve updated the TeensyPi™ code to handle local data logging and graphing.
First I created a new table in phpmyadmin for the teensypi database:
CREATE TABLE IF NOT EXISTS `actionGraph` (
`id` int(11) NOT NULL,
`time` bigint(20) NOT NULL,
`temp` int(11) NOT NULL,
`tcTemp` int(11) NOT NULL,
`tcSwitch` enum('ON','OFF','NONE') NOT NULL,
`thTemp` int(11) NOT NULL,
`thSwitch` enum('ON','OFF','NONE') NOT NULL,
KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
and installed GnuPlot
sudo apt-get install gnuplot
Then I created the files:
All of the code is available at my [URL=”https://github.com/jimmayhugh/TeensyPi”]github directory[/URL]
I then added a cron entry:
* * * * * /usr/bin/php /var/www/htdocs/graphActions.php
To update the action status to the MySQL table once a minute.
Now if you go to the Action Status page, you should see a “GRAPH” button for every active Action:
Pressing the “GRAPH” button will take you to a page displaying a graph of the current data:
You can use the “Go Back” selection to go back some amount from the last entry, or set specific time parameters to se a portion of the graph.
More on this as time goes on.
This guide will show you how to connect your TeensyPi to cosm.com to create a feed of your sensor data. From wikipedia:
Cosm (formerly Pachube (pronounced Patch bay)) is an on-line database service allowing developers to connect sensor-derived data (e.g. energy and environment data from objects, devices & buildings) to the Weband to build their own applications based on that data. It was created in 2007 by architect Usman Haque.
Continue reading Connecting the TeensyPi to Cosm.com to log data