### Author Topic: Analog to digital converter questions  (Read 602 times)

0 Members and 1 Guest are viewing this topic.

#### garriwilson

• Supreme Robot
• Posts: 345
##### Analog to digital converter questions
« on: December 29, 2013, 01:43:50 PM »
Hey guys, so I've been trying to understand all of the \$50 robot code and ran into some technical questions.

So when one of the ADC ports on the microcontroller converts an analog voltage value from the photoresistor to a digital value, how do you know what digital number you will get for that analog signal? My guess would be to find the resolution of the ADC, which I think would be (Vmax-Vmin)/(2^N), where N is the number of bits. Is this correct? To get the range of Vmax-Vmin, is Vmax = 5V and Vmin= 0V?

If my thinking is right so far I would get: (5V - 0V)/(2^8) = 0.0195 Volts/division. So then let's say I wanted to know what number the microcontroller would get from a voltage reading of 3V from the photoresistor. It would be (3V)*(1/0.0195) = 153.8

#### jwatte

• Supreme Robot
• Posts: 1,345