Early on I decided to construct the system so that it would read its attached photocell once a second. This doesn't provide a very fast response to changing light conditions but since I originally intended the system to measure the light level in my apartment throughout the day, I made this tradeoff in responsiveness to cut down on the amount of data that would be generated.
I selected a PIC18F252 microcontroller for the heart of the sensor system for its small size, reasonably accurate analog-to-digital converters, and the fact that I had plenty on hand. Since this PIC does not have enough memory to store an entire day's worth of readings I needed to attach it to a host PC that could save the readings as they were made. Since it would be inconvenient to have the sensor circuit tethered to the computer by a serial cable I wanted to try using a Bluetooth modem for wireless serial communication (the BlueSMiRF Basic from Sparkfun) that I had purchased last semester. Remembering the problems I had with this device last semester though, I designed the circuit to be able to communicate over either a wired or wireless link.
I began by constructing the circuit shown in figure 1 on a breadboard. The circuit is powered by a 9-volt battery regulated to 5 volts by a linear voltage regulator. I did this so that the circuit would not need to be tethered to a wall outlet for power. With battery power and a wireless link to the host computer, I was hoping to be able to put the sensor circuit anywhere in my apartment.
In operation, the code running on the PIC waits for a '?' character to come in over the serial connection. This is a request from the PC for a new reading. The PIC reads the voltage on analog pin 0, encodes it as an 8-bit value and sends it out over the serial connection then goes back to waiting for a request for another value.