8M - ADC cross-dependence

kfahrner

New Member
I try to compare signals from 2 LDRs for solar panel tracking. I use PICAXE 8M, ADC1 and ADC2 and have thye LDR with 680 Ohm resistors as voltage dividers. When monitoring the input signals on Debug the following problems occur:
1. the signals are relatively unstable, eg. between 98 and 117 digits with constant light level.
2. Although exposed to the same light level both vary in opposite direction: eg 98/117, then 115/100 etc.
3. As soon as I shade one LDR, the second value changes too, eg. shading sensor 1 reduces its signal to 29, but sensor 2, still exposed to full light comes back to 70.

I have replaced the LDR with highly constant, variable power supplies and the croos-interference remains. Does anybody have an idea?

 
 

eclectic

Moderator
Have a look at this old posting

<A href='http://www.rev-ed.co.uk/picaxe/forum/Topic.asp?topic_id=3321&amp;forum_id=19&amp;Topic_Title=one%2BADC%2Binput%2Bstuffing%2Bup%2Banother%2BADC%2Binput&amp;forum_title=No+new+posts+please%21+13' Target=_Blank>External Web Link</a>
 

hippy

Ex-Staff (retired)
If you want to just determine which LDR is receiving more light, then you could wire them as a potential divider with one LDR at the top and one at the bottom. A pot can join the two with its output going to the ADC input.

Adjust the pot so it reads $80 ( 128 ) when both LDR's are illuminated equally, and then when the reading is greater or less than that value, you know one LDR is receiving more light and can act accordingly to balance them out.
 

kfahrner

New Member
Thanks very much to both replies. A problem with the chip was the least I expected, especially as I exchanged it for another one (from the same old batch). Repeating the readadc statement works brilliantly and I now have a test assembly showing all 3 ADCs working independently.

Thanks also for the suggested bridge solution. It reduces the need back to 1 ADC. Very good, as it frees one of the I/O pins up!

 
 

wilf_nv

Senior Member
When you use two LDRs in series as a half bridge they should have matched resistance when the light on them is equal.

If you have a batch of LDRs to choose from, try to find two that have similar resistances when exposed to the same nominal light level.

You can also match two unequal LDRs by attenuating the light reaching the LDR with the lower resistance by obscuring a portion of the light sensitive face with some opaque material, for example using a bit of tape or a marker pen.

wilf
 

kfahrner

New Member
Following your proposals I have further experimented with the half bridge (voltage divider) solution. It has introduced much greater sensitivity. Further improvement was achieved by introducing a mechanical divider wall between the sensors.

The device is now tracking the turntable with the solar panels accurately, even under overcast conditions! Introduction of a hysteresis has helped to filter out various 'noise'.

Thanks again to all contributors. Klaus

 
 

premelec

Senior Member
Just one more thing... when the LDRs in your half bridge are dark and high - perhaps very high - resistance effectivily you have a floating input which can give erratic readings - best put a 20K to 50K resistor in parallel with each LDR so you get a midscale reading when units are dark. Presumably you aren't running at night but you don't indicate how you discern darkness etc. Using unequal paralled resistors and LDRs with low illuminated resistance could give you a darkness reading as then your ADC input would reflect the paralleled resistive divider voltage... if you paralleled only the 'low' LDR with a resistor to low voltage then when dark the ADC input should be zero.

I know you didn't ask but I'm working this out for my own use too! :)
 

hippy

Ex-Staff (retired)
One trick to measure actual light level might be to force the divider to be a single LDR divider by forcing a voltage in to it ...<code><pre><font size=2 face='Courier'> -.- +V
.|.
--&gt; | | LDR
--&gt; |_|
| | /|
}-----|&lt; |-----&lt; DIGITAL OUT
.|. | \|
| |
POT | |&lt;------------&gt; ADC IN
|_|
|
.|.
--&gt; | | LDR
--&gt; |_|
|
-^- 0V </font></pre></code>
 
Top