So in this tutorial, I'll show you how I built my IoT power meter that monitors current and power of appliances similar to the cooler.

But i still got no data from this.

update_interval (Optional, Time): The interval to check the sensor. I connected the reed switch to input pin with enabled pull-up.

They made available these SDKs to program the hardware (Arduino, ESP, Raspberry Pi) and apps (Javascript, Android, and iOS).

Monitor power consumption of your appliances in $4.

I had some disturbation with exterior light and therefor do a check on the pulse length. The idea behind this project is to use the current sensor ACS712 to calculate the current.

The default is 3 times per minute (every 20 seconds).

Al the parts are soldered to a prototype PCB. Was the same circuit design used for both gas and electricity meters?

I checked this, but found out that in my version of the power meter the IR communication is not implemented, apparently it is quite a basic version, only with holes, bu no IR-LEDs.

May someone please give me a hint which one and how to connect which cable to which GPIO PIN? This was easily solved with correct pin header socket from local shop with soldered 2.54mm pin header. values over time.

I already have flashed it and this is working, even it appears in my WLAN. peripheral

By using a pull-up resistor on the output, I could get an output difference of almost 3.3V. What it'd do, under the hood, is it'll pair that power meter with that user account making that account the owner of that device, and only he/she can see the device data. It kept me believing it has to be possible to make the module work when I had absolutely no hopes.

for pushing current and power updates to my project on Grandeur.

https://forum.arduino.cc/index.php?topic=416054.0.

name (Required, string): The name of the sensor. Your email address will not be published.

On this picture you can see everything whats used in production: https://blog.danman.eu/wp-content/uploads/2018/04/IMG_20180316_155349_HDR.jpg, Data format is simple json: https://github.com/danielkucera/ble-meter-mbed/blob/master/src/main.cpp#L114.

On the ESP32, Each customer would have to register his/her account on the web app when he/she buys a device from me for the very first time.

However, to ensure a clear '0' and '1' I choose to add a LM293 comparator.

Unfortunately the sensor cannot report the current consumption in Watts because the sensor can not track time while sleeping; the elapsed time between two blinks is required to calculate the current consumption in Watts.

Normally 1000. Here's how I did its registration. Im trying to measure electricity with the same meter (DDS518L), but Im not getting any pulses. measure the total consumed energy in kWh.

Will report once up and running smoothly.

The ESP8266 detects the low voltage when there is a pulse.

Each @carlb

Im using Tasmota built in Counter functionality.

Therefore I used the LED pulses to read the current Power, the LED pulses 1000 times for 1 kW/h.

I know.

So I no longer have to rely on the same Blynk app for every product I make I can make separate standalone apps for each.

Nevertheless, I chose the second option because software is cheaper and easier to debug than an electrical circuit.

ACS712 is, in fact, a hall effect sensor and it works by measuring the induced voltage of in current carrying conductor sounds confusing ?

See the pictures and the scheme for explanation. If you enable this, set up the count_mode to increase on the falling edge, not leading edge. Your email address will not be published. Here's how it looks while running: We log into the app with the email and password we gave our. What sensor are you using? However, due to the use of the pulse counter peripheral, a maximum of 8 channels can be used! Will my app contain all the power meters I ever sold till date? In next lines Ill describe how I have achieved this. Well I saw the smart air cooler project by Moiz where he switched the cooler on/off from his web app and I thought of extending it a little.

It handles my ESP's connection with my WiFi which gives it the internet connection it needs. i would like to built the power meter, described here: https://esphome.io/cookbook/power_meter.html. At the moment, on the same ESP8266 I have: I like to do the pulse counter for power meter but there is no ready power source at the meter! When it receives interrupt on pin with reed switch, it increases counter value and ignores subsequent pulses for certain time.

- Buck converter.

Use this mode if you power the sensor with a battery.

count the light pulses on a power meter, you can do the following: When the total sensor is configured, the pulse_counter also reports the total

You can check what they are offering at their, and each SDK has its own details documentation.

I suggest to change the minimal pulse length (PULSE_MIN_LENGTH in line 18 of my code) to 5 ms.

// Number of blinks per kWh of your meter. This not only makes it more complex than it needs to be but also compromises other users' privacy.

on the ESP32.

