AC wattmeter

Just wanted to hear if you guys think this circuit looks sound. The SPI line goes to an esp32. the whole point with the optocoupling to isolate the microcontroller and some other circuits from the mains. should i omit the extra isolation? The two signals that enter the ADC is between 0 and 3.3V. one represents voltage and the other current. My plan is to determine the zero crossing and power factor in code.

PS: jus saw that one of the leads going to the hall effect chip went to the wrong mains lead.

I'd recommend that you isolate ALL of 5V & 9V circuitry from the AC power line.
Anything that "comes out" (such as the USB connector) or anything someone can touch MUST be isolated.

If it's self-contained and enclosed in an insulated/isolated case it doesn't really have to be isolated... But that makes development/debugging/troubleshooting difficult and dangerous and it's just a bad idea for homemade/hobby projects.

It's probably also a good idea to by extra op-amp & ADC chips. It's always a good idea to have extra chips when developing a new circuit, and it's especially easy to fry stuff that's connected to the power line. :wink:

Take a look at [u]OpenEnergyMonitor.org[/u].

...I'd recommend you start-out by simply measuring current. For "normal household/hobby use" the voltage is known and the power factor is nearly 1.0. After you get that working you can add voltage & phase measurements later if you feel it's necessary. And, the Hall effect device is isolated which simplifies everything!

I just want to add my opinion to ISOLATE EVERYTHING CONNECTED TO THE AC LINE!

There are few applications where I would not isolate from the AC powerline. Also, keep in mind that if you don't connect something like a 1M resistor from circuit common to the AC ground, you may have problems with static buildup.

With a low power circuit like this, probably not much capacitive coupling. I have seen higher power circuits with more capacitive coupling in the power supply transformer cause ungrounded isolated circuits to float at 1/2 of the powerline voltage, with enough coupling to cause a small shock. Those were arcade games with cheap replacement switching power supplies.

CS is an input to the ADC, not an output from it.

Why not use an energy meter chip like the AD7751?

Watcher:
Why not use an energy meter chip like the AD7751?

I'll read up on that. probably won't go with that aproach though since i've allready bought some of the parts. I'm also real eager about trying to program this.

MarkT:
CS is an input to the ADC, not an output from it.

Thank you for the heads up.

DVDdoug:
I'd recommend that you isolate ALL of 5V & 9V circuitry from the AC power line.
[/quote]
This circuit is isolated from everything else on the circuit board in this design. just curious if i could get rid of the adc and feed the signal directly do the esp32 wich i now understand is a bad idea. Just a bit of a shame since the esp has so many ADCs