TeensyPi Networked Temperature Controller

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

jimmayhugh

Turgid Member
HBT Supporter
Joined
Feb 6, 2011
Messages
1,003
Reaction score
237
Location
Las Vegas
I've got my latest networked temperature controller up and running, it's a Raspberry Pi board interfaced with a Teensy 3.0 32-bit ARM Cortex mini-board that allows you to monitor and control up to 36 1-Wire temperature sensors and switches in up to 12 different actions. It is capable of running on both wired and wireless intranets. The Teensy 3.0 is capable of using many of the Arduino libraries, and can be programmed with a modified Arduino IDE, making it a snap to use.

The Teensy 3.0 handles all of the sensing and control, and the Raspberry Pi interrogates the Teensy 3.0 about every 500 milliseconds and updates a web interface to show you the current status. The Raspberry Pi uses a LAMP stack to handle the database and web processes, so you can add or change programs in whatever language suits you. I use PHP and Javascript, but you could also use PERL, Python, C, whatever floats your boat :D

Once the Teensy 3.0 is setup, it can run autonomously, with no interaction from the Raspberry Pi. It will resume its last settings in the event of a power failure, with no input from the Raspberry Pi. The Raspberry Pi is solely for setup and display purposes.

I've started a Blog that outlines the parts and steps required to make your very own TeensyPi, and am in the process of designing a board that will replace the current Adafruit Pi Plate.

I haven't gotten the pages done for the sensors and switches yet, but they should be forthcoming soon.

Hope this is of some interest. :mug:
 
Definite interest from me! I've been reading about the Pi and am about ready to buy.
 
I've read up on these Pi's and was going to use one with a touch screen in my car(1991 Stealth) but it NEVER occurred to me to use one in my brewing.....Please update often sos I can get one going for myself....
 
I salute your efforts, way beyond just a basic RPI setup seen on this board. Your efforts with the Teensy 3.0 have answered a lot of the questions I had with the Cortex M4 hardware and it's suitability for process control. While I am not headed in the 1wire hardware direction you have brought all the needed aspects together for the rest of the people, and have given them a road map, and software to make it happen.
I am interested in watching this effort grow and expand, and am curious as to where you will draw the line with function and display scope creep, and say this is enough.
 
Sub'd. I love all these sorts of build threads but this one really matches what I'd like to do.

Excluding the central boards/controllers, what is your approx hardware cost per 1 sensor, 2 stage zone?
 
I am interested in watching this effort grow and expand, and am curious as to where you will draw the line with function and display scope creep, and say this is enough.

That's always the rub, isn't it? :D

The Teensy 3.0 has lots of oomph, and the fact that it's able to use or port many of the Arduino libraries makes it very easy to add other bells and whistles (PID, flow sensing, local display, etc), and the display side with the RPi can also handle local data logging, and other functions.

For now, I'm going to concentrate on the basics.
 
Excluding the central boards/controllers, what is your approx hardware cost per 1 sensor, 2 stage zone?

I picked up 50 of the DS18B20 Digital Thermometer chips for about 85 cents each with free shipping on E-Bay and built my own probes with spare phone cords and ethernet cables that I scrounged for free. I'll be posting a blog page on that in the future. You can also purchase pre-made probes from Brewers Hardware, Adafruit, and others. Cost per probe is in the $10-$20 range.

The DS2406+ chips were about $3 each from DigiKey, and I've made a little circuit board that will work with up to four 25A SSRs. Also to be posted in an upcoming page.
 
As part of my on-going testing and validation, I've breadboarded 12 temperature sensors and 12 switches:

TwelveEach.png


As a precaution, I've added a 3v3 / 800ma voltage regulator to the board to supply the current to the additional sensors / switches. It's probably not necessary if only a few sensor / switch combos are used, but I prefer to understress my components.

More info is available at my website.
 
Thanks for the update. Do you think it Is OK to pick up SSRs without heatsinks for say a lager chamber?
 
Thanks for the update. Do you think it Is OK to pick up SSRs without heatsinks for say a lager chamber?

I'm probably the wrong person to ask, as I tend to over-engineer things :D

I use the 25A-40A SSRs for everything, and heat sink most of them, either by attaching them to a metal enclosure with screws and thermal grease (my pumps), or a big honking heatsink (my RIMS).

I prefer to under-stress my equipment as much as possible.
 
