During my placement year, I wanted to play with as much hardware as I could. So after paycheck #2 came in, I went and spent some money!
Most of the items that I bought were related to the RC car idea that I had for my final year project (which unfortunately never happened, but something much better did!). The general idea behind the box was to get some experience with designing and building a more complex system than I had previously, with a view to then using some of the features on the RC car. It has 3-axis accelerometers and gyros, a bank of 4x I2C memory chips (128kB each), a light sensor, LEDs, an XBee module and an ATMega328p in the form of an Arduino Pro Mini.
SparkFun. They are a fantastic bunch, it's only a shame they are in the US, not England (import Tax...). The important bits are listed below:
All 3 axis of the gyros are connected directly to the Arduino's analog pins 0, 1 and 2. The light sensor is connected to analog pin 4.
The red, green and blue are controlled by 3 of the Arduino PWM outputs on the digital lines 9, 10 and 11. 3 of the 4 white LEDs are controllable via the other PWM outputs of the Arduino 3, 5 and 6. The fourth white LED is controlled by an XBee PWM output.
|@ 0x1D||- 3-axis accelerometer|
|@ 0x20||- I/O Expander|
|@ 0x50||- EEPROM 0|
|@ 0x51||- EEPROM 1|
|@ 0x52||- EEPROM 2|
|@ 0x53||- EEPROM 3|
As the IC can only really sink current, a LOW output turns the LEDs on. The outputs are in 3-state at power on, with a pull-up resistor taking the outputs high. Outputs should be set to high before they are used as an input. If a logic 1 is applied to an I/O pin that was written to low, a large current flows to GND - this is something to watch out for when working with the acceerometer interrupts (I managed to cook one).
|@ 00||- Edge LED (0 is on)|
|@ 01||- LED (0 is on)|
|@ 02||- LED (0 is on)|
|@ 03||- LED (0 is on)|
|@ 04||- LED (0 is on)|
|@ 05||- LED (0 is on)|
|@ 06||- LED (0 is on)|
|@ 07||- LED (0 is on)|
|@ 10||- EEPROM 0 Write Protect (1 = protect)|
|@ 11||- EEPROM 1 Write Protect (1 = protect)|
|@ 12||- EEPROM 2 Write Protect (1 = protect)|
|@ 13||- EEPROM 3 Write Protect (1 = protect)|
|@ 14||- 3-axis Accelerometer INT1 (1 = interrupt, never set to output)|
|@ 15||- 3-axis Accelerometer INT2 (1 = interrupt, never set to output)|
|@ 16||- Pitch / Roll Gyro power down (1 = power down)|
|@ 17||- Yaw Gyro power down (1 = power down)|
I got everything running nicely, one bit of software relayed the gyro outputs to the RGB LED, another showed the accelerometer values. I managed to use the XBee to successfully wirelessly program the AVR (thanks ladyada) - I needed to set T3 to 1 on the XBee inside my toy in order to get this working. I started developing a filesystem that I was going to implement on the onboard EEPROM, but never completed it. A future project was always to get an AHRS going using the sensors, but I never got to this.
And finally, here is a picture of it with the lid on, and all the lights shining! (well... nearly)