to be the most helpful for they feature real projects there. (I'm loving it), so that we can access our power meter's variables (its current and power) in our user account. However i did not follow through to the end because I went a different route (my meter sends radio signals I went with This ).

While controlling an appliance from phone is cool, it doesn't save you any money, right! Ive had digital meter installed in my fuse box so it was only matter of preparing another board, disabling debounce (because it has nice sharp edges on pulse output) and connecting it: This allows me to debug and optimize my home actual power consumption.Now I am very interested how long will these two meters last on battery.

So i used a step-down converter to get 5V. Im using Wemos D1 MINI and I have connected output pin 20 to D1 pin on Wemos and output pin 21 to ground on Wemos.

internal_filter (Optional, Time): If a pulse shorter than this

After a month in production I can share some data with you.

1 year ago, Dear Mads, thanks for your comment.

Making them light and cheap gave me the idea of showing the current flow and power consumption in a web app (mobile app) instead of attaching an LCD on the meter (LCDs that can plot graphs are not an option for a $4 power meter).

I think its not bad for my first 3D design.

And Grafana can use Zabbix data. The sensors forms a self healing radio network with optional repeaters. First step was to discover how does the measurement work.

I though this could be a very low power solution so I ordered a pair of cheap TX, RX from ali.

My first choice for making IoT device was esp8266 module, specifically NodeMCU Amica which I had at hand.

I started to measure the power usage in sleep mode.

Sorry for the brief description, like I mentioned I did not follow through with this solution.

The pulses are quite weak so I needed some suitable electronic components.

I'm designing my power meter from the same commercial and production point of view as Moiz did: a company producing power meters and selling it to real users. What it'd do, under the hood, is it'll pair that power meter with that user account making that account the owner of that device, and only he/she can see the device data.

What is the circuit for the smart electricity meter?

When I click on it, I see it's current and power graphs getting plotted on data coming from my power meter in real-time.

No way.

Grandeur naturally rejects all requests coming from unknown origins for security, therefore we need to add localhost:3000 to project's allowed origins list.

My newer power meter has more advanced communication, but also this blinking red LED, which I use again. EDIT: just saw this post: Issue with pulse counter component!

That's how the transformers work and that's how we can measure current safely (considering we want to measure current of real appliances which is up to several amps of current). Thanks a lot for pointing at these errors. The first surprise was that the pin pitch was not standard 2.54mm but 2mm. You can see the code here.

predefines the variables that the IoT product would have and which will later be fetched/updated from the device-end or the app-end.

Grandeur handles device communications with Cloud over the web, which means we first need to connect our ESP to internet which is what ESP8266WiFi library is for. That's how simple the circuit looks like: I powered the current sensor with 3.3V (via the ESP) and connected its output to the analog input of the ESP. The MySensors Arduino library handles the wireless radio link and protocol between your home built sensors/actuators and HA controller of choice.

SparkFun Low Current Sensor Breakout - ACS712.

Another important consideration is the fact that ACS712 should only be used for subsystem monitoring and it is highly, to use it for power monitoring of entire home.

What I did was doing ADC on the output of current sensor (which is the voltage induced due to the current) and measured the actual current by multiplying it with the sensitivity of the current sensor (1A change in current changes the induced voltage by 185mV for a 30A current sensor).

The expected consumption in sleep was about 2.6uA according to this.

See integration sensor for summing up pulse counter

Grandeur is a rather new but very mature tool to build IoT products if you are aiming to commercialize. Blynk's app is non-customizable which means saying goodbye to my brand, it's energy based model gets pretty expensive when you scale it to a few hundred power meters, and it solves none of the accounts and pairing issues for me. network topology allowing messages to be routed to nodes. On logging in, I see my PM-1 power meter that I registered earlier from the Cloud Dashboard.

That is exactly why I used a phototransistor. I wasnt satisfied with the result because I wanted it to last at least one year on batteries so I started to look for another solution.

Since I have real users, there are some issues here.

It's pretty much designed for the IoT businesses. I use my router power supply of 12V and found out that a LM1117 is not very efficient and gets quite hot.

Grandeur naturally rejects all requests coming from unknown origins for security, therefore we need to add, to project's allowed origins list. By default they use j-link adapter for upload so I needed to adopt them to use st-link by setting in platformio.ini: At that time it also required some changes to PIO but now it works out of the box. can you share the data format? The counter value is kept in RAM only to avoid flash wear.

This hooked me up to the idea of setting up user accounts.

My Power meter is unsmart today.

Interesting topic Has anyone tried this sitehttps://www.mysensors.org/build/pulse_power, Hi Wim3d, Very nice project and instructions, i have already build it and are currently testing against my electricity company readings, it seems that im always on the low side by between 2-7%.Maybe my meter is pulsing to fast, how fast can this count?? 03. So I thought what if we could see how our appliance is consuming power and tune our usage around that and eventually reduce our electricity bills by a few percent. Timestamping each summary packet with the time of the update helps me plot the current and power on a timeseries graph in my web app. You can see battery consumption for the last year here: https://blog.danman.eu/wp-content/uploads/2019/05/gas-meter-battery-1y.png. When using the LM393 light sensor board and WATTS reading are completely wrong so don't get reported add a 0.1uF capacitor between the DO and GND. Will try to add the resistor and give feedback if this works for me.

(in 6 places). So when a customer downloads my web app, will he/she have to find his/her power meter from a huge list of all those power meters to see its power consumption?

// Watt value can only be reported when sleep mode is false.

This could be solved either by a RC circuit or by ignoring subsequent pulses for some time after detecting the first one in software. The principle of operation is simple: Normally it is in sleep. Required fields are marked *. So we know from basic physics that when current flows from a conductor, magnetic fields gets produced and if you place another conductor in its close vicinity then the magnetic field will induce current in it. "Received last pulse count value from gw:".

What photo resistor to use for the power meter? So I thought what if we could see how our appliance is consuming power and tune our usage around that and eventually reduce our electricity bills by a few percent. I use that in another project (not on Instructables yet), Hi Wim3d, thank you for replying :-)I my pulse length is 5ms, so i tweaked the setting to fit this.I found the limiting factor to be a 100ms delaydigitalWrite(LEDPIN, HIGH); // blink led delay(100); <-----------------------THIS DELAY digitalWrite(LEDPIN, LOW);The calc 3600000ms / 105ms = 34285 pulse/hourhour = 3428.5 watt max readingBecause of this every time our consumption was higher then this, the counter was reading wrong.I changed the delay value to 5msThen calc 3600000ms / 10ms = 360000 pulse/hour = 36000watt max readingNow my measurements is the same as the electricity company readings :-).