Just checked your site, awesome work. I have a RPi and an Arduino2560 that I am playing with. I've managed to get the RPi to register my DS18D20's and using a php script send them off to be displayed on the Steel Series gauges....I really like your approach and I think I'll fork that way. I also oredered the BrewTroller BX because I just don't have enough crap to play with.
 
Just checked your site, awesome work. I have a RPi and an Arduino2560 that I am playing with. I've managed to get the RPi to register my DS18D20's and using a php script send them off to be displayed on the Steel Series gauges....I really like your approach and I think I'll fork that way. I also oredered the BrewTroller BX because I just don't have enough crap to play with.

The code for the Teensy 3.0 should work with very little modification on the Mega2650, as that was my original platform for much of the original work. Just be sure that you are using level-shifters for the serial communication between the RPi and Mega, as the RPi GPIO pins are not 5v-tolerant. I used the Adafruit I2C-safe converters, and they worked well. My other blog has more info on the RPi/Mega setup. At one point I had the Mega issuing XML that the Steel Series gauges could use, and that could easily be re-inserted into the Teensy Code.

Right now I'm re-working the PHP pages to make the setup of the chips name-based rather than address-based, since it's easy to get lost when dealing with 36 chips. :drunk:
 
The code for the Teensy 3.0 should work with very little modification on the Mega2650, as that was my original platform for much of the original work. Just be sure that you are using level-shifters for the serial communication between the RPi and Mega, as the RPi GPIO pins are not 5v-tolerant. I used the Adafruit I2C-safe converters, and they worked well. My other blog has more info on the RPi/Mega setup. At one point I had the Mega issuing XML that the Steel Series gauges could use, and that could easily be re-inserted into the Teensy Code.

Right now I'm re-working the PHP pages to make the setup of the chips name-based rather than address-based, since it's easy to get lost when dealing with 36 chips. :drunk:

So much tinkering to do and so little time!! Thanks again
 
I've re-worked the web pages to used names instead of chip addresses when doing setup for the TeensyPi. This involved changes to web pages and the database tables, so I've uploaded a new image in the Downloads page of my blog.

I've also updated the setup procedure.

As always, comments are welcome.
 
Great stuff -- I already had a set of Teensy 3s from the kickstarter, but was wavering in the Pi -- now I have it in hand. Have you considered isolation between the Teensy and RPI? Something like an optoisolator?
 
Great stuff -- I already had a set of Teensy 3s from the kickstarter, but was wavering in the Pi -- now I have it in hand. Have you considered isolation between the Teensy and RPI? Something like an optoisolator?

Didn't see the need. Both are 3v3 and don't appear to have any problems. I'm messing around with adding one or more local 4x20 LCD screens, and am using voltage converters for the 3v3 to 5v levels there.

I'lll let you know how it goes.
 
jimmayhugh said:
Didn't see the need. Both are 3v3 and don't appear to have any problems. I'm messing around with adding one or more local 4x20 LCD screens, and am using voltage converters for the 3v3 to 5v levels there.

I'lll let you know how it goes.

I was curious about that too, do you just need to instantiate a new LCD object for each screen?
 
I was curious about that too, do you just need to instantiate a new LCD object for each screen?

Yup, I'm using a MCP23017 port expander over I2C, so I can hook up to 8 of them on the bus and then just create an lcd1, lcd2, etc object for each screen.

Biggest problem I see right now is that it can take up to 500ms to completely refresh the entire 4x20 lines. Plus I have to dig into python unless I want to write my own libraries for the RPi.
 
OK, got the proof of concept worked out for the local 4x20 RGB LCB screens.

I've posted a video of the work so far on the TeensyPi website.

I created an I2C controlled RGB LCD card using a MCP23017 port expander, run it with python (good grief!! yet another programming language to learn :p ) libraries and code from Adafruit, and then hoolk it up to the RPi.

Should be able to run up to eight LCDs, unless the RPi runs out of steam. :cross:

I'll keep you posted.
 
You may have already found this, but I know when I used an MCP23017 with the adafruit library I noticed that the I2C bus was only running at 100kHz and could be juiced to 400kHz with a compiler define. That was on the Arduino platform though so I don't know if it carries to the Teensy platform.

Also, the adafruit library doesn't follow the needed timing, it errs on an overly-conscious side by ignoring the slow bus transfer speed and adding unneeded delays between transfers. A lot of the LiquidCrystal::write4bits() delay can be removed.

