Skip to content

trychlos/mysPowerS0

Repository files navigation

 mysPowerS0 - README

 Summary
 =======
 
   Description
   Interrupts
   Computation notice
   Configuration
   Hardware
   References

-----------------------------------------------------------------------
 Description
 ===========

 mysPowerS0 is a MySensors v2.x module, built on an Arduino Nano.

 It may connect up to four Pulse S0 meter modules, and transmit energy
 (Wh) and power (VA) to the controller.

 The controller transmission uses NRF24L01 radio-module.

 Each Pulse S0 module use three pins:
 - the data input pin;
 - an enabled pin, which has to be shortened to GND if the module is not
   present;
 - a LED pin which is on when the module is enabled.

 Due to the count of pins each Pulse S0 module uses, the mysPowerS0 can
 manage up to four Pulse S0 meter modules.

-----------------------------------------------------------------------
 Interrupts
 ==========

 The Arduino Nano only has two hardware interrupts, which we are leaving
 free here.

 The NRF24L01 radio-module makes full use of Port B (PCINT0).

 We choose to only use the Port C (PCINT1) for our Pulse S0 modules, and
 manage it through software interrupts.

 Pulse counter is triggered on descending IRQ.
 
 As of v3.0-2025, it appears that interrupts have some inherent drawbacks,
 one of them being that millis() function is stopped during interrupt
 routines, as it itself relies on interrupts.
 
-----------------------------------------------------------------------
 Computation notice
 ==================
 
 The used DRS-155D module is specified as:
 
 - max 50A
 - 1000 imp per kWh (or also 1 imp per Wh)
 - 90ms per imp
 
 Which means that:
 
 - max measured power is 50 x 220 = 11000 W
 - 11000 W generate 11 x 1000 imp per hour
 - so the max impulsions frequency to be managed is 11000 / 3600 = 3.056 impulsions per second
	so the minimum impulsions period is 327.3 ms, much greater than the 90ms wide of each impulsion.

 Counting one impulsion each 327.3ms is very easy with a Nano, and doesn't require any interrupt management.
 
 What about the resolution, or the minimal measurable power ?
 
 Say we have a 50W load. This will consume 50 Wh in one hour, and so we will have to count 50 impulsions per hour,
 which means that we will receive one impulsion every 72 sec.
 
 So each impulsion is counted, and provide an energy increment.

-----------------------------------------------------------------------
 Configuration
 =============

 As of v1.2, Pulse S0 meter modules default to be configured as:
 - 1000 impulsions per kWh
 - 90 ms impulsion
 - noname.

 These parameters can be configured as follow:

 - C_SET on VA or WH child_id:
   payload = '1=<value>' count of impulsions per kW.h (default=1000)
   payload = '2=<value>' length of the impulsion (ms)
   payload = '3=<value>' model name (22 chars max)
   payload = '4=<impkwh>,<implen>,<name>'

 - C_REQ on VA or WH child_id:
   payload = '1' send count of impulsions per kWh (impkwh) as a string 'kwh=<value>'
   payload = '2' send the minimal length of the impulsion as a string 'l=<value>'
   payload = '3' send the preset model name as a string 'n=<value>'
   payload = '4' send all the previous three messages
   
 Global configuration can be:

 - C_SET on CHILD_ID_GLOBAL = 1:
   payload = '1'         reset the loop interval to its default value
   payload = '2=<value>' set the loop interval to the provided value (ms)

 - C_REQ on CHILD_ID_GLOBAL = 1:
   payload = '1' send the default loop interval
   payload = '2' send the current loop interval
   payload = '3' send the current count of enabled modules

-----------------------------------------------------------------------
 Hardware
 ========

 DRS155-D
 monophasé
 50 A
 1000 imp/kWh
 90 ms
 http://www.cartelectronic.fr/electricite/52-compteur-energie-retroeclaire.html
 25.00 € TTC port compris

-----------------------------------------------------------------------
 References
 ==========

 [kWh meter with S0 measurement](https://www.ztatz.nl/kwh-meter-met-s0-meting/)

 [Detection of S0 interface pulse](https://forum.arduino.cc/t/erkennung-s0-schnittstellen-impuls/344974)

 [S0 measurement value acquisition of electricity meters](https://blog.elektrowolle.de/2011/07/26/s0-messwerterfassung-von-stromzahlern/)
 
 [Arduino interrupts](https://gammon.com.au/interrupts)

-----------------------------------------------------------------------
 P. Wieser - Created on 2017, apr. 2nd
             Last updated on 2025, mar. 20th

About

An Arduino Nano-based MySensors v 2.1x node which get power use from S0 meters

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published