loading

How can I read accurate analog values on Arduino A2D?

I am running an 8x8 screen from the 5v supply on board an arduino (controlled by the arduino via shift reg's). I am also trying to read an analog value over one of the analog pins. I have noticed however large variations in the analog read value, enough to make it near useless. I get the same problem to a lesser extent without the screen on but still rendering it next to useless. Normal resistors seem to be absolutely fine giving a near constant value, but using photo-transistors produces the error, as does reverse bias LEDs. Any Idea's whats going on or how it may be fixed? p.s. When the screen is on the interference is cyclic, looks like a relatively steady (frequency) sine wave. The rate of the interferences wave seems to vary with how long the display sequence is (basically its display, read, display, read loop). When doing a read I have tried with the screen both on and when the shift regs Output En is low (effectively off) - still getting the cyclic interference. Interference when all that I am doing is analogue reading appears random.

sort by: active | newest | oldest
frollard8 years ago
Is your screen outputting anywhere near the phototransistor? Are you in a fluorescent lit room, or near a computer monitor? All of these would make flickering light, and a flickering signal. You could 'average out' the value of the phototransistor with a small capacitor - I can't give details because thats just theory in my head. What are you trying to sense with the phototransistor, and can it be replaced with a different component that is less susceptible to outside noise? Worse case scenario is get an external A2D chip and use that. The arduino's a2d is pretty weak sauce if you need real accuracy.
andy (author)  frollard8 years ago
My ultimate goal is to light each LED in sequence, and using light reflected (read before the LED is on, read while the LED is on, first minus the second and just print the result to serial) evaluate whether something is over the screen (I.e. use it as an interface). At first I tried reverse biasing the LEDs in the matrix, but I got interference. I assumed that the reason was the LED's not being sensitive enough, or some strange capacitance effect across all those dual package LEDs. However I have since got the same effect on everything. In terms of an external source of interference; I have tried reverse bias LED's, Cds's and photo-transistor's with the lights off, the screen off and using a torch to attempt to get some response. In analysis later it seems that averaged over 20-30 reads an extremely small increase 5+/- can be seen when the light source is particularly intense, but this is hardly the level of accuracy I need. Would this be something to do with the regulated 5v do you think? or varying amounts of current being drawn by the matrix/drivers (despite no activity of the drivers at the time of reading an analog value)?
frollard andy8 years ago
Theres a lot of work using leds in a matrix as an input device....

http://hackaday.com/2007/12/16/diy-led-multi-touch-panel/

http://cs.nyu.edu/~jhan/ledtouch/index.html video only

http://www.pcb-dev.com/index.php?option=com_content&task=view&id=15&Itemid=56&lang=english video, schematic, and firmware (For an arm7 processor)
andy (author)  frollard8 years ago
Thanks, very helpful. :) Drew
frollard andy8 years ago
I really hope it helps - they got it working, so it's a sound proof of concept!
frollard andy8 years ago
gmoon8 years ago
I'd say just "punt," and use a photoresistor (CdS cell) instead. They don't need any fancy biasing or op amps to get decent light intensity readings. Just wire one up in a voltage divider, and read the ADC to your hearts content. (I use bare AVRs, not Arduinos, but it's the same hardware.)
andy (author)  gmoon8 years ago
Problem is that I'm looking for something really sensitive, would this approach yield a good level of accuracy?