The assignment this week is to add a sensor to a microcontroller board and read it. I was interested in the phototransistor because of its use of light. I downloaded the traces, the c file, the make file, and the python file hello.reflect... from the class page.

I decided to use the WinAVR Command window simply because it made it easier for me to fix errors since the command line and output window are separated, versus the windows command prompt where you have to keep scrolling up to see everything you did before. My computer had problems initializing the device at first, so I had to check my board to find out what was wrong. Turned out that I had put a resistor and a capacitor in the wrong position on my board. So, after removing and reconnecting those components I tried again and flashed the board with the program successfully...after I spelled "program" correctly.

I tried to follow some tutorials I saw online to install and use Python on my computer, however, I was not able to figure out how to run the program on Windows. So, I used Ubuntu on another computer with Python already installed on it. The program ran fine with no problems.

Here in this picture, the program shows a value based on how much light is reflecting into the phototransistor. To verify that it was working correctly, I did a few experiments. I used a curved piece of cardboard and held it over the light, expecting the convex surface to concentrate more light (give a higer value) than the other side which was convex. This worked fine.

I was interested in used different colored lights to represent values for different outputs of voltage using the phototransistor and have a program try to identify what color of light I was using rather than simply display the graph. That will take more coding and a different led so I will update that here on the page in the future.

Back Home