0
\$\begingroup\$

I'm very confused about ADC. I do apologize if these questions sound silly. I use ATMEGA328P for ADC.

  1. Why is the negative terminal required for ADC to take measurements, if the ADC pin is already negative by itself?

  2. Why does the ADC only take measurements when resistance is present between the ground and the ADC input pin? If I remove the 1k resistor, then measurements no longer work, why doesn't ADC pick this up, unless a resistor is present?

enter image description here

  1. If I take the VCC and GND wire between my fingers in separate hands, and let the ADC wire 'float', I get a wave: (no photo-cell, just bare wires, GND in my left hand VCC in my right hand and ADC input floating in the air) enter image description here

What is this wave representing? If I don't hold the VCC and GND, then the ADCH is just showing random output, so the wave doesn't occur by itself. My vref is set to AREF of 4v.

If I connect the ADC to an aluminium jar, I see what appears to be square wave, is that possible that I'm picking up some kind of signal from random device, like for example wifi chip? or not without op-amp?

\$\endgroup\$
  • 2
    \$\begingroup\$ Pay attention to your timebase. Is it just possible that your waveform is 60 Hz? Does that remind you of anything? \$\endgroup\$ – WhatRoughBeast Dec 20 '16 at 20:34
  • 2
    \$\begingroup\$ And if it is not 60Hz, it might be 50Hz. \$\endgroup\$ – Tom Carpenter Dec 20 '16 at 20:36
  • 2
    \$\begingroup\$ Without the resistor "technically the voltage does change between the 5V and A0 connection based on photocell value" - no it doesn't! Measure it with a multimeter. \$\endgroup\$ – pjc50 Dec 20 '16 at 20:38
  • 1
    \$\begingroup\$ And is that 50/60 Hz in turn from the photocell being shined on by fluorescent light or just some floating ground in your setup? \$\endgroup\$ – winny Dec 20 '16 at 20:42
  • 3
    \$\begingroup\$ "I mean 60hz is heartbeat, " Oh, really? 60 beats per second? You should see a doctor. \$\endgroup\$ – WhatRoughBeast Dec 20 '16 at 23:46
4
\$\begingroup\$

The photocell and 1K form a voltage divider, creating a voltage depending on the light. You'll get 5V * 1K / (R+1K) as the voltage on A0. With just the photocell, A0 will be pulled up to 5V so that's no use.

With the wires loose, you're picking up stray AC signals - the wires act as an antenna.

\$\endgroup\$
  • 1
    \$\begingroup\$ "voltage divider" - thank explains everything, thank you so much!! Do you think you could tell me where the sin wave is coming from when I hold the vcc and gnd wires? I can never reproduce it unless I take the power supply vcc and gnd and hold them with my hands. \$\endgroup\$ – 0x29a Dec 20 '16 at 21:21
  • 3
    \$\begingroup\$ @0x29a The sine wave is 60 Hz (or 50 Hz if you're in Europe) emissions from your power lines. \$\endgroup\$ – duskwuff Dec 20 '16 at 21:24
  • 3
    \$\begingroup\$ Your body is picking up "hum" from the power mains. This is always present virtually everywhere inside buildings that are wired with power. But most gear is designed to be NOT sensitive to this "noise". What you are seeing is completely expected, normal and predictable. If you look at the FREQUENCY of your signal you will find that it is almost certainly the utility power frequency (50Hz or 60Hz depending on where you are). \$\endgroup\$ – Richard Crowley Dec 20 '16 at 21:26
  • \$\begingroup\$ @RichardCrowley that's very interesting, thank you very much for explaining! \$\endgroup\$ – 0x29a Dec 20 '16 at 21:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.