6
\$\begingroup\$

I'm working with an Arduino Uno board. I have a series of voltage dividing circuits off to the side of a breadboard to give me four different voltages. I'm connecting to my laptop.

I am using the example given on the Arduino website just to test to make sure the pin is reading properly and that the chip is making the decisions necessary from there. But looking at the serial monitor, I got gibberish. So I switched to an if/then statement, saying if the voltage went high (and put the threshold as low as it can go - 1) to turn on a LED on pin 13.

I even added on my own LED and resistance, since the one on the board didn't seem to be working. But this one isn't turning on unless the voltage is 2.5 V or greater. I've switched out the extra LED and resistance to try to create the most ideal situation to turn on the LED, but still nothing until the voltage going into the input pin is over 2.5V. But on the site and in the datasheet, it says that it SHOULD read anything from 0 to 5. I'm trying to read voltages ranging from 13 mV to 780 mV. Small, but according to the datasheet, not too small.

Does anyone have suggestions? Should I just throw an op amp or something on the end to bump up the voltage?

\$\endgroup\$
  • \$\begingroup\$ Can you post your code? \$\endgroup\$ – Majenko Nov 30 '11 at 19:39
  • \$\begingroup\$ Can you show us your code? And a schematic of the circuit you have set up? And a link to the example you reference above? Any or all of that would be helpful. Note that if your pin13 LED isn't working, that would be - IMO - a red flag that your UNO might be damaged in some fashion. Can you run the "LED Blink" example and blink the LED On pin13? \$\endgroup\$ – mindcrime Nov 30 '11 at 19:42
  • \$\begingroup\$ or a schematic / picture? \$\endgroup\$ – NickHalden Nov 30 '11 at 19:42
4
\$\begingroup\$

Try this code:

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.println(analogRead(0));
  delay(1000);
}

Load the serial monitor, set it to 9600 baud, and see what you get.

\$\endgroup\$
1
\$\begingroup\$

You should test the ADC, initially, with inputs between 0V and 5V, supplied from a pot. Forget about blinking the LED for now, and simply output the ADC values to the PC, so that you can check them.

\$\endgroup\$
0
\$\begingroup\$

There are several areas for open debugging questions..

Is the board and its components function? Is your code correct, no logic gaps?

I assume you have a multimeter/oscilloscope, I would test everything in parts from sending data through the serial properly, check that it outputs low and high properly, and that the actual signals your trying to read are in the range your stating and not in the negative or something else.

\$\endgroup\$
0
\$\begingroup\$

I think it's actually the LED itself. It's an abnormally high voltage drop, 2.5 V! So anything under that and it won't turn on. But if I hook up my DMM to the pin itself, it's reading the voltage fine.

So I'm just going to switch out the LED with a 1.6V and it should be all set.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.