Multi Node project (MySensors noob) =RASPBERRY GATEWAY PROBLEM=



  • Hi All

    I start my "first" MySensors node project. (i built one temp sensor 3years ago, but just do that only with some tutorial explain).

    I have quite good knowing Arduino systems, but MySensors are new thing to me. I think to build 3pcs nodes to my house. I use Arduino nano, rf24 with external antenna, i design node circuit boards with eagle and do that on china.

    Node boards are quite simple..
    -couple capasitators 3.3v and 5v power lines.
    -3.3v 0.5A regulator
    -connector 2.4rf
    -connector arduino nano
    -connector ds1820 temperature sensors.
    -Tx, Rx, Err leds. (not know still mysensors use that leds?)
    -Other space is just normal test circuit board where can build what want.
    -Use normal cellphones 5v/1-2A chargers to power this nodes.
    -128x32 Oled display (SSD1306)
    +Controller is Raspberry pi 3 + Aeon Zwave stick + MySensors gateway (i take recommends what kind gateway is best built to Raspberry) + Domoticz Beta software.

    Couple pictures node:
    https://www.dropbox.com/s/92qujf14czxgqtz/IMG_20170623_124513.jpg?dl=0
    https://www.dropbox.com/s/08eyobxwoub4hzl/IMG_20170623_124618.jpg?dl=0

    After that i need help with software, of course take hints to hardware too if someone want to gives.

    I think to do nodes what include: relay control (2-4pcs), ds1820 sensors (2-10pcs), maybe some switch info (couple door switches) and oled display show one temperature and maybe use tx rx and err one corner of dipslay and take that leds out.

    What is best software example where i start to build this kind of node. I allready check ds1820 temperature node, but maybe is easiest if i find some code where is allready some my features or maybe all my features and i edit that suitable to my use?

    If i do example 2pcs relay outs, 3pcs ds1820 sensors, 2pcs door switches, can i get every outs, switch and temps see seperate to my domoticz?


  • Mod

    @lassivv welcome to the MySensors community.

    Start small. Make one sensor (for example DS18B20) work first. Then add another sensor, bit by bit. When you get into trouble, take a step back to what worked previously (make sure you save backups of the sketch along the way). Trying to do everything at once will be very hard.

    But before you do anything, read the getting started guide if you haven't already. Reading this will probably save you many hours.



  • Thx for info. I try to start do gateway work on my raspberry pi 3. I do this kind of wiring: https://www.mysensors.org/build/raspberry#improving-throughput-for-nrf24 (Only edit i use 3.3v regulator to 2.4rf module and take voltage 5voltage line of course).

    I try to do all settings like that url tells me. Here couple last things i change many different things that tty place, but not help, i also try network gateway, but not helped same error coming.

    http://i.imgur.com/jpiaMdC.png

    I check wirings two times and that is ok. And i think this make -command tells if i have wrong wiring.

    Any hints what i do now. Not want do arduino gateway and plug that with usb on raspberry, because more hardware.

    Hope someone can help me. Any hints and tips are welcome.


  • Mod

    @lassivv there is no way for the make or configure commands to figure out if the wiring is wrong so you would not get an indication from them.

    INIT:TSP:FAIL means that the gateway software is unable to communicate with the nrf24 radio module. Could the radio module be broken? Can you test the radio on another node, or test with another radio module?

    Could you post a photo of your wiring? Maybe that can help us figure out what is wrong?



  • Hi mfalkvidd

    Yeah i know that, but some instructions have some notice linux give back "bad wiring" but maybe that is some other module or system what i read about.

    Anyway i tested 2pcs radio modems same thing with both. I have node ready, but not have gateway not know do i can test my node working without gateway.

    Here is post to wirings, some places not show every photo but i write explains where wirings goes. Hope this helps to seem what i do wrong.

    http://i.imgur.com/CvvvmFx.jpg
    http://i.imgur.com/a6b5tSf.jpg

    edit: Leds are connected 3.3v power --> led --> 510ohm resistor --> other end are attached pins 12, 16 and 18.


  • Mod

    @lassivv great photos. Really nice build.

    Everything looks correct to me. Maybe check with a multimeter if there are any short circuits between pins?

    You can check the radio by connecting it to your node with debug enabled.
    If the node stops at "TSM : INIT : TSP FAIL" the node is unable to communicate with the radio.

    If the node shows "TSM : INIT : TSP OK" and a bit later "!TSM : FPAR : NO REPLY" the node is able to communicate with the radio but unable to communicate with the gateway (which is expected if the gateway isn't running).



  • Not find any short circuit that i allready of course checked but checked them again.

    Here is node debug info.

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    3 TSM:INIT
    4 TSF:WUR:MS=0
    11 TSM:INIT:TSP OK
    12 TSM:FPAR
    15 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2022 !TSM:FPAR:NO REPLY
    2024 TSM:FPAR
    2026 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4034 !TSM:FPAR:NO REPLY
    4036 TSM:FPAR
    4038 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    6046 !TSM:FPAR:NO REPLY
    6048 TSM:FPAR
    6050 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    8058 !TSM:FPAR:FAIL
    8059 TSM:FAIL:CNT=1
    8061 TSM:FAIL:PDT
    18065 TSM:FAIL:RE-INIT
    18067 TSM:INIT
    18074 TSM:INIT:TSP OK
    18076 TSM:FPAR
    18078 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    20086 !TSM:FPAR:NO REPLY
    20088 TSM:FPAR
    20090 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    22099 !TSM:FPAR:NO REPLY
    22102 TSM:FPAR
    22104 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    24112 !TSM:FPAR:NO REPLY
    24114 TSM:FPAR
    24116 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    26124 !TSM:FPAR:FAIL
    26125 TSM:FAIL:CNT=2
    26127 TSM:FAIL:PDT
    

    EDIT: I try to jumper cabel only Nrf24 module to rasbperry but get same error message like this:

    pi@raspberrypi:~/MySensors $ sudo ./bin/mysgw -d
    mysgw: Starting gateway...
    mysgw: Protocol version - 2.1.1
    mysgw: MCO:BGN:INIT GW,CP=RNNG--Q,VER=2.1.1
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=1
    mysgw: TSM:FAIL:PDT
    mysgw: TSM:FAIL:RE-INIT
    mysgw: TSM:INIT
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=2
    mysgw: TSM:FAIL:PDT
    mysgw: TSM:FAIL:RE-INIT
    mysgw: TSM:INIT
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=3
    mysgw: TSM:FAIL:PDT
    

    EDIT2: Try to take 15pin IRQ disconnect and make without that. Not help anything.

    How i can delete all mysensors files and do new installation? Something better link than this?
    git clone https://github.com/mysensors/MySensors.git --branch master

    EDIT3:
    I put gateway serial in my node. Upload skecth and open serial. Is this working gateway messages? This debug goes, but after that not coming any more messages:

    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.1.1
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
    

  • Hardware Contributor

    @lassivv

    I saw in other forum that you give multiple ./configure commands.

    That was my same error.

    You need give only one a single ./configure command 🙂

    For example

    ./configure stuff=a stuff=b stuff=c stuff=d

    and after type "make".



  • Thx for info @sineverba but not help anything, same error message still.

    I try with his kind configure:

    ./configure --my-transport=nrf24 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway --my-transport=nrf24 --my-rf24-irq-pin=15
    

    Get this error back

    mysgw: Starting gateway...
    mysgw: Protocol version - 2.1.1
    mysgw: MCO:BGN:INIT GW,CP=RNNG--Q,VER=2.1.1
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: !TSM:INIT:TSP FAIL
    mysgw: TSM:FAIL:CNT=1
    mysgw: TSM:FAIL:PDT
    

    Now i testing my node and (serial arduino gateway) and that seems work perfect every nrf24 modules what i have. Not understand why raspberry not work directly.

    Couple questions to do that node system.

    I understand to start little more and more style. But i think you have good tips what kind code is best example to do something bigger node. (many temps, many relays and many swithches).

    Because now if i only try edit some simple sketch to that kind "big" node i think that not best way to do that kind of node.

    Other question i try to put, this kind code my sketch. (i copied that to myconfig file.) I understand if i put that command my sketch that overdrive myconfig -file values?

    I try to get diagnostic leds work my node, but nothing happen. Anyone know do that leds works ok nowadays?

    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    #define MY_DEFAULT_ERR_LED_PIN 4
    #define MY_DEFAULT_TX_LED_PIN 7
    #define MY_DEFAULT_RX_LED_PIN 8
    

  • Hardware Contributor

    @lassivv said in Multi Node project (MySensors noob) =RASPBERRY GATEWAY PROBLEM=:

    Thx for info @sineverba but not help anything, same error message still.

    I try with his kind configure:

    ./configure --my-transport=nrf24 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway --my-transport=nrf24 --my-rf24-irq-pin=15
    

    Get this error back

    mysgw: Starting gateway...
    mysgw: Protocol version - 2.1.1
    mysgw: MCO:BGN:INIT GW,CP=RNNG--Q,VER=2.1.1
    

    Try the DEVELOPMENT branch, not the master.

    I had my head broken on this with PI rev2.

    How I get all working?

    First of all, I did try on another raspbian the lib TMR20 and his "gettingstarted".

    If all work with there, simpler at beginning than mysensors, I re-flashed a raspbian and:

    1. Setup with raspi-config the SPI
    2. Changed password to pi user
    3. Installed git
    4. sudo apt-get update (not upgrade, for info)
    5. gitted from DEVELOPMENT branch
    6. ./configured

    and boom! All work.

    After, I use rpi-clone and I did other tweaks on my distro (timezone, ssh, cron for backup, etc etc etc etc)



  • @sineverba Many thanks to your hint. I do same everything starts working perfectly. No can use raspi serial nrf and not need to but not necessary Arduino nano to do gateway things.

    Many thanks one more time.

    This kind configure i put, everything works now ok. Tx rx and er led not work, but i can live with that 🙂

    ./configure --my-transport=nrf24 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSB020 --my-transport=nrf24 --my-rf24-irq-pin=15 --my-rf24-channel=108 --my-leds-err-pin=12 --my-leds-rx-pin=16 --my-leds-tx-pin=18
    

    Can someone tell why mysensors sketch take so much size on program memory. And i but debug // out commented first row and after that still printing serial monitor.

    Here my code now. Can i do simpler that code because i know i use 3-5 ds1820 sensors not need to scan everytime what sensors there are and now they are harder rename.

    Try to search some examples, but almost all use this ds1820 example code. I think code is more and more simpler if just do 3pcs ds1820 sensors and name that temps allready with some name. After that see directly on Domoticz what sensor is what.

    Everyhints with this is ok, that works ok right now with this example code, but code is quite big (big sketch) and have that sensor scan system what i not needed.

    What i can do that 30000ms sleep, if i but relay and switch systems in this same node.

    Only edit is now couple rows code to use my oled display to show one ds1820 sensor temp. I understand that do this sketch little bit bigger, but sketch is quite big before that oled display.

    /**
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     *
     * DESCRIPTION
     *
     * Example sketch showing how to send in DS1820B OneWire temperature readings back to the controller
     * http://www.mysensors.org/build/temp
     */
    
    
    
    
    
    
    
    // Enable debug prints to serial monitor
    //#define MY_DEBUG 
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    #include <SPI.h>
    #include <MySensors.h>  
    #include <DallasTemperature.h>
    #include <OneWire.h>
    
     // NÄYTTÖ INCLUDET!
    #include <Wire.h>              
    #include <Adafruit_GFX.h>
    #include <Adafruit_SSD1306.h>
    
    #define OLED_RESET 4
    Adafruit_SSD1306 display(OLED_RESET);
    
    #define NUMFLAKES 10
    #define XPOS 0
    #define YPOS 1
    #define DELTAY 2
    
    #if (SSD1306_LCDHEIGHT != 32)
    #error("Height incorrect, please fix Adafruit_SSD1306.h!");
    #endif
     // NÄYTTÖ INCLUDET LOPPU!
    
    
    
    #define COMPARE_TEMP 1 // Send temperature only if changed? 1 = Yes 0 = No
    
    #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
    #define MAX_ATTACHED_DS18B20 8
    
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    #define MY_DEFAULT_ERR_LED_PIN 4
    #define MY_DEFAULT_TX_LED_PIN 7
    #define MY_DEFAULT_RX_LED_PIN 8
    
    float temperature = 0;
    
    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 msg(0,V_TEMP);
    
    void before()
    {
      // Startup up the OneWire library
      sensors.begin();
      
    }
    
    void setup()  
    { 
      // requestTemperatures() will not block current thread
      sensors.setWaitForConversion(false);
    
      display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
      delay(500);
      display.clearDisplay();
    }
    
    void presentation() {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Garage Node", "1.1");
    
      // Fetch the number of attached temperature sensors  
      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()     
    {     
      // Fetch temperatures from Dallas sensors
      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)
      sleep(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
        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
    
          // Send in the new temperature
          //Serial.print("xxxx"); Serial.print(temperature); // omaa debuggausta..
          send(msg.setSensor(i).set(temperature,1));
          // Save new temperatures for next compare
          lastTemperature[i]=temperature;
    
        oledNaytto();
        }
      }
      sleep(SLEEP_TIME);
    }
    
    ////////////////OLED NÄYTÖN OHJAUS .. TEMPERATURE OTETAAN VALMIISTAJA MUUTTUJASTA JA INDEKSIN MUKAAN (1 on tällä hetkellä ainakin room temp)///////
    int oledNaytto(){
            display.clearDisplay();
            display.setTextSize(3);
            display.setTextColor(WHITE);
            display.setCursor(0,0);
            display.println(lastTemperature[1]);
            display.display();
    }
    

Log in to reply
 

Suggested Topics

24
Online

11.2k
Users

11.1k
Topics

112.5k
Posts