Pages: [1]   Go Down
Author Topic: [SOLV]floating voltage at the output of a light sensor (with arduino Uno rev 3.)  (Read 1804 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Solved: it was a soldering issue.
---------------------------------------------------------------------------------------------------
Hi everyone,

I'm working on a photocell project and having some trouble with a sensor.
I'm using this sensor: http://shop.moderndevice.com/products/ambi-light-sensor to catch visible light.
The fact is that the output that I read from the analog connected to the output of the sensor seems insensitive to the variation of light.
It remains almost constant even with sharp changes (from total dark to light).
Since I'm a newbie in electronics, I think I'm doing something wrong in this issue.

Another problem is that the magnitude of the value may change whenever I move the entire system: sometimes around 600, sometime around 400.

Could it depend on the fact that i didn't soldered the sensor with the header pins provided in the package?
I mean: I used the pins provided in the package but didn't soldered them (thanks to Bill0 who made me notice that the previous sentence was not clear)

However I think that, once I keep the system stuck on a surface,the output should significantly change when I change the lighting.
Moreover the header pins themselves shake at the minimum touch.

Below the correspondence between the pins of the sensor and the analog pins of the arduino:

Sensor -----   Arduino analog
Ground ----- 5
+5V   -----   4
V0     -----   3

The code that I'm using is the following:

Code:
void setup() {
Serial.begin(9600);
pinMode(18, OUTPUT);
pinMode(19, OUTPUT);
digitalWrite(18, HIGH);
digitalWrite(19, LOW);
}
void loop() {
int Light = analogRead(3);
Serial.println(Light);
delay(250);
}

I also tried the code with the aliases of the sensor numbers A3, A4 and A5.
Moreover I measured the voltage at the pins: ground and power (+5V) look ok, even if at pin 4 I measured a Voltage of about 4.70V (little bit less than the nominal "HIGH" value 5V).
Can't understand if the issue is a different scale of voltage between the sensor and the arduino board.


Everything seems ok, at least in the configuration. Any idea on how to solve this problem?

Elina



« Last Edit: November 28, 2012, 06:46:26 am by Elina » Logged

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

You need a pull up or a pull down resistor to create a proper voltage divider.

http://learn.adafruit.com/photocells/overview
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: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi James C4S,

thanks for your quick reply.

You need a pull up or a pull down resistor to create a proper voltage divider.

http://learn.adafruit.com/photocells/overview

I'm not using a photocell sensor like the one shown in the link.
Is your answer still valid for the sensor that I showed in the post http://shop.moderndevice.com/products/ambi-light-sensor ?

(I'm quite slow in understanding answer, please be patient smiley )

Elina

« Last Edit: November 22, 2012, 07:28:41 pm by Elina » Logged

Canada
Offline Offline
God Member
*****
Karma: 7
Posts: 600
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Your code looks like it should work given the information you have presented  However, I am not sure what you mean by the following:

Quote
Could it depend on the fact that i didn't soldered the sensor with the header pins provided in the package?

and

Quote
Moreover the header pins themselves shake at the minimum touch

Does this mean you used the supplied headers, but did not solder them? Or does it mean that you used headers that do not fit properly?

Can you show you a clear photograph of your set up?
Logged

Facts just don't care if you ignore them.

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

Is your answer still valid for the sensor that I showed in the post http://shop.moderndevice.com/products/ambi-light-sensor ?
It appears that module has the divider built into it already.
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: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Does this mean you used the supplied headers, but did not solder them?

Exactly!
They fit properly, but if they are accidentally touched they may exit the slots on the arduino board in which they are inserted.

Quote
Can you show you a clear photograph of your set up?

At the moment I can't. I'll provide it as soon as possible.

Thank you!

Elina
Logged

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

Exactly!
They fit properly, but if they are accidentally touched they may exit the slots on the arduino board in which they are inserted.
Yeah, I would point to that as the primary problem.
Logged

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

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

Exactly!
They fit properly, but if they are accidentally touched they may exit the slots on the arduino board in which they are inserted.
Yeah, I would point to that as the primary problem.

I agree. He is assuming (I guess) plated through holes which may not be the case. Solder those header pins to the module.

Lefty
Logged

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

Pictures needed!

Quote

I agree. He is assuming (I guess) plated through holes which may not be the case. Solder those header pins to the module.

Lefty

The pictures are taken from modern device website, however I think they should be clear.
I have a sensor and a three-header pin as shown in picture 1_STARTING_CONFIG.png (and, of course, an Arduino Uno rev. 3 board)
Should i solder the pins and the sensor as shown in picture 2_SOLDERED.png?
And then obtain something like what shown in 3_MOUNTED_ON_ARDUINO_BOARD.png? (even if the pictures shows an arduino 2009?)
At the moment I use the three header inserting their longer part in the holes of the sensor and then fitting them into the pins of the arduino each time I need it.

Thanks.

Elina


* 1_STARTING_CONFIG.png (280.06 KB, 1022x767 - viewed 43 times.)

* 2_SOLDERED.png (222.05 KB, 992x413 - viewed 39 times.)

* 3_MOUNTED_ON_ARDUINO_BOARD.png (544.29 KB, 625x539 - viewed 53 times.)
« Last Edit: November 22, 2012, 07:36:49 pm by Elina » Logged

Windy City
Offline Offline
Jr. Member
**
Karma: 0
Posts: 90
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, for sure.  Solder the short end of the pins into the sensor board, then you can plug it into the Arduino properly as the longer end of the pin will make better contact with the Arduino socket.
Logged

Dirt Biker

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

Thanks to everyone. Now that I know the issue, I would like to ask if there are specific advices on soldering pins on boards of such a small size (around 1 cm^2) or if I can follow common guidelines found on the web. I have 4 sensor and would like to save each of them smiley

Thanks!

Elina
Logged

Germany
Offline Offline
Faraday Member
**
Karma: 56
Posts: 2983
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I can follow common guidelines found on the web
Sure. Soldering through-hole with 0.1" (2.5mm) spacing should not be a problem with a small iron and solder.

Quote
Should i solder the pins and the sensor as shown in picture 2_SOLDERED.png?
If you achieve to get something similar, you're perfect. You'll probably have more solder around the pins smiley-wink

The usual web guidelines are rather about more difficult stuff like SMD soldering.

BTW: You are aware that you "abuse" two Analog Pins as GND and +5V supply; which is no problem with this sensor, if you do not need those analog pins for anything else.

   
Logged

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

Hi,

BTW: You are aware that you "abuse" two Analog Pins as GND and +5V supply; which is no problem with this sensor, if you do not need those analog pins for anything else.

Actually I didn't consider this aspect, however for my project I need only that sensor on my board. Just in case of a "pin -demanding" smiley-wink project could I use an external power supply, connecting, for instance, the arduino to a demo board?

Thanks for previous advice!

Elina
Logged

Germany
Offline Offline
Faraday Member
**
Karma: 56
Posts: 2983
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can use the Arduino 5V, of course, just put your 3 pin sensor on a breadboard ( or wherever you have the other demanding hardware),
and connect the 3 pins individually to GND, 5V, and any Analog Pin.
Logged

Canada
Offline Offline
God Member
*****
Karma: 7
Posts: 600
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think a general guide line would be to always properly solder the appropriate connectors to any size board.  The only time connections should not be soldered is when proper connectors, sockets or solderless breadboard are being used.
Logged

Facts just don't care if you ignore them.

Pages: [1]   Go Up
Jump to: