Assistance with using ADC on my microchip

Thread Starter

Virginator

Joined Apr 13, 2017
2
The device I am using is an esp8266 which uses an xtensa microcontroller if that is relevant. There is only one Analog to Digital converter pin on the microcontroller.
I connect a small resistor in series to a load. At one side of resistor is the neutral wire and the other side goes to the load. I want to measure the voltage across the resistor since by measuring the voltage I can find out the current in the wire ( I = V(mains) / R(resistor) ) which is an easy way to measure AC current.
The problem is I am stumped about how to go about isolating my microcontroller from the mains. The ground reference for the microcontroller and ADC is the same, so that implies I have to ground my microcontroller to the mains (instead of keeping it floating relative to mains like power converters do).
How do I go about doing this?
 

Deleted member 440916

Joined Dec 31, 1969
0
First of all it does not sound like you are very experienced with this sort of thing so PLEASE BE EXTREMELY CAREFUL.
Do not connect your microcontroller in any way to the mains, power it like any other project from a wall wart or batteries.
If you want to measure mains current SAFELY look at the ACS712 series chips, they are fully isolated hall effect sensors, I believe they are available ready mounted on a small pcb from the likes of Ebay.

Good luck and remember safety first, well insultaed box to contain the ACS712 and whatever load and supply connectors you are going to use.
 

Thread Starter

Virginator

Joined Apr 13, 2017
2
Thank you for your replies. However AC712 is quite costly, the cheapest I can find is around a dollar. Actually I am making an ultracheap wifi switchboard and if I use say six AC712 in my design i.e. about 5$ - then it's equivalent to the cost of the rest of the module !! I'd rather not have this feature than take such a huge price bump!!
I am now thinking of using an analog optocoupler and multiplexing six signals through optocoupler it to my ADC (ACS712 can't be multiplexed since it connects in series). That might be quite cost effective but I'll have to try and make sure it works reliably, I'm anticipating that each signal will require calibration which can be quite a pain.
Meanwhile I will be glad to hear if someone has something to add.
 
Top