Edit needed.. change your text where you called the phototransistor a photoresistor? This sensor counts LED pulses from your house meter and converts it into Watts and accumulated KWh.

When a user logs into the app, he/she sees empty list, and an "Add a device" button, on clicking which he could enter the device ID (which I would print on the device itself), and that device would be added to his/her devices list.

Set the PULSE_FACTOR in the example sketch to pulses/KWh rating on your meter.

My meter was showing 11mA at 4.5V which was way too high for battery powering.

No way.

Share it with us! Now that we know the base platform I'd develop my power meters on, let's officially define our project: An IoT power meter using ESP8266 and ACS712 current sensor that would send current and power readings to the app where I'd push those readings to a graph in real-time.

the power meter from the. But despite of very simple construction, these sensors are quite expensive (~50EUR).

This is how I got them from the Grandeur Dashboard: To test my power meter, I used Grandeur CLI to locally serve my web app on localhost:3000.

In every loop, it runs the sendUpdate function which reads current sensor's OUT pin (connected to ESP's A0) for one second, translates from ADC levels to voltage, gets upper and lower voltage peaks from that one second data, calculates peak-to-peak voltage, then RMS voltage, translates it to RMS current, and then finally calculates power. power, and the time of the update, and updates the old summary on the Cloud with the new one. Battery wont work as deep sleep wont be effective since the ESP8266 need to count the LED pulse and send out data with Wifi but Im not sure. Bend the phototransistor pointing down to the LED. Well done. I suggest to use only safe things otherwise youll have potential electrical saftey issues when making your home smart.

// Max watt value to report.

id (Optional, ID): Manually specify the ID used for code generation. Hello, very interesting post. It is important to drill a hole at the exact position of the LED. so it is perfectly optimized for low power consumption.

But i have problems which photo resistor to use?

Created by Henrik Ekblad <, // The digital input you attached your light sensor.

on a detected rising edge/falling edge.

// Minimum time between send (in milliseconds).

With the comparator, I used a 300K resistor.

On logging in, I see my PM-1 power meter that I registered earlier from the Cloud Dashboard. In my meter, the pulse length was contant (38 ms as far as I could see).

Thanks for your reply, I'm glad it worked out this way.

I have a 'smart meter' ISKRA Type MT372, however it has no easy possiblility to export the data. There needs to be a mechanism that shows a user only his/her devices when he/she opens the web app.

If you plan to use a TSL250R instead of an LM393, refer to the data sheet below for the pin connections.

