Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
RedguyR

Redguy

@Redguy
About
Posts
29
Topics
14
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • MODBUS master sensor node
    RedguyR Redguy

    Hi Gohan..

    I hooked up my schneider PM9C power monitoring device through modbus to a mysensors node..

    Should be doable once you get the initial bus connection running..

    Although the familiar RS485 modules on aliexpress etc seem to function just fine when talking to each other, i noticed that it is a pain in the <censored> to get them to talk to a proper device. Especially the direction control screws everything up most of the time..

    things cleared up as soon as i started using a RS232 <-> RS485 converter with auto direction control.. Communicating with a single device is one thing, talking to a bus system connecting multiple devices is a whole different ballgame where propper bus termination etc. becomes important.

    Biggest problem is that you have to get the hardware for the connection right AND figure out the use of the lib etc.. The other part is having to figure out how your modbus devices present their data..

    Search for a good manual for your devices, specifying the various registers to read and write to, including their format etc. It's not that hard, but most devices wont respond at al unlessyou format things exactly right.

    So my advice is to split the steps to make sure each part functions on its own before trying to talk end to end.

    Use a program like modbuspoll or something and see if you can get the communication going using simple queries to a single HVAC unit using a simple usb converter (i used a little moxa converter). If that works, expand to talking to multiple on the full bus.

    Try reading single registers and setting simple things.

    if that all works well with the manual queries from modbuspoll or other software, transition to using your mysensors node and libs..

    Can you provide some more information about the device types you are using ?

    I

    Hardware

  • Schneider Electric WISERJLPM200
    RedguyR Redguy

    I implemented this with a schneider PM9C using modbus which works fine

    Zigbee is just transport, shouldnt be to hard to translate.. You need the manual to see what data it provides, which i couldnt find online. The model you specified has been of the market for some years.

    My Project

  • Serial gateway using Arduino Mega, how to set what serial to use ?
    RedguyR Redguy

    Tried ir, but no change.. Serial0 was still used while serial1was defined

    Hardware

  • #define MY_RS485_HWSERIAL Serial2 doesnt work, softserial still used
    RedguyR Redguy

    I amusing an Arduino mega as serial <-> RS485 gateway node..

    I first tested using the default softserial solutionfrom the examples,and this works fine..

    Then i added :
    #define MY_RS485_HWSERIAL Serial2

    So i could use serial2 as hardware serial for RS485. Which did not work. There was no activity on the tx of serial 2at all.

    After some switching between hard and softserial during testing it worked all of a sudden.. I thought.. Turned out i left the max485 to the softserial pins.

    So even when the hwserial is defined, the softserial is still used!?!?

    Is this something anybody else noticed as well?

    Bug Reports

  • rs485 on nano
    RedguyR Redguy

    Also keepin mind that those cheap rs485 adapters have a 120ohm load resistor and pull up and pulldown resistors installed for the rs485 bus..

    Those should only ve installed on the ends of the data bus.. So remove them from the rest of the adapters if you use more than 2.

    General Discussion

  • rs485 on nano
    RedguyR Redguy

    No, connecting ground is not mandatory.. In fact, i would not recommend it at all, especialy not on longer bus lengts.. Just use A&B

    If you have shielded cables.. Connect the shielding to gnd on 1 side only and leave the other side unconnected..

    This will provide shielding but prevent ground loop issues.

    General Discussion

  • Serial gateway using Arduino Mega, how to set what serial to use ?
    RedguyR Redguy

    Ah that My_Serialdevice setting is something i completely missed..will test that this weekend..

    i am fine with the debug going to the usb port.. it's just that i can leave the usb to my pc for programming and debugging while another serial is connected to the raspberry pi running domoticz for the mysensors gateway part.

    Hardware

  • 💬 2 channel in wall dimmer
    RedguyR Redguy

    Looks great !

    Have you measured what the minimum load is for the dimmer to function correctly ? I currently use X10 in wall modules but run in to trouble when switching to LED lights. The load is too small.

    OpenHardware.io mysensors dimmer 2 channel

  • Requesting a garage door sensor type.
    RedguyR Redguy

    Old topic but still..

    A variable to specify the position of a door would be handy in my opinion. The V_TRIPPED variable of a door sensor just states Closed or Not Closed. But for bigger and mechanical doors like garage doors there is quite a big step between fully open and closed..

    Feature Requests

  • Add variable for door position to S_DOOR
    RedguyR Redguy

    The current S_DOOR sensor type for door/windows sensors only has variables to indicate is the door sensor is tripped and to see if it is armed or not.

    Please add a variable to indicate the door position (aka, how far a garage door is opened in % of distance)
    The V_LEVEL and V_DISTANCE variables are already defined.

    Feature Requests

  • Add V_PRESSURE variable for Pressure to S_WATER type.
    RedguyR Redguy

    The S_WATER sensor type only defines V_FLOW and V_VOLUME to measure water usage.

    Please add the existing V_PRESSURE variable (only used for S_BARO) so water pressure measurements are included for the S_WATER type.

    Feature Requests

  • Add variables for voltage, current, frequency, power factor sector and support for 3-phase systems to S-POWER Type
    RedguyR Redguy

    I an currently implementing a My Sensors imlementation that reads measurements from a Schneider PM9C Energy monitoring device through Modbus and feeds those measurements into the MySensors network.. This is quite a nice device to use but a lot of measurement have not been implemented in the sensor types provided in the MySensors library.

    The S-POWER type (type 13), meant to be used for this kind of devices only supports the V_WATT, V_KWH, V_VAR, V_VA, V_POWER_FACTOR variables. I can add the measured Voltages and Currents by using the S_MULTIMETER type, but still. I think many power meters out there support a lot more then just the pure power readings.

    The PM9C for instance provides me with :

    • Current measurements for each Phase and the Neutral line
    • Voltage measurement between the 3 Phases and for each Phase against Neutral
    • Frequency
    • Total and per Phase Active power
    • Total and per Phase Reactive power
    • Total Apparent power
    • Power factor
    • Power factor sector
    • Power demand
    • Maximum power demand
    • Operating time counter
    • Active and Reactive total energy counter

    Sure i can use custom values for this, but it would mean defining 3 devices types for this one powermeter.

    I suggest adding the existing V_VOLTAGE, V_CURRENT variables to the S-POWERMETER type, and add new variable types for V_FREQUENCY, V_POWER_FACTOR_SECTOR, V_POWER_DEMAND

    Feature Requests

  • Error : request for member 'set' in 'Phase1_Voltage', which is of non-class type 'float'
    RedguyR Redguy

    Thanks Yveaux,

    This led to a whole new range over errors : call of overloaded 'set(float)' is ambiguous

    I resolved the issue by changing the send command from :

     send(Phase1_Current.set(m_Phase1_Current));
    

    to

      send(Phase2_Current.set((float)m_Phase2_Current,1));
    

    Which is working fine now.

    Troubleshooting

  • Error : request for member 'set' in 'Phase1_Voltage', which is of non-class type 'float'
    RedguyR Redguy

    I am building a MySensors serial <->RS485 node, which also has to read out a modbus enable energy monitoring device (Schneider PM9C).
    The modbus part is working great, so now i am trying to send the measured values as MySensors data so i can pick them up with Domoticz.

    My code at the moment :

    #define MY_GATEWAY_SERIAL               // Enable serial gateway mode
    #define MY_RS485                         // Enable RS485 transport layer
    #define MY_RS485_HWSERIAL Serial2       // Set serial interface to use for RS-485
    #define MY_RS485_BAUD_RATE 9600         // Set RS485 baud rate to use
    #define MY_RS485_DE_PIN 2               // Define this to enables DE-pin management on defined pin
    
    #include <MySensors.h>
    #include <ModbusMaster.h>
    
    #define CHILD_ID_Phase1_Current         11
    #define CHILD_ID_Phase2_Current         12
    #define CHILD_ID_Phase3_Current         13
    #define CHILD_ID_Neutral_Current        14
    #define CHILD_ID_Phase12_Voltage        21
    #define CHILD_ID_Phase23_Voltage        22
    #define CHILD_ID_Phase31_Voltage        23
    #define CHILD_ID_Phase1_Voltage         24
    #define CHILD_ID_Phase2_Voltage         25
    #define CHILD_ID_Phase3_Voltage         26
    #define CHILD_ID_Frequency              30
    #define CHILD_ID_Total_Active_Power     41
    #define CHILD_ID_Total_Reactive_Power   42
    #define CHILD_ID_Total_Apparant_Power   43
    #define CHILD_ID_Total_Power_Factor     44
    #define CHILD_ID_Power_Factor_Sector    45
    #define CHILD_ID_Power_Demand           50
    #define CHILD_ID_Max_Power_Demand       51
    #define CHILD_ID_Phase1_Active_Power    60
    #define CHILD_ID_Phase1_Reactive_Power  61
    #define CHILD_ID_Phase2_Active_Power    62
    #define CHILD_ID_Phase2_Reactive_Power  63
    #define CHILD_ID_Phase3_Active_Power    64
    #define CHILD_ID_Phase3_Reactive_Power  65
    
    ModbusMaster node;                         // Initiate ModbusMaster object
    
    MyMessage Phase1_Current        (CHILD_ID_Phase1_Current,V_CURRENT);
    MyMessage Phase2_Current        (CHILD_ID_Phase2_Current, V_CURRENT);
    MyMessage Phase3_Current        (CHILD_ID_Phase3_Current, V_CURRENT);
    MyMessage Neutral_Current       (CHILD_ID_Neutral_Current, V_CURRENT);
    MyMessage Phase12_Voltage       (CHILD_ID_Phase12_Voltage, V_VOLTAGE);
    MyMessage Phase23_Voltage       (CHILD_ID_Phase23_Voltage, V_VOLTAGE);
    MyMessage Phase31_Voltage       (CHILD_ID_Phase31_Voltage, V_VOLTAGE);
    MyMessage Phase1_Voltage        (CHILD_ID_Phase1_Voltage, V_VOLTAGE);
    MyMessage Phase2_Voltage        (CHILD_ID_Phase2_Voltage, V_VOLTAGE);
    MyMessage Phase3_Voltage        (CHILD_ID_Phase3_Voltage, V_VOLTAGE);
    MyMessage Total_Active_Power    (CHILD_ID_Total_Active_Power, V_WATT);
    MyMessage Total_Reactive_Power  (CHILD_ID_Total_Reactive_Power, V_VAR);
    MyMessage Total_Apparant_Power  (CHILD_ID_Total_Apparant_Power, V_VA);
    MyMessage Total_Power_Factor    (CHILD_ID_Total_Power_Factor, V_POWER_FACTOR);
    MyMessage Phase1_Active_Power   (CHILD_ID_Phase1_Reactive_Power, V_WATT);
    MyMessage Phase1_Reactive_Power (CHILD_ID_Phase1_Reactive_Power, V_VAR);
    MyMessage Phase2_Active_Power   (CHILD_ID_Phase1_Reactive_Power, V_WATT);
    MyMessage Phase2_Reactive_Power (CHILD_ID_Phase1_Reactive_Power, V_VAR);
    MyMessage Phase3_Active_Power   (CHILD_ID_Phase1_Reactive_Power, V_WATT);
    MyMessage Phase3_Reactive_Power (CHILD_ID_Phase1_Reactive_Power, V_VAR);
    
    // Functions to restore measured values after modbus tranfer (The PM9C sends it's 32-bit signed and unsigned measurements as 2 16-bit words, the divider is to scale to the corrent unit)
    
    float UnsignedValue (int reg, int divider) {
      unsigned long msb = node.getResponseBuffer(reg);
      msb = msb << 16;
      unsigned int  lsb = node.getResponseBuffer(reg + 1);
      unsigned long total = msb | lsb;
      float result = float (total) / divider;
      return result;
    }
    
    float SignedValue (int reg, int divider) {
      signed long msb = node.getResponseBuffer(reg);
      msb = msb << 16;
      unsigned int  lsb = node.getResponseBuffer(reg + 1);
      signed long total = msb | lsb;
      float result = float (total) / divider;
      return result;
    }
    
    
    void setup()
    {
      Serial3.begin (19200, SERIAL_8N1);       // Use Serial 3 for Modbus RTU @ 19200 8N1 using Moxa RS232<->RS485 converter (Auto direction control)
      node.begin(1, Serial3);                  // Communicate with Modbus slave ID 1
    }
    
    
    void presentation()
    {
      sendSketchInfo("RS485 gateway with Modbus", "0.1");
    
      present(CHILD_ID_Phase1_Current, S_MULTIMETER);
      present(CHILD_ID_Phase2_Current, S_MULTIMETER);
      present(CHILD_ID_Phase3_Current, S_MULTIMETER);
      present(CHILD_ID_Neutral_Current, S_MULTIMETER);
      present(CHILD_ID_Phase12_Voltage, S_MULTIMETER);
      present(CHILD_ID_Phase23_Voltage, S_MULTIMETER);
      present(CHILD_ID_Phase31_Voltage, S_MULTIMETER);
      present(CHILD_ID_Phase1_Voltage, S_MULTIMETER);
      present(CHILD_ID_Phase2_Voltage, S_MULTIMETER);
      present(CHILD_ID_Phase3_Voltage, S_MULTIMETER);
      present(CHILD_ID_Total_Active_Power, S_POWER);
      present(CHILD_ID_Total_Reactive_Power, S_POWER);
      present(CHILD_ID_Total_Apparant_Power, S_POWER);
      present(CHILD_ID_Total_Power_Factor, S_POWER);
      present(CHILD_ID_Phase1_Active_Power, S_POWER);
      present(CHILD_ID_Phase1_Reactive_Power, S_POWER);
      present(CHILD_ID_Phase2_Active_Power, S_POWER);
      present(CHILD_ID_Phase2_Reactive_Power, S_POWER);
      present(CHILD_ID_Phase3_Active_Power, S_POWER);
      present(CHILD_ID_Phase3_Reactive_Power, S_POWER);
    }
    
    void loop()
    {
        node.readHoldingRegisters(0x3E8, 56);
    
        float Phase1_Current        = UnsignedValue (0, 1000);
        float Phase2_Current        = UnsignedValue (2, 1000);
        float Phase3_Current        = UnsignedValue (4, 1000);
        float Neutral_Current       = UnsignedValue (6, 1000);
        float Phase12_Voltage       = UnsignedValue (8, 1000);
        float Phase23_Voltage       = UnsignedValue (10, 1000);
        float Phase31_Voltage       = UnsignedValue (12, 1000);
        float Phase1_Voltage        = UnsignedValue (14, 1000);
        float Phase2_Voltage        = UnsignedValue (16, 1000);
        float Phase3_Voltage        = UnsignedValue (18, 1000);
        float Total_Active_Power    = UnsignedValue (22, 100);
        float Total_Reactive_Power  =   SignedValue (24, 100);
        float Total_Apparant_Power  = UnsignedValue (26, 100);
        float Total_Power_Factor    =   SignedValue (28, 100);
        float Phase1_Active_Power   =   SignedValue (44, 100);
        float Phase2_Active_Power   =   SignedValue (46, 100);
        float Phase3_Active_Power   =   SignedValue (48, 100);
        float Phase1_Reactive_Power =   SignedValue (50, 100);
        float Phase2_Reactive_Power =   SignedValue (52, 100);
        float Phase3_Reactive_Power =   SignedValue (54, 100);
      
        send(Phase1_Current.set(Phase1_Current));
        send(Phase2_Current.set(Phase1_Current));
        send(Phase3_Current.set(Phase1_Current));
        send(Neutral_Current.set(Phase1_Current));
        send(Phase1_Voltage.set(Phase1_Voltage));
        send(Phase2_Voltage.set(Phase1_Voltage));
        send(Phase3_Voltage.set(Phase1_Voltage));
        send(Total_Active_Power.set(Total_Active_Power));
    }
    
    

    I am only trying to send out a small subset of the available data, and i have not set up things like timing etc for the measurements yet, but i am stuck at the "send" part. The values created by the PM9C come in through modbus as 2 16-bit words. These are combined into 32-bit signed or unsigned longs which give the measured values, then converted to a float to be divided by a scaling factor to correct the measurements unit. The currents are given in mA, voltages in mV etc. These are brought back to A, V, kW etc.

    So my measurements are all float values. (some signed, most of them unsigned)

    Since the S_POWER type does not include voltage, currents etc, i have divided my data over both S_POWER and S_MULTIMETER types.
    But this won't fly.. If i compile the code to check for errors, it produces numerous issues :

    Arduino: 1.8.0 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
    
    Gateway-RS485andModBus.ino: In function 'void loop()':
    
    Gateway-RS485andModBus:157: error: request for member 'set' in 'Phase1_Current', which is of non-class type 'float'
       send(Phase1_Current.set(Phase1_Current));
                           ^
    
    Gateway-RS485andModBus:158: error: request for member 'set' in 'Phase2_Current', which is of non-class type 'float'
       send(Phase2_Current.set(Phase1_Current));
                           ^
    
    Gateway-RS485andModBus:159: error: request for member 'set' in 'Phase3_Current', which is of non-class type 'float'
       send(Phase3_Current.set(Phase1_Current));
                           ^
    
    Gateway-RS485andModBus:160: error: request for member 'set' in 'Neutral_Current', which is of non-class type 'float'
       send(Neutral_Current.set(Phase1_Current));
                            ^
    
    Gateway-RS485andModBus:161: error: request for member 'set' in 'Phase12_Voltage', which is of non-class type 'float'
       send(Phase12_Voltage.set(Phase12_Voltage));
                            ^
    
    Gateway-RS485andModBus:162: error: request for member 'set' in 'Phase23_Voltage', which is of non-class type 'float'
       send(Phase23_Voltage.set(Phase23_Voltage));
                            ^
    
    Gateway-RS485andModBus:163: error: request for member 'set' in 'Phase31_Voltage', which is of non-class type 'float'
       send(Phase31_Voltage.set(Phase31_Voltage));
                            ^
    
    Gateway-RS485andModBus:164: error: request for member 'set' in 'Phase1_Voltage', which is of non-class type 'float'
       send(Phase1_Voltage.set(Phase1_Voltage));
                           ^
    
    Gateway-RS485andModBus:165: error: request for member 'set' in 'Phase2_Voltage', which is of non-class type 'float'
       send(Phase2_Voltage.set(Phase1_Voltage));
                           ^
    
    Gateway-RS485andModBus:166: error: request for member 'set' in 'Phase3_Voltage', which is of non-class type 'float'
       send(Phase3_Voltage.set(Phase1_Voltage));
                           ^
    
    Gateway-RS485andModBus:167: error: request for member 'set' in 'Total_Active_Power', which is of non-class type 'float'
       send(Total_Active_Power.set(Total_Active_Power));
                               ^
    

    What am i doing wrong here ? Is the mysensors lib unable to handle floats as data ? did i forget something ? made a major f<censored>up ?

    Troubleshooting

  • OTA Programming over wire ? :-) (RS-485)
    RedguyR Redguy

    Just started with MySensors and am reading up while playing about.. The OTA programming feature looks great ! But, most of my nodes will be connected over an RS485 bus since that is already in place.

    Can you use the OTA feature while using RS485 between gateway en nodes ?

    Development

  • Multiple gateways : Node ID unique per gateway or overall ?
    RedguyR Redguy

    Thanks guys !

    Since i am using Domoticz, i'll stick to unique ID's overall.. That would mean that you cannot use the "auto" setting for ID's if you are using multiple mysensors gateways with Domoticz at all..

    General Discussion

  • Vibration measurement sensor for mysensors node
    RedguyR Redguy

    Thanx guys !

    I ordered a ADXL345 digital three-axis acceleration of gravity tilt module on ali to see what this will do with such small measurements.

    stumbled upon this via one of Wallyllama's links :

    https://tc1seismometer.wordpress.com/2012/06/18/tc1-vertical-seismometer-plans/

    Seems easy enough to have some fun with as well.

    Hardware

  • Multiple gateways : Node ID unique per gateway or overall ?
    RedguyR Redguy

    I am building a mysensors setup in which I plan to use multiple gateways (1 for RF, 1 for RS485)..

    How doe Mysensors handle node ID's ? Should these by unique per gateway or overall ?

    My guess would be per gateway since these are pretty much stand alone on the my sensors level, but wont this cause issues to the controller software running above it ? (I am using Domoticz)

    General Discussion

  • Vibration measurement sensor for mysensors node
    RedguyR Redguy

    I am looking for a way to monitor shocks and vibrations using a mysensors node.

    There are plenty of vibration sensors et, but they just signal that a certain threshhold was reached or not.

    what i want to do is monitor shocks and trembling throughout my apartment building caused by either external causes (passing train, earth shocks) or through the building itself (weather, other tenants, the elevators, thermal expansion of the concrete)

    but i am not sure what type of sensor i should use.. any thoughts ?

    Hardware

  • Multiple gateways on RPI3
    RedguyR Redguy

    So first i pull the mysensors code from github to my raspberry pi.

    For running a mysensors gateway node on my raspberry pi using RS485 for transport i would then set it up with :+1:
    ./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSBMySGW1 --my-transport=rs485 --my-rs485-serial-port=/dev/ttySC0 --my-rs485-baudrate=19200 --my-rs485-de-pin=23

    Then make and make install that gateway and voila..

    I can do the same for an RF based gateway running on the raspberry pi itself using a directly connected NRF module, which would recreate the mysensors files and install those. Which means i have either the RS485 or the RF gateway. Not both at the same time.

    My point is, how to set this up properly so i can compile 2 mysensors gateway instances on the same raspberry pi and run them at the same time. 1 for RF and one using RS485 ???

    Hardware
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular