Detect alternating current using one contact only and arduino analog input

acarduinovoltage-detector

I am trying to setup an arduino so it can detect an AC where it only has access to one pole.

(kind of like these "electricians screwdrivers" that you put in one of the connections of an electric outlet, and then it lights up by completing the circuit through the users body)

I have access to a simulated ac power source, a pin from a different controller with a different power source that is toggled between high and low every 10ms.

Now, when I connect the arduinos analog input and gnd to the ac power source, and print out the value of it every 5ms to the serial monitor of the arduino, all i get is zeros.

However, I know that current is flowing, because when I put a buzzer between the one ac pin and the arduinos gnd, I hear a sound from the buzzer.

Why am I not detecting the current here? Do I have to build my detector differently? below is a simplified drawing of my setup.

Thanks
enter image description here

(Sorry I am not an electrical engineer, please forgive the limited language and knowledge)

Best Answer

Those "electricians screwdrivers" detect voltage (not current) and while it may appear that there is only one contact point, they rely on the human body having a path to ground to complete the circuit.

The Arduino's analog inputs measure voltages between 0V and +5V. To measure current you must convert it into a voltage that is within this range. The simplest way to get voltage from current is to pass it through a resistor, then the voltage across the resistor is determined by Ohm's Law (V=I*R). For example if your buzzer draws 1 Amp and you insert a 1 Ohm resistor between the buzzer and ground, you will get 1 Volt.

However there are a couple of possible issues. Firstly, the resistor will steal 1 Volt from your buzzer (so it will buzz even more quietly). You can use a smaller resistance to reduce voltage drop, but then the signal also gets smaller. If you use a 0.1 Ohm resistor the voltage drop should be minimal, but the reading you get will be only be 0.1V per Amp. If you just want to tell whether whether the buzzer is on or off then this should be plenty. If you want accurate reading of lower currents then the voltage may have to be amplified.

Secondly, the current is AC - so the voltage you get will be a sine wave that goes both positive and negative. Since the Arduino can only measure positive voltage it will only 'see' the positive half cycles. This may be fine for your application. However the analog input could be damaged by negative voltage, so you should add a protection circuit to prevent the voltage from going below ground.

In the circuit below, R2 and D1 prevent the analog input from going below -0.3V.

schematic

simulate this circuit – Schematic created using CircuitLab