Go Down

### Topic: AnalogRead on Seeeduino Film? (Read 1 time)previous topic - next topic

#### Morrolan

##### Oct 03, 2011, 02:08 am
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.

Code: [Select]
`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

#### retrolefty

#1
##### Oct 03, 2011, 02:11 am
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

#### Morrolan

#2
##### Oct 03, 2011, 09:05 am

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

#### RIDDICK

#3
##### Oct 03, 2011, 11:12 am
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...

#### MarkT

#4
##### Oct 03, 2011, 04:43 pm
Is AREF connected?  Have you called analogReference() ?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### Morrolan

#5
##### Oct 03, 2011, 07:12 pm

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()?

#### MarkT

#6
##### Oct 03, 2011, 07:25 pm
No I was just wondering if AREF was used and at ground potential which might explain the symptoms...
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### cmiyc

#7
##### Oct 03, 2011, 09:15 pm
What if you tie A1 directly to ground?  Does the A/D read 0?  If you leave it floating do you get random values?

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

#### Zer0

#8
##### Feb 16, 2012, 10:38 am
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

Go Up