Example: Home power-line load monitor based on LogicMachine Reactor

Task

How to make cost-effective power-line current monitor solution based on LogicMachine Reactor?

Connect current sensor with analog output to Reactor’s Analog input

We recommend Veris Industries H923 split-core current sensor which provides accurate load trending information with a proportional output signal. Or there are even more cost-effective 0-5V solution available from YHCD (~EUR 4/pcs).

Add Analog input object in Reactor tab of LogicMachine2

load_sensor_reactor

The measurement is automatically seen in Reactor tab as well as Objects tab

analog_input_measurement_reactor

object_load_sensor_reactor

Calculate the Amps of flow

As the analog input will show the value in Volts, you have to calculate real Amps of the load, also calculate average Amps per hour.
Click on the Event-based script icon on the respective Analog input channel line

eventbased_icon

 

Add the following code, which will update the object 1/1/3 once an hour with average load in Amps

Source code    
  1. amps = event.getvalue() * 3 -- max current device supports is 30A, Analog input is 0..10V, so 30A/10V = 3A = 1V
  2. avg = storage.get('avg', {}) -- array of variables
  3. table.insert(avg, amps)
  4.  
  5. if #avg == 60 then -- reading is done once in a minute so we have to record 60 readings to calculate average
  6. total = 0
  7. for _, value in ipairs(avg) do -- summarize all reading to calculate average
  8. total = total + value
  9. end
  10.  
  11. average = total / 60
  12. grp.update('1/1/3', average)
  13.  
  14. avg = {}
  15. end
  16.  
  17. storage.set('avg', avg)

The load measurement object 1/1/3 can be later used for example in Trends or kWh usage can be calculated through scripting