logo elektroda
logo elektroda
X
logo elektroda

Remote LED flash detector of the electricity meter

efi222 10098 63
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI):
  • Hello :) .
    I have been planning for quite a long time to build a device to indicate the current electricity consumption in the house. The problem was that there was no way to connect to the power supply in the meter box. Pulling additional cables meant devastating part of the building.
    So a wireless LED flashing transmitter for the electricity meter was created.
    I have made remote sensors for the weather station using a similar system.

    Transmitter:
    The processed LED flashes are sent by the ESP8266 chip using the ESP NOW protocol.
    The conventional counter number and power cell status are sent.
    In the idle state, the ESP is plunged into a deep sleep :) .
    Current consumption in this state is about 160uA (could be less).
    The photoresistor is incorporated into a comparator circuit on the LMV358, the output of which controls a transistor that provides a low state that resets the ESP circuit when the counter LED flashes. After waking up and sending data, the MCU falls into a deep sleep.
    The whole thing is powered by an 18650 cell.

    The transmitter software needs to be discussed. Anyone who has dealt with ESP NOW with a receiver connected to WiFi has encountered the problem of changing the channel on the transmitter. Connecting the ESP NOW receiver to a WiFi network, has the effect of changing the default 1 ESP channel to a WiFi channel.
    The transmitter does not know this and transmits on channel 1 (no communication).
    In this case, the transmitter has two automatic modes of operation.
    In scan mode, the transmitter in ESP NOW mode looks for a receiver with a specific MAC. It sends a query to it sequentially on each channel until a response is received. After a positive response, the channel number from which the response came is stored in the RTC memory. This memory is not erased on subsequent ESP restarts. Scanning the channels takes approximately 300ms.

    I have also made a small adjustment in case of interference during data transmission.
    Each time data is sent, the receiver sends back an acknowledgement to the transmitter that it has received it. The next scan takes place after two unconfirmed transmissions.

    Receiver:
    Example demo. ESP8266 connected to a WiFi network, generates a web page. An Ajax script refreshes the data on the page.
    The operation of the program is to convert to kW an incremented timer (1kHz) variable between successive received data (LED flashes) from the transmitter. This can be done in any other way. Also the calculation of kWh.

    Transmitter design:
    Wireless LED pulse transmitter with ESP8266 and 18650 battery .

    Short demonstration video:




    Diagram:
    Electrical schematic of a remote LED flash detector.

    ESP8266.
    Current consumption. Channel scan oscillogram.
    Here you can see 13 WiFi channels (about 300ms).
    Oscilloscope signal waveform depicting LED blink detection. .

    Oscillogram after LED flash detection:
    Total time from wake-up to sleep about 180ms.
    I am puzzled by this second pin....
    Oscilloscope showing LED blink signal from ESP8266 device.

    Transmitter and receiver sources attached. MCU software written in the Arduino IDE.

    Cool? Ranking DIY
    About Author
    efi222
    Level 20  
    Offline 
    efi222 wrote 545 posts with rating 970, helped 7 times. Live in city Toruń. Been with us since 2019 year.
  • ADVERTISEMENT
  • #2 21166633
    miroskop
    Level 23  
    I don't understand something though maybe it's the heat :) .
    If your reading is in kilowatt hours then why is this value dropping? Consumption can only increase. It is a different matter when it comes to power consumption but then the values are given in kilowatts.
  • ADVERTISEMENT
  • #3 21166656
    efi222
    Level 20  
    Your colleague is obviously right. I screwed up on the descriptions. What is meant is the current consumption, i.e. kW. :) .
  • #4 21166737
    kjoxa
    Level 21  
    A very interesting device. Congratulations!
    I too am building a station on ESP NOW that reads temperatures from several rooms. The transmitters are also in DeepSleep mode most of the time. For how much operating time do you estimate the 18650 is enough?
  • #5 21166759
    efi222
    Level 20  
    I have similar transmitters at the weather station on the ESP Now system. They transmit every minute. The transmit time is about 220 ms. They are powered by a 18650 3Ah battery. I put such a battery in one of them last December. The transmitter is still working... :) .
    Here it is difficult to predict the running time, because the meter LED wakes up the ESP at different intervals. The system has only been in operation for a week.
  • #6 21166767
    Sam Sung
    Level 33  
    Congratulations, I also wanted to do something similar ~16 years ago: https://www.elektroda.pl/rtvforum/topic1086071.html
    but col. @adamjur1 successfully discouraged me :D .
    So the photoresist is not too slow after all. And which one did you use?
    Is the one photo of the transmitter already after final assembly, with everything?
  • #7 21166779
    efi222
    Level 20  
    There might be a problem with the photoresist because I got them mixed up.... But I will check the light and dark resistance tomorrow and write to my colleague. The transmitter in the photo is the whole thing plus there is still the boom with the photoresistor to position it opposite the LED counter. If any additional photos are needed - I will send.

    Added after 11 [hours] 32 [minutes]: .

    I changed the photoresistor today to a GL5516 and the circuit works as expected.
    Generally there are no restrictions on this component. When changing to another one, you may need to change the resistor value in the divider.
    It should also not have a small resistance in the shading, as this will increase the current consumption of the circuit.
    The capacitor at the collector of the transistor has the polarity drawn reversed.
    Corrections in the program code:
    receiver.ino:
    line135 change "kWh" to "kW"
    line 99 change "kWh" to "kW"
    www_html.h:
    line 67 change "kWh" to "kW"
  • #8 21167099
    gulson
    System Administrator
    An arrangement that is even essential in these difficult times. We are talking about terrible energy increases. Immediately there will be incentives to move to hourly billing with different rates, where nightly can be x10 more expensive. It will be profitable to switch everything off after 6pm and go to bed so that no appliance is switched on.
    All the more reason why such solutions will be much needed.
    A parcel machine without any changes? :) .
  • #9 21167107
    ex-or
    Level 28  
    kjoxa wrote:
    For how long of an operating time do you estimate the 18650 will last?
    .
    Taking into account idling alone (160uA) - just over 2 years. Considering operation, assuming 220mA (intake quoted by the internets) for 180ms every hour - approx, 2 years, every 10 minutes - 1.5 years, every minute - 5 months, every 10s - 1 month.
  • #10 21167165
    efi222
    Level 20  
    gulson wrote:
    .
    Parcel post unchanged? :)

    yes :D ...

    ex-or thank you for the calculations. That 220mA is basically just when the modem is transmitting. In this case it's that highest short pin (a few ms) on the second oscillogram. I measured the current on a 6.8R series resistor. From the oscilllogam it comes out a lot less.
  • ADVERTISEMENT
  • #11 21167195
    ex-or
    Level 28  
    Well, yes, it comes out current lower by an order of magnitude. So with a pulse every 10 sec you can expect roughly about 9 months.
  • ADVERTISEMENT
  • #13 21167336
    efi222
    Level 20  
    In this case I was concerned with updating the readings quite quickly. You can see in the video that this is still quite slow after the power consumption drops. At 100W consumption, the meter LED flashes every 37 seconds. I also think the receiver may be predicting a drop in power consumption if it waits long enough for the next data. The code of the posted receiver is a basic demo to expand as you see fit.
  • #14 21167343
    sq3evp
    Level 37  
    I must be reading poorly - how do you access and read the measurements? A website or some kind of service?
    Interesting project - I also have an Apator meter and a flashing LED.
  • #15 21167352
    speedy9
    Helpful for users
    And have you thought about using Zigbee on the ESP32-C6? It could be even more economical in terms of power.
  • #16 21167358
    efi222
    Level 20  
    The receiver on the ESP generates a web page on the local network on a local IP. When the receiver is started, the IP address of the page is sent to the UART. You can also assign this address or another one permanently in the router settings for convenience.
  • #17 21167359
    speedy9
    Helpful for users
    efi222 wrote:
    The photoresistor is incorporated into a comparator circuit on the LMV358, the output of which controls a transistor that provides a low state that resets the ESP circuit when the counter LED flashes. After waking up and sending data, the MCU falls into a deep sleep.

    I understand correctly that the MCU is then awakened very frequently? For pulse counting I understand, but it probably doesn't need to send every pulse, it would be enough for it to do it every so often.
  • #18 21167364
    acctr
    Level 38  
    efi222 wrote:
    When 100W is consumed, the meter LED flashes every 37 seconds.
    .
    That is, the LED flashes for every Wh consumed.
    You connect 1kW, it will blink every 3.6 seconds.
    The question is, is there such a power when the diode is lit continuously? then when the blink time is longer than the pause time
    Helpful post? Buy me a coffee.
  • #19 21167371
    efi222
    Level 20  
    You could, of course, count a few flashes and send one every 5 minutes, for example. Only this misses the point of this circuit. It is all about the current power consumption.
  • #20 21167373
    sq3evp
    Level 37  
    The meter seems to have the number of flashes/kWh, not the time?
    The time is the resultant of the number of flashes depending on the power consumed.
  • #21 21167400
    efi222
    Level 20  
    acctr wrote:
    .
    The question is whether there is such a power when the LED is on continuously? then when the blink time is longer than the pause time
    .
    I find it difficult to say. At 10kW this LED flashes 2.5 times per second. I don't have such high intakes at home.

    Added after 1 [minute]:

    sq3evp wrote:
    The meter seems to have the number of flashes/kWh and not the time?
    The time is the resultant of the number of flashes depending on the power consumed.

    My meter generates 1000 flashes /1kWh
  • #22 21167405
    acctr
    Level 38  
    efi222 wrote:
    This is the current power consumption.

    The current power consumption is not shown by this detector, only the consecutive watt-hours taken.

    sq3evp wrote:
    Time is the resultant of the number of flashes depending on the power consumed.

    Without delving into STW/OTW, the time flows independently of the power taken by the meter.
    Helpful post? Buy me a coffee.
  • #23 21167431
    efi222
    Level 20  
    acctr wrote:
    .
    The current power consumption is not shown by this detector, only the consecutive watt-hours taken.

    That's right, because the measurement is taken at some time.
    But it gives some picture for a reasonably quick analysis of power consumption, or thereabouts of consecutive watt-hours.
  • #24 21167458
    sq3evp
    Level 37  
    acctr wrote:
    .
    Without delving into STW/OTW, the time flashes independently of the power taken by the meter.

    The time between flashes is dependent on the power consumed - that's what I meant, the meter uses the number of flashes/kWh rather than measuring time.
    I guess it's easier to count light impulses in units of time?
  • #25 21167472
    efi222
    Level 20  
    @acctr Can a colleague define the current power consumption?

    Added after 4 [minutes]:

    sq3evp wrote:
    .
    It's probably easier to count light impuses in a unit of time?
    .
    You can also measure the time between them.
  • #26 21167607
    Sam Sung
    Level 33  
    acctr wrote:
    efi222 wrote:
    This is about the current power consumption.

    This detector does not show the current power consumption, only the next acquired watt-hours.
    And the bicycle meter shows the current speed, or only the acquired kilometres? After all, it works on an identical principle - measuring the time between pulses.
    sq3evp wrote:
    It's probably easier to count light pulses in a unit of time?
    With a microcontroller it's equally easy/difficult, but time can be measured with microsecond accuracy, and there are few pulses, so it's much better to measure the time between pulses or multiples of them, exactly as a bike counter does.
    In principle, it should be possible to make a bicycle meter attachment (light to short circuit converter) and watch the power measurement on it :) .
  • #27 21167617
    efi222
    Level 20  
    Sam Sung wrote:
    .
    In principle, it should be possible to make an attachment for a bicycle meter (light to short circuit converter) and watch the power measurement on it :)
    .
    I look forward to the publication.... :D
  • #28 21167663
    sq3evp
    Level 37  
    efi222 wrote:
    The time between them can also be measured.

    You can, but I guess counting pulses is simpler?
    Simple digital circuits counted pulses in a straightforward way, add a measurement per unit time and you have the result.
    It is also possible to measure time, but this reminds me of the tasks where a programmer sits, thinks and the analyst shows him an error in reasoning and the finished solution emerges after 3 days instead of 30.
    Sometimes simple solutions are the best - a matter of implementation, but I think counters count the number of pulses in time. They do not measure the time between pulses - should they be processed and why such accuracy?
    A database holding timestamped entries or a simple file that counts pulses in a time unit? A minute, a quarter of an hour, an hour - it's a question of the granularity of the results, and I don't think such an accurate measurement is necessary in this case.
  • #29 21167709
    efi222
    Level 20  
    speedy9 wrote:
    Are you thinking of using Zigbee on the ESP32-C6? It could be even more economical in terms of power.
    .
    Hard to judge.
    In this project, it's more the peripherals that draw more current than the ESP8266 itself in DeepSleep. Even using an LMV321 instead of a dual LMV358 could save a few tens of uA.
    But this is just a guess.
  • #30 21167779
    khoam
    Level 42  
    efi222 wrote:
    Even using an LMV321 instead of a dual LMV358 could save tens of uA.
    .
    Or power the LMV358 with any of the ESP8266 pins. Then, during deep-sleep the LM will have its power supply cut off.
📢 Listen (AI):

Topic summary

A user has developed a wireless LED flash detector for monitoring electricity consumption using an ESP8266 chip and the ESP NOW protocol. The device captures LED flashes from the electricity meter, indicating current power consumption in kilowatts (kW). The system operates in deep sleep mode to minimize power usage, with a current draw of approximately 160uA. Discussions include the effectiveness of the photoresistor used, battery life estimates with a 18650 battery, and the potential for using alternative communication protocols like Zigbee. Participants also discuss the limitations of the device in measuring instantaneous power versus cumulative energy consumption, and the challenges of implementing wired solutions in existing setups.
Summary generated by the language model.
ADVERTISEMENT