Pages: [1]   Go Down
Author Topic: AnalogRead on Seeeduino Film?  (Read 1264 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 32
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am trying to read an analog voltage on my Seeeduino Film - using the exact same circuit on my ArduinoUno works exactly as expected and I receive a value of ~335 (expected value when measuring 3.3v), but when I wire it up to my Film I get a constant result of 1023 in return.

I am using 2 10k resistors in a standard potential divider circuit.

Please see my code below:

Code:
int val;

void setup()
{
  pinMode(1, INPUT);
  Serial.begin(9600);
}

void loop()
{
  val = analogRead(1);    // read the input pin
  Serial.println(val);
 
  Serial.println(val);
  delay(1000);
}

My code is as simple as it can get, and I am using the exact same code on both.

It is definitely wired up to Analog pin 1 - all other pins return floating value as would be expected when not tied to anything.

Does anyone have any suggestions?

Regards,
Morrolan
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am using 2 10k resistors in a standard potential divider circuit.

What value voltage is wired to the top resistor? Is the bottom resistor wired to arduino ground pin as well as the negative terminal of the external voltage being measured?

Lefty


Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 32
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am using 2 10k resistors in a standard potential divider circuit.

What value voltage is wired to the top resistor? Is the bottom resistor wired to arduino ground pin as well as the negative terminal of the external voltage being measured?

Lefty




The top resister has 3.3v going to it, and yes the bottom resistor is going to ground.  I measure 1.63v across each resistor so the divider is working as a standard divider.

On my Uno, when I tie the top of the divider to 5v, I see an analog input of around 510 as expected (half of the measurable 1023 for 5 v) and when I tie the top resistor to 3.3v, I see the figure of 335 on the analog pin - again as expected.

     5v
     |
    | |
    | |  R1
    | |
     |
     |
     |------------ Analog Pin (A1)
     |
     |
    | |
    | |  R2
    | |
     |
     |
    GND

Regards,
Morrolan
Logged

Brunsbüttel, SH, F.Rep.GERM
Offline Offline
God Member
*****
Karma: 4
Posts: 596
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hm

1.
u could try a lower voltage (like 500mV instead of 1.63V)...
and c what happens...

2.
u could call
  analogReference(DEFAULT);
just to be sure, that it uses VCC as reference for the ADC...
Logged

-Arne

0
Offline Offline
Shannon Member
****
Karma: 201
Posts: 11744
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is AREF connected?  Have you called analogReference() ?
Logged

[ I won't respond to messages, use the forum please ]

0
Offline Offline
Newbie
*
Karma: 0
Posts: 32
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is AREF connected?  Have you called analogReference() ?

AREF isn't connected and no I haven't called analog reference - as it is a battery powered circuit, I was going to simply compare the analog reading to a known value for a full battery.

Do you recommend using analogReference()?
Logged

0
Offline Offline
Shannon Member
****
Karma: 201
Posts: 11744
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No I was just wondering if AREF was used and at ground potential which might explain the symptoms...
Logged

[ I won't respond to messages, use the forum please ]

Austin, TX
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What if you tie A1 directly to ground?  Does the A/D read 0?  If you leave it floating do you get random values?

Have you tried using the other analog inputs? 
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you ever get this sorted out?

I set up two Films with analog sensors and they worked just the same as it had on my conventional duinos. Then I bought two more from a different supplier, and they do just what you describe: repeating 1021s regardless of which input port I use.

They also came loaded with a sketch of some kind that outputs a 'test failed' message.

cheers
Logged

Pages: [1]   Go Up
Jump to: