Doubts current sensor ACS712 30A + Nodemcu ESP8266

I have no knowledge of what gives good sampling rates as far as monitoring DC current is concerned but sampling 100% of the time re @glauberbiro’s sketch is very bad for ioT devices.

So it is either increase the timer loop duration or decrease the sampling duration.

Only tests will give you the answer and Blynk can help with this too.
Put a couple of sliders in your project, one to change sampling duration and one to change timer loop duration to see which gives best results as far as stability and accuracy of data are concerned.

Edit: should have stated @glauberbiro’s sketch not @Polikarpos’ sketch.

1 Like

@Lichtsignaal is spot on. Some Blynkers seem to over sample at every opportunity and this is just a bad use of resources.

Just because an ESP CAN sample every few ms it doesn’t mean we should be doing so.
Temperature monitoring is a prime example where you see readings being taken every second when every 600 seconds is probably adequate.


got the point…thanx for your answers

Thanks Costas! I got it! it´s a nice ideia.

1 Like

@Polikarpos are you getting a signal current measure to detect if a lamp is on. I´m doing the same here, but I´m using a voltage detector to get if there is 127V at lamp. I´m using a 4N25 optocoupler working with a built in saturated transistor. Works like a charm and this kind of sensor can use a digital port instead of a analog port.

i ll try that optocoupler someday…my main goal is to get the current reading and calculate the consumption of power in kw…of a single device or a whole house…i just added this piece of code to practice my blynk skills

1 Like

Mmm… +1 for a whole house at the main circuit… Only one sensor needed! :wink:

1 Like

its better to use a ct sensor module 30 or 100A…no high voltage connections at all…

i mean ct sensor along winth nodemcu and blynk…

@Polikarpos probably you will have problems to use a high range CT sensor module to measure low values of current, to calculate power consumption.

I´m working in a project like yours. I´m thinking to use a CT sensor module (100A non invasive) one to each big current circuit, like kitchen, bathrooms. Low current circuits like lamps, I´m planning to use a simple invasive 20A/30A ACS712 module.

Do you know this project? there are lots of information about it.

Hi Felix,
I’m using exactly this sensor in my Blynk project+ESP8266 for control AC current of a water pump without any doubt.
I can share this code if you would, just I have to cut it from my long sketch.


1 Like

both ACS712 module.and ct sensor work fine but the advantage of the ct sensor is that no electrical connections of any type are needed…much more easy to use…
havent tried the 100A ct sensor as for the moment 30A are enough for a small house.
for the openenergymonitor solution i can say that i dont want to pay so much money when i just need a single value of kw for my project…for a more serious professional project when all the features of the energymonitor are required, i would definitely go with that solution…

hi aquarius I am working with the same sensor with esp8266 can you post your code please!

@nabeelaJadoon Code like that is simple, and readily available on Google or in this forum…