Defaults to 60s. There needs to be a mechanism that shows a user only his/her devices when he/she opens the web app.

pin (Required, Pin): The pin to count pulses on. It's an important difference.

Based on this Youtube video I choose a phototransistor.

The program is published on my Github: https://github.com/Wim3d/Main_power_meter.

At the end I found out that setting following board was enough: I quickly put together some code and tested the power consumption.

Thanks for the tip. This filters outliers.

falling_edge (Optional): What to do when a falling edge is One of DISABLE, INCREMENT and DECREMENT. Let's see how I integrated Grandeur and built the app. Flashing has worked very well and i see it in my hass.io (latest version).

It might be of help to you.

So it's settled.

The second option also means you cant easily differentiate rising and falling edge so you get 2 pulses instead of one.

One for receiving and one for sending. The pulses are detected by an ESP8266. To use correct pin mapping with Arduino, I also had to set board to: Then I could develop some code but I stuck on configuring sleep mode and there is also very limited support for nrf51 in Arduino so I moved to Mbed. https://github.com/Wim3d/Main_power_meter, Arduino Robotic Arm Controlled by Touch Interface, https://www.mysensors.org/build/pulse_power, https://forum.creationx.de/forum/index.php?thread/1095-d0-z%C3%A4hler-sml-auslesen-mit-tasmota/. Some basic hookup info Here and I think you would use a Binary Sensor component to read the blinks.

To get the data in, I connected USB bluetooth adapter with added antenna and wrote a simple data relay script in python: When everything was working on a bench, I measured the dimensions and created a box derived from the original sensor clip.

Device auth token helps in validating the device's authenticity.

Their SDKs and examples are present on Github and each SDK has its own details documentation. There are a few parameters that need to be tuned for each power meter's pulses/KWh (usually says XXX imp/KWh somewhere on your meter).

The pulse counter sensor allows you to count the number of pulses and the frequency of a signal

// No pulse count value received from controller.

detected.

4 years ago.

Here's how I did this from. Locate the little LED on your meeter and mount the light sensor over it to register the power-consumption rate blinks.

My ESP cannot connect to Grandeur without this token.

For example, if youre using the pulse counter with a photodiode to and created a new project for my IoT product: I created a model for my new IoT product aka. The software then configures BLE advertisement which contains JSON with current counter value and measured battery voltage. But the Arduino SDK requires my project's API Key and my device's ID to know which device in which project are we referring to when setting summary.

I have done a bit of research on this.

So here it is: To explain the data: March was cold so the heating was almost still on; on 25th I left home and turned the heating off; on 31th my server crashed; on 5th I returned home so the value is sum for previous days without data, April was warm so I didnt use central heating at all, I only used hot water and on 13th the server crashed again (without me noticing). Learn how your comment data is processed.

You can inspect power consumption on following graphs. It sends the output data to my MQTT broker. I can help you with a code for that.

, I implemented the login functionality in my app which let me build up a user's profile and show him the data of only those devices that he paired with.

It is not clear for me, at the end, have used the expansion board in the box? The gas meter is directly in the hallway so everyone can see it.

I have a similar power meter and the right one is sending a full "SML-Datagram" with consumption, voltage, current, and may more.

Hello, Just deep sleep, wait for interrupt from reed switch, shout new value, sleep again. Defaults to INCREMENT. In this mode the sensor will sleep most of the time and only report KWh. That's when Grandeur came to the rescue.

Is the source code available?

The output is shown at the oscillope screen. Tune the sensitivity/trigger level by adjusting the trim potentiometer on the sensor board. 2 years ago. This was the hardest part of the whole project. Here's code to measure the current from the current sensor: Making a PCB out of it, here is a glimpse of the design: The fritzing file of the design and schematic is attached in the end. Look at the upper right area and you find a round metal plate with two holes in the middle.

But I found their. Defaults to 13us.

For S0 pulse meters that are used to meter power consumption 50-100 ms is a reasonable value. It then prepares a summary packet containing the RMS current as current.

detected.

Are you using LDR to detect the blinking LED of meter? I am thinking of the same (gas counter) to send data into domoticz.

And you can use a magent to mount a IR-LED. The data about gas consumption can be seen here: This view is OK for calculating consumption for some period but I want to see calculated daily consumption.

