Manchester encoding between monitor and light sensor

I’ve been working on a way to push data into a microcontroller using a computer monitor (or smart phone) which flashes black and white. I’ve done some preliminary tests using one photoresistor read by an ATmega168 analog comparator circuit. The results have been mixed. Continue reading

AVR Analog Comparator

I haven’t put much time into the light-based programmer I was working on. But I did get some advice from Devlin Thyne who pushed me in a different direction on it. He suggested I use Manchester Encoding which only needs one input. It’s a method of rolling the clock signal and data into one. But before I do that, I’m going to switch over to using the AVR Analog Comparator hardware. It’s an easy way to get a 1 or 0 out of an analog input. See my simple example after the break.

Continue reading

Photoresistor and an ATmega168 ADC

I’m starting on a new project and thought I’d share the first step. I eventually want to use two photoresistors to push data into the microcontroller. You’ve got to crawl before you can walk and I’ve set up a simple circuit to make sure everything is working.

Using a voltage divider that includes a CdS photoresistor I can take a measurement using the ADC that correlates to the intensity of light shining on that CdS sensor. In the video after the break I’m using a set of LEDs on the development board as a signal. When light intensity is low the LEDs are on. When I use a flashlight to increase the light intensity the LEDs go off.

This proves that I have everything set up correctly before I make my firmware more complicated. I followed along with the ADC tutorial over at AVR freaks to get this far. Eventually I’ll use two photoresistors, one to sense the clock and the other to sense the data. That will require interrupt based ADC readings. For now I’m using the free ranging mode. Keep reading to see the code.

Continue reading

How to drive 595 shift registers with AVR hardware SPI

A pair of shift registers connected with jumper wires on a breadboard

Driving a shift register using an AVR chip’s built-in hardware is really quite easy. Most of their offerings have an SPI module, or Serial Peripheral Interface. A shift register is exactly that, a peripheral device that communicates via a serial line. All we need to do is hook up our connections and use a few pieces of simple code. Join me after the break to see how that’s done.

Just want to know how shift registers work? Check in on my other post on that topic.

Continue reading