Just something to look at if you're looking to speed up the LCD updates-- I found an easy 5x speed increase which I needed because I was also updating custom characters to generate pseudo-graphics.
 
You may have already found this, but I know when I used an MCP23017 with the adafruit library I noticed that the I2C bus was only running at 100kHz and could be juiced to 400kHz with a compiler define. That was on the Arduino platform though so I don't know if it carries to the Teensy platform.

Also, the adafruit library doesn't follow the needed timing, it errs on an overly-conscious side by ignoring the slow bus transfer speed and adding unneeded delays between transfers. A lot of the LiquidCrystal::write4bits() delay can be removed.

Just something to look at if you're looking to speed up the LCD updates-- I found an easy 5x speed increase which I needed because I was also updating custom characters to generate pseudo-graphics.

The Teensy 3.0 is able to use most Arduino libraries, so I may look into that. Right now I'm using the RPi to control the LCDs.
 
The Teensy 3.0 is able to use most Arduino libraries, so I may look into that. Right now I'm using the RPi to control the LCDs.
Oh cool you've got the LCDs right on the rPi's I2C I didn't see that. What is the bus speed of that I2C bus out of curiosity? I imagine it can go even higher than 400kHz given the Pi has a much higher clock speed than my ATmega does.
 
Oh cool you've got the LCDs right on the rPi's I2C I didn't see that. What is the bus speed of that I2C bus out of curiosity? I imagine it can go even higher than 400kHz given the Pi has a much higher clock speed than my ATmega does.

Looks like the default is 100kHz my python-fu is not very strong, so I haven't yet found a definitive answer.
 
I am following along and have a couple questions on the Pi Plate Adapter.

4k7 Resistor - Is the resistor soldered through the board and making a connection underneath near the unassigned screw terminals on where the 3v3 and Data wires were soldered?

Are you powering the Teensy with a separate 5v supply (battery or plug) than the RPi that screws into the 5v & GND on the left?
 
The TeensyLibrary zip file appears to be empty.

What did you use to unzip it? Unzip it with directories intact, and it should have a "sketchbook" top directory with other directories and files beneath it. The files are meant to be included in the Teensy IDE sketchbook on your local drive.
 
jimmayhugh said:
What did you use to unzip it? Unzip it with directories intact, and it should have a "sketchbook" top directory with other directories and files beneath it. The files are meant to be included in the Teensy IDE sketchbook on your local drive.

Just opened it in Windows. All the other files were fine but the library file had nothing in it. The ino file is in one the other zip files but I'm having trouble compiling it without the libraries. The regular OneWire and EEPROMAnything libraries seem to be causing errors so I figured the library zip must have something I need.
 
Did you use any resistors with the RGB LCD to i2c? I just ordered this: http://www.adafruit.com/products/1109 even though I have the 20x4 LCD bc I thought it was my only option as far as using the RGB LCD. Mind sharing how you wired it?

Also, I need to turn on a vintage fridge condensor do you think a 40A SSR will be generally able to handle that? If I matched the relay size that came from the factory would that work? My skills are poor when it comes to electronics. Any help is appreciated!
 
Did you use any resistors with the RGB LCD to i2c? I just ordered this: http://www.adafruit.com/products/1109 even though I have the 20x4 LCD bc I thought it was my only option as far as using the RGB LCD. Mind sharing how you wired it?

Also, I need to turn on a vintage fridge condensor do you think a 40A SSR will be generally able to handle that? If I matched the relay size that came from the factory would that work? My skills are poor when it comes to electronics. Any help is appreciated!

I reverse engineered the RGB LCD board, and made my own board. I use 4k7 resistors on the SDA/SCL lines, but if you are stringing several together, you only need one set of resistors. I'll post the Eagle and Gerber files when I verify the boards.

The 20x4 display is going to cover the switches and trim pot if you solder it directly to the adafruit board. One option is to put the switches and trim pot on the reverse side of the board, as there are no polarity problems with those devices. Another option is to connect the LCD board to the Aadafruit board via a multi-conductor cable.

The 40A SSR should work just fine.
 
redbenn said:
I am following along and have a couple questions on the Pi Plate Adapter.

4k7 Resistor - Is the resistor soldered through the board and making a connection underneath near the unassigned screw terminals on where the 3v3 and Data wires were soldered?

