Open Energy Monitor Port

I will definitely check that out! Thanks @phec

Hi @Bluzcat,
These are 5v devices with a minimum supply of 4.5v so it would be easier if you can find a 3.3v device to run off the 3v3 supply stabilised by the Photon. This type of sensor should be more accurate than a current transformer but you do have to break in to the supply lead which isn’t always practicable. Also these sensors aren’t magnetically shielded at all so if there is anything magnetic around you may lose some of the advantage that a Hall sensor gives you.

OpenEnergyMonitor discussion of using Hall Effect Sensors
Now I vaguely remember working in a lab with a very large magnet and some tiny little Hall voltages - but everyone who worked with the big magnet was a little strange … but back to moving magnets - we could detect a bus driving past 100yds away.

1 Like

p.s. Wiring up your project is simpler than using a current clamp. These Hall effect sensors give a signal centred on 3.3v / 2 so they can go straight onto the ADC pin (if you pick the appropriate sensor) without having to offset the AC to be always positive.

If you are using the OpenEnergy emon library modified for particle devices, then the calibration is simple. Call:

emon1.current(1, 30);         //pin, Ical correct at 1kW

In my case I use a calibration factor of 30 because 30a gives me a 1v signal to the ADC. (1 volt above or below 3.3v / 2)
For an ACS711EX you would replace 30 by however many amps give you 1v from the sensor. With a 3.3v supply the ACS711EX gives a signal of 45mV per amp so the calibration factor would be 22.222 (1/0.045)

1 Like

@javier_pelaez that looks really nice. It’s basically what I was trying to do with the hall effect sensors. Does it work for 110V? I assume the code is open source?

I have consolidated the various changes to emonLib into a new Gist:
EmonLib for core or photon - with waveform saved

1 Like

@IOTrav Hey, it’s been awhile!

I have a 500w AC inverter that is supplying me with correct data except for accurate AC Output current readings.

I need to add an AC current sensor and I see you now have some single line AC current sensors to pick from that are 98 - 95% accurate.

My first question is if this 98% accurate current clamp can be used directly with the Photon without any problems? I only need to measure the AC current output of the inverter, all other data the inverter supplies.

I have limited room inside the inverter case so just adding the 98% accurate current clamp and Photon would take up the least amount of room. I’m looking for the best accuracy also. The 500w inverter can peak up to 900w.

Any advice is apperciated!

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.)

1 Like

@phec

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.

https://m.seeedstudio.com/detail/547

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++){
Serial.println(V[i]);
}

3 Likes

@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.

1 Like

@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.

1 Like

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. https://learn.openenergymonitor.org/electricity-monitoring/ct-sensors/how-to-build-an-arduino-energy-monitor-measuring-current-only 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