Go Down

Topic: IR range/proximity detector not working as expected (Read 4 times) previous topic - next topic

adrian_h

Thanks, but I have taken that into account.  I even removed the sensor circuit and connected A1 directly to the ground and I get this:

Sgl = 835, 1023, Sum = 403312, 1022992, Avg = 280.47, 711.40, Dif = -430.93

and when I connect it to Vcc:

Sgl = 0, 0, Sum = 29, 109, Avg = 0.02, 0.08, Dif = -0.06

Notice that the on value is lower than that of the off value?

This makes no sense.
I'm a programmer dammit, not an engineer! :D
Like this post?  Please give me some karma for it.  Thanks! :)

adrian_h

Yeah, I think I have found the problem.  The LEDs are pulling too much current and are causing other things (i.e. the ADC) to fail.  I'm going to have to have a separate current source to get them to be as bright as I want them (between 100-200mA if not more).  Thing is, how do I wire one up using a transistor as a switch who's base is controlled by the Arduino and uses an external battery as a current source?  They would require a common ground right?  Would I just connect the negative terminal of the battery to a ground pin of the Arduino while using the USB as the primary power source?  And then when I eventually make this a self contained unit, can I draw off the battery directly?
I'm a programmer dammit, not an engineer! :D
Like this post?  Please give me some karma for it.  Thanks! :)

Grumpy_Mike


michinyon

LED's don't really have "resistance".  They have a quite non-linear voltage vs current characteristic.

To run them in parallel,  you need a separate means of current regulation ( a constant current source,  or a resistor )
for each one.

You can also connect them in series if you have a high enough voltage source,   and then you only need one
means of current control.

adrian_h


LED's don't really have "resistance".  They have a quite non-linear voltage vs current characteristic.

To run them in parallel,  you need a separate means of current regulation ( a constant current source,  or a resistor )
for each one.

You can also connect them in series if you have a high enough voltage source,   and then you only need one
means of current control.

Yeah, I sorta understand that they are non-linear.  But if you know the Vin and the voltage that each diode will stabilize at, what happens if you use only one resistor?  Can you not calc the current flow?  Or is this not a good idea as the stabilized voltage will drift over the life of the LED causing the current to shift as well?

I'm a programmer dammit, not an engineer! :D
Like this post?  Please give me some karma for it.  Thanks! :)

Go Up