Go Down

Topic: A0 to GND - Voltage swinging from min to max continuously (Read 289 times) previous topic - next topic

JamesFutcher

I am attempting to build a motion sensor as described at http://hebertchad34.wixsite.com/chad-hebert/single-post/2015/06/07/Arduino-Seizure-Alarm.

Having assembled it, I've run into an issue where A0 pin is reading 0 - 1023 - 0 - 1023 on repeat. I'm now trying to work backwards to see where I've gone wrong.

Where I am currently at, I have a Arduino Micro running the AnalogReadSerial example. In terms of hardware, I have a 1M resistor from pin A0 to GND, no other hardware attached. The serial output shows A0 is reading in the mid hundreds. Whats throwing me is if I connect anything a circuit of any kind, or even simply touching the resistors leg with my finger, it begins the 0-1023-0-1023 behaviour again.

What I was expecting to happen was 0 (Or very low) voltage with nothing but the resistor connected, and then some voltage showing when I connected the piezo sensor. At this point I can only assume that my expectations are wrong, but if thats the case, I don't know what I should be expecting, which makes troubleshooting hard. Have I got the wrong end of the stick here? Where is the voltage coming from?

sterretje

I think that 1 MOhm can be considered high impedance and hence picks up noise from the environment.

Just try to short to ground, to 3.3V and to 5V. That should give consistent readings.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

DVDdoug

If you have long unshielded wires you WILL pick-up electro-magnetic noise/interference with a 1M impedance/resistance.  

Your body also acts as an antenna so you'll get more noise when you touch the input.   If you've ever touched the input of an audio amplifier and heard a buzz, that's your body picking-up the AC power line frequency.  

With short wires I'd expect it to read zero or very-close to zero but that depends on your electrical environment.   If you're close to a transformer you'll pick-up more noise, etc.

Lower impedance will help but it will also make the piezo less sensitive.    Shielded wires and installing the Arduino in a metal box will help too.


P.S.
Make sure to ground yourself before touching the circuitry, or wear an ESD wrist strap.   If there is a charge on your body you can kill electronics, and it doesn't have to be bad-enough that you see or feel a spark.

polymorph

How long are the wires from the piezo to the Arduino? Are you using shielded coax, or twisted pair, or just some lengths of wire?

It really sounds like you are picking up AC hum on the wires.

What power source? Cheap USB chargers may have unacceptable leakage between the incoming AC and the output, causing the common line of the output to float at something like 1/2 of the AC line voltage.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

JohnRob

The type of Piezo you have (PVT film) can generate a huge voltage, but at very low current.  The output is AC.   The current is low enough it cannot damage the inputs to the arduino (it will go through the internal clamping diodes).


Not knowing the length of wires you have,  I would expect:

1) No movement A0 should be low most of the time

2) With movement there will be spikes of 1023, but perhaps not consistent.  Being the Piezo can create a negative voltage I would think when not 1023 A0 would be at or near 0.

The sample of Piezo film I have was connected to a small neon lamp.  When it waved it in the air, the lamp would flicker.  Neon lamps need at least 50V to light.



Please do not PM me with thread based messages.  If your thoughts are worth responding,  the group should benefit from your insight.

MarkT

Where I am currently at, I have a Arduino Micro running the AnalogReadSerial example. In terms of hardware, I have a 1M resistor from pin A0 to GND, no other hardware attached. The serial output shows A0 is reading in the mid hundreds. Whats throwing me is if I connect anything a circuit of any kind, or even simply touching the resistors leg with my finger, it begins the 0-1023-0-1023 behaviour again.
This is the day you learn that nearly everything in a mains-powered building is bouncing around at dozens of volts ac
at mains frequencies.

The reason is simple - mains wiring is not shielded, and thus the whole building is permeated with wiring
whose average voltage is 50% or 33% of mains live (depending on whether there's an earth wire).  Some other
parts of the building (water pipes, external brickwork) will be grounded to local earth potential

So there's a battle going on between grounded parts of the building and mains wiring - go close to the wiring
and you'll pick up substantial voltages capacitively, hold onto a metal water pipe and you'll probably be a few
millivolts above ground at most.

You normally don't notice as the capacitance involved is tiny, so any current is typically below 1µA.  But a
floating Arduino input is going to respond to even a few nA...
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up