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
T

Toine33

@Toine33
About
Posts
10
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Question about RS485 and MY_DEBUG
    T Toine33

    Hey guys,

    I gues i have an simple question ,
    Is it normal that RS485 on Hardware Serial only works with MY_DEBUG enabled?

    If i exclude the MY_DEBUG, communication stops to the gateway

    Here an example sketch:

    #define MY_DEBUG
    #define MY_RS485
    #define MY_RS485_DE_PIN 2
    #define MY_RS485_BAUD_RATE 19200
    #define MY_RS485_HWSERIAL Serial
    #define MY_NODE_ID 5
    
    
    #include <MySensors.h>  
    #include <DallasTemperature.h>
    #include <OneWire.h>
    
    #define COMPARE_TEMP 0 // Send temperature only if changed? 1 = Yes 0 = No
    
    #define ONE_WIRE_BUS A1 // Pin where dallase sensor is connected 
    #define MAX_ATTACHED_DS18B20 2
    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
    OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
    DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. 
    float lastTemperature[MAX_ATTACHED_DS18B20];
    int numSensors=0;
    bool receivedConfig = false;
    bool metric = true;
    // Initialize temperature message
    MyMessage msga(0,V_TEMP);
    
    
    
    
    
    #define CHILD_ID_LIGHT 25
    #define LIGHT_SENSOR_ANALOG_PIN 0
    
    
    MyMessage msg(CHILD_ID_LIGHT, V_TEXT);
    int lastLightLevel;
    
    
    void before()
    {
      // Startup up the OneWire library
      sensors.begin();
    }
    
    
    void setup()  
    { 
      // requestTemperatures() will not block current thread
      sensors.setWaitForConversion(false);
    }
    
    
    
    void presentation()
    {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Node 5", "1.0");
    
        // Register all sensors to gateway (they will be created as child devices)
        present(CHILD_ID_LIGHT, S_BINARY);
    
    
      numSensors = sensors.getDeviceCount();
    
      // Present all sensors to controller
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
         present(i, S_TEMP);
      }
    
        
    }
    
    void loop()
    {
    
      sensors.requestTemperatures();
    
      // query conversion time and sleep until conversion completed
      int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
      // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
      wait(conversionTime);
    
      // Read temperatures and send them to controller 
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
    
        // Fetch and round temperature to one decimal
        float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
    
        // Only send data if temperature has changed and no error
        #if COMPARE_TEMP == 1
        if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) {
        #else
        if (temperature != -127.00 && temperature != 85.00) {
        #endif
    
    
        int16_t lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23;
            send(msg.set(lightLevel));
            
          // Send in the new temperature
          send(msga.setSensor(i).set(temperature,1));
          // Save new temperatures for next compare
          lastTemperature[i]=temperature;
        }
      }
      wait(SLEEP_TIME);
    }
    
    
    Troubleshooting

  • BH1750 Lux Sensor Problems
    T Toine33

    I guess i found it now,
    Looks like that V_LEVEL and V_LIGHT_LEVEL are both not behaving as expected,
    I have changed these now to V_TEXT after that the sensors was finaly working within domoticz.

    Also i had some cabeling issues, looks like the sensor doesnt like an cable length off 2 meter on 4x 0,44mm2 wire..
    Tommorow i am going to place the arduino closer to the weather station and i guess everything would be fine again then !

    Here my latest sketch:

    #define MY_DEBUG
    #define MY_RS485
    #define MY_RS485_DE_PIN 2
    #define MY_RS485_BAUD_RATE 19200
    #define MY_RS485_HWSERIAL Serial
    #define MY_NODE_ID 5
    
    
    #include <MySensors.h>  
    #include <BH1750.h>
    #include <Wire.h>
    
    #define CHILD_ID_LIGHT 25
    unsigned long SLEEP_TIME = 25000; // Sleep time between reads (in milliseconds)
    
    BH1750 lightSensor;
    
    // V_LIGHT_LEVEL should only be used for uncalibrated light level 0-100%.
    // If your controller supports the new V_LEVEL variable, use this instead for
    // transmitting LUX light level.
    // MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
    MyMessage msg(CHILD_ID_LIGHT, V_TEXT);  
    uint16_t lastlux;
    
    void setup()  
    { 
      lightSensor.begin();
    }
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Node 5", "1.0");
    
      // Register all sensors to gateway (they will be created as child devices)
      present(CHILD_ID_LIGHT, S_BINARY);
    }
    
    void loop()      
    {     
      uint16_t lux = lightSensor.readLightLevel();// Get Lux value
     // Serial.println(lux);
     // if (lux != lastlux) {
          send(msg.set(lux));
         // lastlux = lux;
     // }
    
      wait(SLEEP_TIME);
    }
    

    @Nca78
    Thanks for your help !

    Troubleshooting

  • BH1750 Lux Sensor Problems
    T Toine33

    @nca78

    I Realy have no clue at the moment, i have tried almost everything for what i can think of.
    Also removed the serial print but still no luck.
    For the rest of the node's i never had issues.

    I have tried different sensors / Different arduino's but as soon when i am activating the mysensors part it stops responding.

    Troubleshooting

  • BH1750 Lux Sensor Problems
    T Toine33

    @Nca78

    I have tried both and still no luck, the weird part is that it is working without the MySenors part.
    When i am adding Mysensors libary it stops working.
    The node can present itself succesfull on the gateway and also creates the child ID 25 (LUX Sensor).

    Troubleshooting

  • BH1750 Lux Sensor Problems
    T Toine33

    Hey Guys,

    I am trying for an while now but i cant make it work.
    The problem is that when i use this sketch i cant get usable data out of the BH1750

    #define MY_DEBUG
    #define MY_RS485
    #define MY_RS485_DE_PIN 2
    #define MY_RS485_BAUD_RATE 19200
    #define MY_RS485_HWSERIAL Serial
    #define MY_NODE_ID 5
    
    
    #include <SPI.h>
    #include <MySensors.h>
    #include <BH1750.h>
    #include <Wire.h>
    
    #define CHILD_ID_LIGHT 25
    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
    
    BH1750 lightSensor;
    
    // V_LIGHT_LEVEL should only be used for uncalibrated light level 0-100%.
    // If your controller supports the new V_LEVEL variable, use this instead for
    // transmitting LUX light level.
    MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
    // MyMessage msg(CHILD_ID_LIGHT, V_LEVEL);  
    uint16_t lastlux;
    
    void setup()  
    { 
      lightSensor.begin();
    }
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Node 5", "1.0");
    
      // Register all sensors to gateway (they will be created as child devices)
      present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
    }
    
    void loop()      
    {     
      uint16_t lux = lightSensor.readLightLevel();// Get Lux value
      Serial.println(lux);
      if (lux != lastlux) {
          send(msg.set(lux));
          lastlux = lux;
      }
    
      wait(SLEEP_TIME);
    }
    

    The output i am receiving is 65534 LUX and it never changes..

    The weird part is when i use this sketch without changing wiring i am receiving good changing data like 110 Lux etc etc

    #include <Wire.h>
    #include <BH1750.h>
    
    BH1750 lichtMeter;
    
    void setup(){
      Serial.begin(9600);
      lichtMeter.begin();
    }
     
     
    void loop() {
      uint16_t lux = lichtMeter.readLightLevel();
      Serial.print("Licht: ");
      Serial.print(lux);
      Serial.println(" lux");
      delay(500);
    }
    
    #include <Wire.h>
    #include <BH1750.h>
     
    BH1750 lichtMeter;
     
    void setup(){
      Serial.begin(9600);
      lichtMeter.begin();
    }
     
     
    void loop() {
      uint16_t lux = lichtMeter.readLightLevel();
      Serial.print("Licht: ");
      Serial.print(lux);
      Serial.println(" lux");
      delay(500);
    }
    

    Hardware:
    Arduino nano - Node - RS485

    Troubleshooting

  • P1 not working when using Mysensors ?
    T Toine33

    @mfalkvidd
    Thank you so much :D Finnaly it is working as it should do!

    #define MY_DEBUG 
    #define MY_RS485
    #define MY_RS485_DE_PIN 2
    #define MY_RS485_BAUD_RATE 19200
    #define MY_RS485_HWSERIAL Serial
    #define MY_NODE_ID 3
    
    #include <AltSoftSerial.h>
    #include <SPI.h>
    #include <MySensors.h>  
    
    AltSoftSerial altSerial;
    
    int msg[1];
    const uint64_t pipe = 0xE8E8F0F0E1LL;
    
    const int requestPin =  4;         
    char input; // incoming serial data (byte)
    bool readnextLine = false;
    #define BUFSIZE 500
    #define CHILD_ID_WATT 0
    #define CHILD_ID_KWH_LOW 1
    #define CHILD_ID_KWH_HIGH 2
    #define CHILD_ID_GAS 3
    #define CHILD_ID_CURRENT 4
    
    char buffer[BUFSIZE]; //Buffer for serial data to find \n .
    int bufpos = 0;
    long mEVLT = 0; //Meter reading Electrics - consumption low tariff
    long mEVHT = 0; //Meter reading Electrics - consumption high tariff
    long mEAV = 0;  //Meter reading Electrics - Actual consumption
    long mEAT = 0;  //Meter reading Electrics - Actual generated electricity (Solar panels)
    long mG = 0;   //Meter reading Gas
    
    
    MyMessage msgWatt(CHILD_ID_WATT, V_WATT);
    MyMessage msgKwhLow(CHILD_ID_KWH_LOW, V_KWH);      //Was V_KWH
    MyMessage msgKwhHigh(CHILD_ID_KWH_HIGH, V_KWH);     //Was V_KWH
    MyMessage msgGas(CHILD_ID_GAS, V_VOLUME);
    
    
    
    void setup() {
    //  Serial.begin(19200);
    //  delay(1000);
      
      altSerial.begin(9600);
      delay(1000);
    }
    
    
    void presentation() {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Node", "1.0");
      present(CHILD_ID_WATT, S_POWER);
      present(CHILD_ID_KWH_LOW, S_POWER);
      present(CHILD_ID_KWH_HIGH, S_POWER);
      present(CHILD_ID_GAS, S_GAS);
    }
    
    
    
    void loop() {
      long tl = 0;
      long tld =0;
      if (altSerial.available()) {
          char input = altSerial.read();
          buffer[bufpos] = input&127;
          bufpos++;
          if (input == '\n') { // We received a new line (data up to \n)
            // 1-0:1.8.2 = Electricity consumption high tariff (DSMR v4.0)
    
            
            if (sscanf(buffer,"1-0:1.8.2(%ld.%ld" , &tl, &tld) >0 ) {
              tl *= 1000;
              tl += tld;
              mEVHT = tl;
              //mEVHT = tl * 1000 + tld;
              if (mEVHT > 0) {
      
                //mEVHT = 0;
              }
            }
      
      
    
            if (sscanf(buffer,"1-0:1.8.1(%ld.%ld" ,&tl, &tld)==2){
              tl *= 1000;
              tl += tld;
              mEVLT = tl;
      
              if (mEVLT > 0) {
      
      
              }
            }
    
    
      
            // 1-0:1.7.0 = Electricity consumption actual usage (DSMR v4.0)
            if (sscanf(buffer,"1-0:1.7.0(%ld.%ld" ,&tl , &tld) == 2)
            { 
              mEAV = (tl*1000)+tld*10;            
              if (mEAV > 0) {
      
              }
            }
    
    
    
    
    //Gastand uitlezen
    
    if (sscanf(buffer,"(%ld.%ld" , &tl, &tld)==2 ) 
          {   mG = (tl*1000.0)+tld;
          mG = mG;
          }
    
    
    
    
      
            // Empty buffer again (whole array)
            for (int i=0; i<500; i++)
            { 
              buffer[i] = 0;
            }
            bufpos = 0;
      
          }
           
          if (input == '!') {   //uitroepteken geeft einde van telegram aan, dus we gaan data versturen
            #ifdef DEBUG
              printData();
            #endif
            send(msgWatt.set(mEAV));
            send(msgKwhLow.set(mEVLT / 1000.0, 3)); 
            send(msgKwhHigh.set(mEVHT / 1000.0, 3));
            send(msgGas.set(mG / 1000.0, 3));
            mEVHT=0;
            mEVLT = 0;
            mEAV = 0;
            mG = 0;
            //client.stop();
          } //Einde vraagteken detectie   
      
        } 
    
    }
    
    
     
    

    And here an picture how it is showing up in domoticz:

    0_1568053520513_cc789582-9497-47ae-a278-d906a1b3a0fd-image.png

    Troubleshooting

  • P1 not working when using Mysensors ?
    T Toine33

    @mfalkvidd
    Sorry for asking , but as you already noticed i am not super familiar to the arduino coding haha.

    So i have tried send(msgWatt.set(mEAV, 3));
    But the only output i am receiving is something like this,

    TSF:MSG:SEND,3-3-0-0,s=3,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:4213752.000

    What i would like to archieve is an value like
    TSF:MSG:SEND,3-3-0-0,s=3,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:4213.752

    I just would like to ad an decimal somehow and send this to Domoticz.

    Troubleshooting

  • P1 not working when using Mysensors ?
    T Toine33

    Hey guys,
    Thanks for helping :) . The sketch was working after i have deleted the Serial.begin in the void setup.

    void setup() {
    Serial.begin(19200);

    i only have some other issues at the moment haha,
    The value's from the gas meter / high an low elecktricity are showing wrong within Domoticz
    0_1567966720801_497ea466-8ee8-4bd4-be51-f4dc3f5c7099-image.png

    When i am doing /1000 on the send values of the GAS meter and elecktricity meters i am getting an beter value but i loose 3 decimals and cant see any calculated value by domoticz.
    Is there an option to send these decimals ?

    0_1567967331476_a16e0f3a-43fe-4ce7-9de6-46a76a1d0547-image.png

    #define MY_DEBUG 
    #define MY_RS485
    #define MY_RS485_DE_PIN 2
    #define MY_RS485_BAUD_RATE 19200
    #define MY_RS485_HWSERIAL Serial
    #define MY_NODE_ID 3
    
    #include <AltSoftSerial.h>
    #include <SPI.h>
    #include <MySensors.h>  
    
    AltSoftSerial altSerial;
    
    int msg[1];
    const uint64_t pipe = 0xE8E8F0F0E1LL;
    
    const int requestPin =  4;         
    char input; // incoming serial data (byte)
    bool readnextLine = false;
    #define BUFSIZE 500
    #define CHILD_ID_WATT 0
    #define CHILD_ID_KWH_LOW 1
    #define CHILD_ID_KWH_HIGH 2
    #define CHILD_ID_GAS 3
    #define CHILD_ID_CURRENT 4
    
    char buffer[BUFSIZE]; //Buffer for serial data to find \n .
    int bufpos = 0;
    long mEVLT = 0; //Meter reading Electrics - consumption low tariff
    long mEVHT = 0; //Meter reading Electrics - consumption high tariff
    long mEAV = 0;  //Meter reading Electrics - Actual consumption
    long mEAT = 0;  //Meter reading Electrics - Actual generated electricity (Solar panels)
    long mG = 0;   //Meter reading Gas
    
    MyMessage msgWatt(CHILD_ID_WATT, V_WATT);
    MyMessage msgKwhLow(CHILD_ID_KWH_LOW, V_KWH);      //Was V_KWH
    MyMessage msgKwhHigh(CHILD_ID_KWH_HIGH, V_KWH);     //Was V_KWH
    MyMessage msgGas(CHILD_ID_GAS, V_VOLUME);
    
    
    
    void setup() {
    //  Serial.begin(19200);
    //  delay(1000);
      
      altSerial.begin(9600);
      delay(1000);
    }
    
    
    void presentation() {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Node", "1.0");
      present(CHILD_ID_WATT, S_POWER);
      present(CHILD_ID_KWH_LOW, S_POWER);
      present(CHILD_ID_KWH_HIGH, S_POWER);
      present(CHILD_ID_GAS, S_GAS);
    }
    
    
    
    void loop() {
      long tl = 0;
      long tld =0;
      if (altSerial.available()) {
          char input = altSerial.read();
          buffer[bufpos] = input&127;
          bufpos++;
          if (input == '\n') { // We received a new line (data up to \n)
            // 1-0:1.8.2 = Electricity consumption high tariff (DSMR v4.0)
            if (sscanf(buffer,"1-0:1.8.2(%ld%.%ld%*s" , &tl, &tld) >0 ) {
              tl *= 1000;
              tl += tld;
              mEVHT = tl;
              //mEVHT = tl * 1000 + tld;
              if (mEVHT > 0) {
      
                //mEVHT = 0;
              }
            }
      
      
    
            if (sscanf(buffer,"1-0:1.8.1(%ld.%ld" ,&tl, &tld)==2){
              tl *= 1000;
              tl += tld;
              mEVLT = tl;
      
              if (mEVLT > 0) {
      
      
              }
            }
    
    
      
            // 1-0:1.7.0 = Electricity consumption actual usage (DSMR v4.0)
            if (sscanf(buffer,"1-0:1.7.0(%ld.%ld" ,&tl , &tld) == 2)
            { 
              mEAV = (tl*1000)+tld*10;            
              if (mEAV > 0) {
      
              }
            }
    
    
    
    
    
    
    
    /* Geeft actuele waarde door maar doet geen compare
    if (sscanf(buffer,"(%ld.%ld" , &tl, &tld)==2 ) 
          {   mG = (tl*1000.0)+tld;
          mG = mG/1000;
          }
    */
    
    
    
    //Gastand uitlezen
    if (sscanf(buffer,"(%ld.%ld" , &tl, &tld)==2 ) 
          {   mG = (tl*1000.0)+tld;
          mG = mG;
          }
    
    
    
    
      
            // Empty buffer again (whole array)
            for (int i=0; i<500; i++)
            { 
              buffer[i] = 0;
            }
            bufpos = 0;
      
          }
           
          if (input == '!') {   //uitroepteken geeft einde van telegram aan, dus we gaan data versturen
            #ifdef DEBUG
              printData();
            #endif
            send(msgWatt.set(mEAV));
            send(msgKwhLow.set(mEVLT));
            send(msgKwhHigh.set(mEVHT));
            send(msgGas.set(mG));
            mEVHT=0;
            mEVLT = 0;
            mEAV = 0;
            mG = 0;
            //client.stop();
          } //Einde vraagteken detectie   
      
        } 
    
    }
    
    
     
    

    Thanks !

    Troubleshooting

  • P1 not working when using Mysensors ?
    T Toine33

    So the output wich is given on the first sketch is :

    /ISk5\2MT382-1003
    
    0-0:96.1.1(5A424556303035303738373110323132)
    1-0:1.8.1(08316.297*kWh)
    1-0:1.8.2(08472.574*kWh)
    1-0:2.8.1(00000.020*kWh)
    1-0:2.8.2(00000.010*kWh)
    0-0:96.14.0(0001)
    1-0:1.7.0(0000.38*kW)
    1-0:2.7.0(0000.00*kW)
    0-0:17.0.0(0999.00*kW)
    0-0:96.3.10(1)
    0-0:96.13.1()
    0-0:96.13.0()
    0-1:24.1.0(3)
    0-1:96.1.0(3238303131303031323031113336343132)
    0-1:24.3.0(190907210000)(00)(60)(1)(0-1:24.2.1)(m3)
    (04212.860)
    0-1:24.4.0(1)
    !
    
    

    You can see here the output of my energy meter wich is given every 10 seconds

    And this is the output when i am using the sketch with Mysensors,
    It is curently not connected because im am unable at the moment.
    The strange part is that the serial prints are not workig at this stage anymore or is this normal when using mysensors?

     
     __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.3.0
    
    16 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.3.0
    25 TSM:INIT
    26 TSF:WUR:MS=0
    33 !TSM:INIT:TSP FAIL
    35 TSM:FAIL:CNT=1
    37 TSM:FAIL:DIS
    38 TSF:TDI:TSL
    10040 TSM:FAIL:RE-INIT
    10042 TSM:INIT
    10048 !TSM:INIT:TSP FAIL
    10051 TSM:FAIL:CNT=2
    10053 TSM:FAIL:DIS
    10054 TSF:TDI:TSL
    20057 TSM:FAIL:RE-INIT
    20059 TSM:INIT
    20065 !TSM:INIT:TSP FAIL
    20068 TSM:FAIL:CNT=3
    20070 TSM:FAIL:DIS
    20071 TSF:TDI:TSL
    30074 TSM:FAIL:RE-INIT
    30076 TSM:INIT
    30083 !TSM:INIT:TSP FAIL
    30086 TSM:FAIL:CNT=4
    30088 TSM:FAIL:DIS
    30089 TSF:TDI:TSL
    40092 TSM:FAIL:RE-INIT
    40094 TSM:INIT
    40100 !TSM:INIT:TSP FAIL
    40103 TSM:FAIL:CNT=5
    40105 TSM:FAIL:DIS
    40107 TSF:TDI:TSL
    50110 TSM:FAIL:RE-INIT
    50112 TSM:INIT
    50118 !TSM:INIT:TSP FAIL
    50121 TSM:FAIL:CNT=6
    50123 TSM:FAIL:DIS
    50124 TSF:TDI:TSL
    60127 TSM:FAIL:RE-INIT
    60129 TSM:INIT
    60135 !TSM:INIT:TSP FAIL
    60138 TSM:FAIL:CNT=7
    60140 TSM:FAIL:DIS
    60141 TSF:TDI:TSL
    120144 TSM:FAIL:RE-INIT
    120146 TSM:INIT
    120154 !TSM:INIT:TSP FAIL
    120156 TSM:FAIL:CNT=7
    120158 TSM:FAIL:DIS
    120160 TSF:TDI:TSL
    

    P.S
    I have done some testing also on RS485 and had the same situation.

    Troubleshooting

  • P1 not working when using Mysensors ?
    T Toine33

    Hey guys,

    I am trying to make this sketch work for a few days now but it looks like it wont work in combination with Mysensors.
    Here the sketch without the Mysensors.
    I am receiving output of the P1 Port on hardware serial 2.

    
    #define MY_DEBUG
    
    //#define MY_RADIO_RF24
    //#include <MySensors.h>
    
    
    
    char c;
     
    void setup() {
     Serial.begin(19200);
      Serial2.begin(9600, SERIAL_7N1);
    }
     
    void loop() {
        if (Serial2.available()) {
            c = Serial2.read();
    
        Serial.print(c);
        }
    }
    
    
    
    
    
    /* Baud-rates available: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200, 256000, 512000, 962100
     *  
     *  Protocols available:
     * SERIAL_5N1   5-bit No parity 1 stop bit
     * SERIAL_6N1   6-bit No parity 1 stop bit
     * SERIAL_7N1   7-bit No parity 1 stop bit
     * SERIAL_8N1 (the default) 8-bit No parity 1 stop bit
     * SERIAL_5N2   5-bit No parity 2 stop bits 
     * SERIAL_6N2   6-bit No parity 2 stop bits
     * SERIAL_7N2   7-bit No parity 2 stop bits
     * SERIAL_8N2   8-bit No parity 2 stop bits 
     * SERIAL_5E1   5-bit Even parity 1 stop bit
     * SERIAL_6E1   6-bit Even parity 1 stop bit
     * SERIAL_7E1   7-bit Even parity 1 stop bit 
     * SERIAL_8E1   8-bit Even parity 1 stop bit 
     * SERIAL_5E2   5-bit Even parity 2 stop bit 
     * SERIAL_6E2   6-bit Even parity 2 stop bit 
     * SERIAL_7E2   7-bit Even parity 2 stop bit  
     * SERIAL_8E2   8-bit Even parity 2 stop bit  
     * SERIAL_5O1   5-bit Odd  parity 1 stop bit  
     * SERIAL_6O1   6-bit Odd  parity 1 stop bit   
     * SERIAL_7O1   7-bit Odd  parity 1 stop bit  
     * SERIAL_8O1   8-bit Odd  parity 1 stop bit   
     * SERIAL_5O2   5-bit Odd  parity 2 stop bit   
     * SERIAL_6O2   6-bit Odd  parity 2 stop bit    
     * SERIAL_7O2   7-bit Odd  parity 2 stop bit    
     * SERIAL_8O2   8-bit Odd  parity 2 stop bit    
    */
    
    

    When i am using this same sketch with the Mysensors it is not giving output anymore.
    Does someone has an clue ?
    I have used an Arduino nano 16mhz first on altsoftserial with the same result.
    in this example i am using an Arduino mega 2560.

    
    #define MY_DEBUG
    
    #define MY_RADIO_RF24
    #include <MySensors.h>
    
    
    
    char c;
     
    void setup() {
     Serial.begin(19200);
      Serial2.begin(9600, SERIAL_7N1);
    }
     
    void loop() {
        if (Serial2.available()) {
            c = Serial2.read();
    
        Serial.print(c);
        }
    }
    
    
    
    
    
    /* Baud-rates available: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200, 256000, 512000, 962100
     *  
     *  Protocols available:
     * SERIAL_5N1   5-bit No parity 1 stop bit
     * SERIAL_6N1   6-bit No parity 1 stop bit
     * SERIAL_7N1   7-bit No parity 1 stop bit
     * SERIAL_8N1 (the default) 8-bit No parity 1 stop bit
     * SERIAL_5N2   5-bit No parity 2 stop bits 
     * SERIAL_6N2   6-bit No parity 2 stop bits
     * SERIAL_7N2   7-bit No parity 2 stop bits
     * SERIAL_8N2   8-bit No parity 2 stop bits 
     * SERIAL_5E1   5-bit Even parity 1 stop bit
     * SERIAL_6E1   6-bit Even parity 1 stop bit
     * SERIAL_7E1   7-bit Even parity 1 stop bit 
     * SERIAL_8E1   8-bit Even parity 1 stop bit 
     * SERIAL_5E2   5-bit Even parity 2 stop bit 
     * SERIAL_6E2   6-bit Even parity 2 stop bit 
     * SERIAL_7E2   7-bit Even parity 2 stop bit  
     * SERIAL_8E2   8-bit Even parity 2 stop bit  
     * SERIAL_5O1   5-bit Odd  parity 1 stop bit  
     * SERIAL_6O1   6-bit Odd  parity 1 stop bit   
     * SERIAL_7O1   7-bit Odd  parity 1 stop bit  
     * SERIAL_8O1   8-bit Odd  parity 1 stop bit   
     * SERIAL_5O2   5-bit Odd  parity 2 stop bit   
     * SERIAL_6O2   6-bit Odd  parity 2 stop bit    
     * SERIAL_7O2   7-bit Odd  parity 2 stop bit    
     * SERIAL_8O2   8-bit Odd  parity 2 stop bit    
    */
    
    
    Troubleshooting
  • Login

  • Don't have an account? Register

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