Go Down

Topic: [SOLV]floating voltage at the output of a light sensor (with arduino Uno rev 3.) (Read 2 times) previous topic - next topic

Elina

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




James C4S

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

http://learn.adafruit.com/photocells/overview
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Elina

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 :) )

Elina


BillO

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?
Facts just don't care if you ignore them.

James C4S


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.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Elina


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

James C4S


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.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

retrolefty



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

Elina

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

DirtBiker

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.
Dirt Biker

Elina

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 :)

Thanks!

Elina

michael_x

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 ;)

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.

 

Elina

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" ;) project could I use an external power supply, connecting, for instance, the arduino to a demo board?

Thanks for previous advice!

Elina

michael_x

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.

BillO

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.
Facts just don't care if you ignore them.

Go Up