A few months ago, I saw an instructable
on how to build a coloursensor with an RGB led and an LDR. It inspired me to try whether I could improve his design.
Here are the things that I wanted:
The sensor should have as few pins as possible.
It should work as a stand-alone device. All calculations should be done on the device.
It should have a triggered mode and a continuous mode.
All parameters should be programmable.
Calibration parameters should be stored in the EEPROM of the microcontroller.
Firmware updates should be made possible
And finally: size does matter ⇒ The smaller the better.
I did choose an smd attiny85 as the brain of the sensor. It has a small footprint but a large enough flash for the calculations. It also has just enough pins for the project (all eight pins are used).
One of the problems of the attiny is that it doesn't have a build in bootloader sector. So I needed to find a bootloader that would work on it. I tried a few and most didn't work for me, until I stumbled on the tinyloader bootloader. It's fast and only 256 bytes long and it did the trick. It also allowed me to make a sensor with only 4 pins : Vcc, GND, TX and RX.
I made my sensor with smd parts but you can ofcourse make yours with thru-hole parts