Yup

redbenn said:
Are you powering the Teensy with a separate 5v supply (battery or plug) than the RPi that screws into the 5v & GND on the left?

The RPi and Teensy 3.0 are both powered by the same supply, in this case a 5V/5A switching supply I picked up on E-bay.
 
Got everything up and running last night, had 2 temp sensors on a breadboard and the readings were working.

Decided to try to get my wireless adapter to work with no luck. Then when I plugged in my sensors they stayed at 70° and wouldn't change if I raised the temp around them. Now this morning when I fire it up they give me a reading of 255° and won't change. I've tried 3 diff chips with the same result.

I just wired a switch to an LED to see if that would work, and was able to recognize the switch and control the LED.

Any suggestions on the temp sensors?
 
Got everything up and running last night, had 2 temp sensors on a breadboard and the readings were working.

Good! :rockin:

Decided to try to get my wireless adapter to work with no luck.

Which adapter are you using? I've used all three of the USB dongles that Adafruit offers, and they all fired up first try. I use WPA2. Also you may have to enable SSID if you haven't entered the changes to /etc/network/interfaces.

Then when I plugged in my sensors they stayed at 70° and wouldn't change if I raised the temp around them. Now this morning when I fire it up they give me a reading of 255° and won't change. I've tried 3 diff chips with the same result.

The TeensyPi doesn't scan for new chips automatically, since the new chips' addresses may be inserted in between current chips, which can screw up the names and actions in the database.

When you add new sensors and switches, you have to go to the update page and refresh everything.

I just wired a switch to an LED to see if that would work, and was able to recognize the switch and control the LED.

Any suggestions on the temp sensors?

My experience with flaky readings has usually been caused by loose cabling, so make sure your connections are secure.

Hope this helps, if not, let me know. :mug:
 
Got back my first set of boards, and there were a few errors. Nothing major, but annoying none the less. Back to the drawing board. I'll post the eagle files when I'm satisfied with them. I'll also have some extra boards available if there's any interest.

Got the python code for the RGB LCD's working, reading the names and info from the RPi database, and the temps and switch status from the Teensy 3.0.

It required changes to the RPi database and new libraries, so I'll post a new system image when it all settles out, as well as detailed instructions on how to update an existing system.

System load doesn't look like it will be a problem, but I haven't connected 8 LCDs yet, due to time and cash constraints.

Stay tuned...
 
Good! :rockin:



My experience with flaky readings has usually been caused by loose cabling, so make sure your connections are secure.

Hope this helps, if not, let me know. :mug:

I have rewired a couple times. I ended up adding a few more chips and it recognized them, and read the temps, but still was 255 on 2 of them. What was odd, one of the new ones went to 255 and one of the originals gave the actual reading. Going to play around a bit.


Got the Wifi adapter working, it was on wlan1 instead of wlan0.
 
I have rewired a couple times. I ended up adding a few more chips and it recognized them, and read the temps, but still was 255 on 2 of them. What was odd, one of the new ones went to 255 and one of the originals gave the actual reading. Going to play around a bit.


Got the Wifi adapter working, it was on wlan1 instead of wlan0.

Looking back at the code, a 255 (0xff) is sent when no chip responds to an address.

When you add or remove chips from the mini-lan, you should use the "Scan For New Chips" button on the "Check For New / Restore Page" to re-initialize the chip arrays.

Are you seeing these values on the "Sensor Status" page or the "Action Status" page??
 
Looking back at the code, a 255 (0xff) is sent when no chip responds to an address.

When you add or remove chips from the mini-lan, you should use the "Scan For New Chips" button on the "Check For New / Restore Page" to re-initialize the chip arrays.

Are you seeing these values on the "Sensor Status" page or the "Action Status" page??

Yeah, each time I change the arrangement, I scan for new chips. I see those values on both pages.
 
If you go to the "Update Names" page, does the number of chips displayed correspond to the number of chips on the mini-lan?

If so, do all of the addresses start with 0x28 for thermometers, and 0x12 for switches?
 
If you go to the "Update Names" page, does the number of chips displayed correspond to the number of chips on the mini-lan?

If so, do all of the addresses start with 0x28 for thermometers, and 0x12 for switches?

BILIM56.png


Yeah, right now I have 5 thermometers connected
 
Back
Top