November 19, 2010

Improved Fan Cart

In an earlier post I described an Arduino-controlled fan cart. The driver I used was an L293D quad half-H chip, because I had one handy and was out of simpler parts at the time. It's always bugged me that I was just controlling speed on that cart, since it's possible to control direction with an H-bridge also.

I'd also gotten several suggestions of other features the fan-cart could have; and I've learned a bit about EagleCAD recently too, so I went back and re-did the device. Here it is: Fancart v2.1. I sized the board so that it fits in the board-holder notches on the top of the PASCO fan cart.

The three buttons set the mode, speed, and time. Any of the three parameters can be read by pressing the corresponding button: the setting will blink on the corresponding LED. For example, if the speed is 2/3, then pressing the speed button will cause the green LED to blink twice.

Any parameter can be set by holding the corresponding button for two seconds and then releasing it. The parameter LED will turn off, and each subsequent press of the button advances the parameter through its cycle of values. For example: to change the speed from two (default) to one (lower speed), hold the speed button for two seconds then release it. The green LED will turn off. Press the speed button again and the green LED will blink three times (speed is now 3). Press the speed button once more and the green LED will blink once (speed is now 1). Press either of the other buttons to accept the change and go back to normal run mode.

There are three modes available in the current program:
Mode 1: The fan toggles between on and off each time the sensor sees a magnet. This is what the previous fancart did.
Mode 2: The fan turns on when it sees a magnet, and then turns off T seconds later, where T is the time setting. The current program has available T settings of 1-4 seconds, although that's easy to change.
Mode 3: The fan reverses each time it sees a magnet. This is kind of fun: one magnet in the center of the track results in anharmonic oscillation.

It's easy to put in other modes, or even to completely change what the buttons and LEDs do. The Arduino has 30k of memory, and this program uses only 2.5k so far...

One note about the magnetic sensor: instead of the reed switch on the previous version I'm now using an AH182 Hall effect sensor. The advantage of this sensor is that it's more sensitive, it has hysteresis so no debouncing is necessary, it's completely insensitive to vibration, and it's much smaller. The disadvantage is that it takes three wires instead of two, and the polarity of the magnet matters. But overall, it's a great improvement!

Here's the code, and here are the EAGLE files.

No comments:

Post a Comment