Bluetooth Low Energy (BLE, formerly Bluetooth Smart) is technology powering many smart devices (watches, beacons, fitness trackers, etc.) function which reads current sensor's OUT pin (connected to ESP's A0) for one second, translates from ADC levels to voltage, gets upper and lower voltage peaks from that one second data, calculates peak-to-peak voltage, then RMS voltage, translates it to RMS current, and then finally calculates power. Each customer would have to register his/her account on the web app when he/she buys a device from me for the very first time. Will my app contain all the power meters I ever sold till date? I soldered a button switch between RST and GND forn an easy reset and a slide switch between GPIO0 and GND to boot in in flash mode.

Pairing scheme solves our troubles here.

The power meter shows the current and power consumption graphs in the web app on my phone. As posted above, i have purchaesed this ESP32.

By adding a 2M Ohm resistor I could reach about 2V. 2018 29.

We don't want to spam the gateway. If you are reading these lines Im glad my post interested and maybe inspired you.

So I printed one for test and it fitted perfectly. I found out, that the USB-to-serial chip is powered from Vin so I tried to scrape it off: After this, the current dropped to 3mA but this was still too high. count_mode (Optional): Configure how the counter should behave

Or just #yolo and test.

You can check my project HERE - there are links to purchased components While controlling an appliance from phone is cool, it doesn't save you any money, right!

In this Instructable you find out how I read my Main Electricity Power use of my house and publish it via an ESP8266, Wifi, MQTT in my Openhab Home Automation.

A photoresistor is not fast enough to detect the short and weak pulses of red light.

Drill a small hole in the lid to see the LEDs blink (not on the photos). Since I have real users, there are some issues here.

Now let's move to the second issue. Esp32 untilgbar nie is much more comfortable with WLAN. (german: https://forum.creationx.de/forum/index.php?thread/1095-d0-z%C3%A4hler-sml-auslesen-mit-tasmota/) maybe you can simply use it with a transistor to read all data instead of counting flashes :-)Frank, Reply It is offered as a backend that solved pretty much all business, app, and hardware hassles involved in developing an IoT product (their words, not mine!). Now to implement this, I went through the most common tools out there including Blynk. For debugging purposes, I run on my notebook on first shell: To store the data I use Zabbix with MySQL.

(Only 2 and 3 generates interrupt!).

I use this ESP32 device: https://www.amazon.de/gp/product/B071P98VTG/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1

See this image: https://ae01.alicdn.com/kf/HTB1ZIbibL1H3KVjSZFHq6zKppXao/DDS518L-120-230.jpg.

The power meter shows the current and power consumption graphs in the web app on my phone.

The measuring device has to be small, look professional and have low power consumption so it can run on batteries. /*

But to use the JS SDK in my app, I needed my project's API key and access credentials (access key and token) from Grandeur Dashboard Settings page, which the JS SDK uses to make connection with my project on the Cloud.

When it came I did the measurement: 145.3uA is a decent result so I concentrated on consumption at count and transmit phase. .

Reply Have a look at the tasmota firmware. number of pulses measured. To fit 70 pulses in a second, your meter will have shorter pulses than 38 ms. Maybe the pulselength changes at different frequencies.

Counting switch presses is easy, going into sleep was new to me but I managed to make it work. solves our troubles here.

Okay then.

If there is a pulse (light), the output from the phototransistor circuit is higher (ca. I connected the output from reed switch to a data pin and wrote a simple application. When a user logs into the app, he/she sees empty list, and an "Add a device" button, on clicking which he could enter the device ID (which I would print on the device itself), and that device would be added to his/her devices list.

I checked the datasheet of onboard voltage regulator (AMS1117) and it needs 3mA solely for its operation so this board was out of game.

This.

To see his devices and their data, he/she would have to log in just like you do on facebook (you see your friends, your own posts, and your own groups, not everyone else's).

In the mean time I got a newer power meter, so I can not review this point. I found out, one can buy original sensor attachable to my type of gas meter. Here's how I paired them together: To build up program for ESP8266 on Arduino IDE, I used.

I dont have the knowledge to help you here.

Grandeur is designed to be straight forward and have a seamless yet powerful integration in your IoT products. I used ESP8266 and at that time EasyESP but I already converted it to ESPHome.

document.getElementById( "ak_js_1" ).setAttribute( "value", ( new Date() ).getTime() ); This site uses Akismet to reduce spam.

Added one of the pins to GPIO12, the other one to 3.3V ping of the ESP32.

So in this tutorial, I'll show you how I built my IoT power meter that monitors current and power of appliances similar to the cooler. this value can not be higher than 13us, for the ESP8266 you can use larger intervals too.

Sitemap 27

power meter pulse counter esp8266