Tuesday, April 28, 2009

The Basic Setup

Sitting on my desk is a very rough approximation of the hardware setup. I have an Arduino Duemilanove with an Ethernet shield, and I'm using my trusty variable resistor as a simulated temperature probe (not very practical to have things on my desk at 240 degrees F). I also have a small 12vdc computer fan hooked to an NTE 241 NPN power transistor, which in turn is biased by one of the Arduino's PWM-capable pins. An old wall-wart power supply from a sump-pump backup system supplies 12vdc to the fan and the Arduino's regulator.

I started out by writing some simple code for the Arduino that tests out the basic capabilities. I can read analog values from the fake temperature probe and convert them to actual temperatures using a lookup table. I can control the fan and adjust its speed by adjusting the duty-cycle of the output pin. Then I made the system 'smart' by adjusting the fan speed to according to the temperature error value.

With the Ethernet board, I can also communicate over TCP/IP. For now it's a wired connection; once the code's all figured out, I'll add wireless capabilities either by adding a Wifi bridge or by using a Wifi module instead of the Ethernet board.

I wrote some very simple code to implement a basic web server, and I can serve up a simple web page to show basic info about the temperature and fan speed. The html includes a refresh tag so that the browser automatically reloads it every five seconds. Pretty cool. :-) Next, I'll write a bit of code to send alerts via email or Twitter.



So far I've already used about 9k of my available 30k code budget; granted, nothing's optimized yet, but I'm gonna need to write some pretty tight code to cram everything in there!

No comments:

Post a Comment