BASIC Stamp Projects
Last Updated 01/08/2012 12:17 -0500
Recently, I've gotten into BASIC Stamp projects. I also am a bit of amateur gardener, so this year I tried to combine the two by building a small industrial control system for regulating the temperature and humidity in the temporary greenhouse I build in my basement.
I still have to finish the controller and software, but when I'm finished, I'll post it here. Basically, the system consists of a prototyping board from Peter Anderson fitted with a Parallax Basic STAMP BS2p24 (specifically for the direct I2C support). The other important pieces of the puzzle include:
A RTC. I used the I2C-based real-time clock from Gravitech. It comes on a small carrier board and connects with standard 0.1" grid header pins. It has a battery holder on top for a CR1220 lithium coin cell, so it's a nice self-contained module. It also has I2C pull-up resistors so it can be directly connected to the Stamp. I actually disabled the pull-ups on mine because I had already configured my board for additional I2C peripherals and put the pull-ups on the proto board instead. I2C can only be used on Pins 0/1 and 8/9.
A serial LCD display. I don't keep the debug terminal on all of the time so I built my system with a 4x20 display and serial backpack from Wulfden (although any one would do). I use this to display brief vital info on the state of things: temperature, humidity and fan status. Quick and dirty.
A small MOSFET control board for the exhaust fan. Being lazy, I borrowed a fan control circuit consisting of a BS170 MOSFET and flyback diode from the Industrial Control "Stamps in Class" manual. I added a small red LED to show the activation state.
An X-10 interface. Again, pulling right from the Stamp book, I connected the Stamp to a TW-523 X-10 line interface using a piece of RJ-11 telephone cable. Eventually I want to control the grow lights with this system instead of using a simple mechanical timer, so I built the cable interface in preparation.
The temperature/humidity/light sensor package, which is based on the SHT1x (also available from Parallax). Again, this was connected to the Stamp using the hook-up diagram in the data sheet. The only thing I added was a small bypass capacitor (0.1uF/100v) at the IC socket. I built it onto a larger carrier board so that I could include a simple photocell-based light sensor. Then, I connected the sensor package to the proto board using a length of CAT-5 computer networking cable. This cable is reasonably flexible with good quality copper conductors. It also gives me eight conductors to work with (of which three are used for data, clock and light signals plus two for power).
Again, there's no real science as to how all of this gets hooked up -- it's all by the Parallax BASIC Stamp "book" so to speak.
The software, generally, is pretty simple and built up mostly from code provided by Parallax. What I did was weave the sample code into something I could use.
Essentially, the code runs in a sampling loop checking the temperature and humidity, and displaying current values on the display. Having had a small greenhouse a few years, for my setup, temperature regulation is never the problem -- it's the humidity. So, the humidity is evaluated during each loop and if if exceeds a pre-selected threshold (in this case, 75%), it activates the ventilation fan until the humidity drops below 73%.
Peter Anderson (BS2 proto board): http://www.phanderson.com/stamp/index.html
Real-time clock (Gravitech): http://www.gravitech.us/
Serial LCD Backpack K-107 (Wulfden): http://www.wulfden.org/TheShoppe/k107/index.shtml
Copyright (c) 1998-2012 Richard A. Cini, Jr. (rcini at msn dot com) All Rights Reserved. All copyrights of any third parties referred to herein are hereby acknowledged. There is no warranty, either express or implied, relating to any of the content contained herein. The site maintainer shall in no event be liable to anyone for damages, including any loss of profits, lost savings, or other incidental or consequential damages arising out of the use or misuse of the information contained on this Web site. Batteries not included. You may use the information contained herein for NON-COMMERCIAL purposes only and AT YOUR OWN RISK.