Open Energy Monitor Port


Hey @RWB

Good to hear from you again.

I assume this AC inverter is putting out 110-120VAC?

Are you looking to monitor current being drawn from the inverter by AC loads connected to it?

Are the AC loads inductive or resistive? If you aren’t sure let me know what the loads are.


Yes, I just want to measure outgoing AC current as accurately as possible. No current will flow into the inverter.

The loads can be anything or a mix of both types since an end user can plug in all kinds of devices.

Do you think your board is required or could this be done with just a Photon and current the same as you guys are using? I see the benefits of how yours are scalable but for my application, I don’t need to scale them.

I’m going to buy one of your 95 or 97% current sense boards for testing but I’m trying to minimize the cost of adding the current sensor to $130 inverter.

The inverter has current sensing but it’s not accurate in the lower ranges which drives me nuts.


I’m rejoining this conversation after a year or so so apologies if I’m missing something.
@RWB - I’ve just checked the correlation between my Photon meter readings measured using a 60A current clamp and by counting the number of 1 Wh LED meter flashes per 15 second sampling period.
I get Power(clamp method) = 0.977 x Power (LED method) with an R squared value of 0.97
Is that close enough to your desired 95% accuracy? Most of the error comes from comparing a spot current clamp reading every 15 seconds with the count of the number of meter flashes between 15 sec samples so the measurements are not synchronous.
Regarding using 110-120v, the current clamp couldn’t care less what the working voltage is as it measures current. I have quite a few switch mode power supplies and reactive loads so I do need to multiply the instantaneous current by the instantaneous voltage to get the true power. (The voltage is obtained from a low voltage ac power supply plugged into the mains near the meter.)



Yea I think that would work.

I ordered one of these for testing but Ideally, I would just use the current clamp & Photon only.

I’m guessing if that 97% current sensor works well I can just use one directly with a Photon to keep cost down.

The inverter spits out its output voltage data so I don’t need to try to figure that out, just the current.

I have this 30A sensor from back in the day but I’m not sure how to wire it to the Photon and what code I should use with it.

Any advice on that?


Seeed has a hookup guide and product sheet for that sensor.


The current clamp has an output of up to 1V proportional to the current detected (up to 30A for your sensor) and because the current is alternating, so is the voltage. Because the photon measures voltages in the range 0 - 3.3v you need to offset the output of the current clamp. An easy way to do this is to have two equal resistors, say 10k, one attached to the photon 3v3 pin and one to GND. The other end of the resistors are both connected to one side of the current clamp - this sets the voltage of that side to 1.65V (3.3v / 2). The other current clamp connection goes to an analog pin on the photon (A0 in my diagram). With no current, the pin will be at 1.65V. When a current goes through the current clamp the voltage on the analog pin will vary about 1.65V. 30A would make the voltage on the analog pin vary between 0.65V and 2.65V. A capacitor between the analog pin and ground reduces the noise of the measurement.
You measure the current by reading the voltage on the analog pin several times for each cycle of the alternating current you are measuring. For 60Hz you could read the pin around 1200 times a second to get a reasonable view of the varying voltage.
The Open Energy Monitor web site has lots of detail about the measurements and appropriate software. To check that your hardware is working you could incorporate this snippet in your code … declare an int V[20] then put the following in the loop() function
// make 20 voltage measurements over about 1/60 sec
for (int i = 0; i<20; i++){
V[i] = analogRead(A0);
delayMicroseconds(800); //gives about 20 readings per mains cycle
// now print out the voltages you measured
for (int i=0; i<20; i++){


@phec Thank you very much for helping me out with the schematic and hookup instructions :slight_smile:

Looks pretty easy.

Now I just need to find a 10 amp current sensor for the highest resolution.

I’ll give this a shot and report back on my readings.


@RWB - if you have enough slack on the cable you are measuring the current in you can loop it two or three times through your existing clamp. That way it looks to the clamp as though you have two or three times the current. Remember that you loop only the live or the neutral through the clamp. if you put both live and neutral you measure no current as they cancel out. For the best accuracy maybe put some cable ties around the cable so that the wires don’t shift with time relative to the clamp.


sir, im using the same circuit as shown above but at the analog input im getting 1.65v constant
which is in analog count …so p


Have you sorted this out? 1.65v is the correct voltage if your meter is on DC.


Hi, I have found the project on this interesting and thus i decided to try it. However, the values I’m getting seem to be too low. I followed this site’s code and I kept getting values for apparent power to be around 12W to 21W when measuring it from a fan. Am using an 18ohms burden resistor and all other values are the same in the site. Not very sure what’s wrong or am I doing the math wrongly. The fan’s supposed power is 60W and I’m from Singapore so the voltage here is about 240V.


The EmonLib library used in that project does not take into account that analogRead() on Particel devices returns 12bit ADC values while Arduinos work with 10bit.
You need to adapt the conversions accordingly.


Oh ok! So how can I go about converting?


Oh and if it helps when I connected it up to a multimeter, the AC readings it was giving me was about 0.5 to 1A! Was wondering if this was somewhat correct which means I can either pinpoint the problem to my code or to my setup


The problem arises wherever the library uses 1024 (should actually be 1023) instead of 4095.
Hence your readings tend to be only a quarter or four times as high as they actually should be.
The wrong factor may also be part of the constants used here

     if ((startV < (ADC_COUNTS*0.55)) && (startV > (ADC_COUNTS*0.45))) st=true;  //check its within range

Even the EmonLib contributed to Web IDE has that same calculation flaw.
But there is another library semonlib which uses some adapted maths.


Oh I see! So should I switch to using semonlib or should I add a line to modify the code that runs the program?


Your choice.


Hi, I switched to using the semonlib and it seems to be working but just wondering if I would need any other calibration with regards to this? i still get values for my 60W fan at about 27.84W and it seems to be far from that of 60W


Good morning guys …I have a solution to the issue with these boards …I’ve designed my own open energy monitor but I used a commercially available power converter IRM-02-5 $6.00 120/240 to 5VDC to power the Module and the LTC2945 DC current and voltage Monitor …I used a .5 volt bridge rectifier to rectify the AC current into DC . With Capacitor to smooth things out …Works pretty well …

Particle Mesh energy meter

Whichever version of emon.lib is in the Web IDE, I have been using it on the Photon for 2 trouble-free years. Actually my weather data provider quit, so I have to recode due to that.
I built a voltage divider and current transformer setup similar to the one on the Open Energy Monitor page and use it to measure the output of my solar array.
Whoever added that to the Web IDE, thanks a lot!!