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
Christian SimonsenC

Christian Simonsen

@Christian Simonsen
About
Posts
32
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How do I setup Raspberry Pi 2 with NRF24L01 as MySensor 2.0 Gateway with MyController as controller
    Christian SimonsenC Christian Simonsen

    Hi,

    I'm stuck trying to setup my Raspberry Pi 2 with NRF24L01 to the GPIO pins as a Gateway and as a controller (MyController.org). Im trying to use MySensors 2.0 library. I will gladly pay a bit if someone can help with 1-to-1 via Skype or similar to get this working. As Im close to giving up on my own...

    Any help is very much appreciated.

    Configuration of the gateway on the Raspberry Pi 2

    pi@raspberrypi:~/MySensors $ ./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway --my-radio=nrf24 --my-rf24-channel=0
    [SECTION] Detecting target machine.
    [OK] machine detected: SoC=BCM2836, Type=Rpi2, CPU=armv7l, REV=a01041.
    [OK] init system detected: systemd
    [SECTION] Saving configuration.
    [SECTION] Cleaning previous builds.
    [OK] Finished.
    

    Make command on the Raspberry Pi 2 via Terminal on my Mac.

    pi@raspberrypi:~/MySensors $ make
    cc  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/log.o drivers/Linux/log.c
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/noniso.o drivers/Linux/noniso.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/Print.o drivers/Linux/Print.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/EthernetClient.o drivers/Linux/EthernetClient.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/SerialPort.o drivers/Linux/SerialPort.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/Stream.o drivers/Linux/Stream.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/IPAddress.o drivers/Linux/IPAddress.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/compatibility.o drivers/Linux/compatibility.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/SoftEeprom.o drivers/Linux/SoftEeprom.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/EthernetServer.o drivers/Linux/EthernetServer.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o examples_linux/mysGateway.o examples_linux/mysGateway.cpp
    cc  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/piHiPri.o drivers/RPi/piHiPri.c
    cc  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/bcm2835.o drivers/RPi/bcm2835.c
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/rpi_util.o drivers/RPi/rpi_util.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/Wire.o drivers/RPi/Wire.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/SPI.o drivers/RPi/SPI.cpp
    g++ -pthread  -o examples_linux/mysGateway drivers/Linux/log.o drivers/Linux/noniso.o drivers/Linux/Print.o drivers/Linux/EthernetClient.o drivers/Linux/SerialPort.o drivers/Linux/Stream.o drivers/Linux/IPAddress.o drivers/Linux/compatibility.o drivers/Linux/SoftEeprom.o drivers/Linux/EthernetServer.o examples_linux/mysGateway.o drivers/RPi/piHiPri.o drivers/RPi/bcm2835.o drivers/RPi/rpi_util.o drivers/RPi/Wire.o drivers/RPi/SPI.o
    

    I then ran the mysGateway

    pi@raspberrypi:~/MySensors $ sudo ./examples_linux/mysGateway -d
    mysGateway: Starting gateway...
    mysGateway: Protocol version - 2.0.1-beta
    mysGateway: MCO:BGN:INIT GW,CP=RNNG---,VER=2.0.1-beta
    mysGateway: TSF:LRT:OK
    mysGateway: TSM:INIT
    mysGateway: TSM:INIT:TSP OK
    mysGateway: TSM:INIT:GW MODE
    mysGateway: TSM:READY
    mysGateway: MCO:REG:NOT NEEDED
    mysGateway: MCO:BGN:STP
    mysGateway: MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1
    mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysGateway: !TSF:MSG:LEN,0!=7
    mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysGateway: !TSF:MSG:LEN,0!=7
    mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysGateway: !TSF:MSG:LEN,0!=7
    --Continues with same code a lot longer - just cut it short here
    
    

    Then over to the Arduino Uno that is also connect with an NRF24L01

    The sketch I'm running on the Arduino

    /*
     * 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.
     *
     *******************************
     */
    #include <stdint.h>
    #include <pins_arduino.h>
    #define MY_DEBUG
    #define MY_DEBUG_VERBOSE_SIGNING
    #define MY_RF24_CHANNEL 0
    #define MY_RADIO_NRF24
    //#define MY_SIGNING_SOFT
    #define MY_SIGNING_ATSHA204
    #define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}}
    #define MY_SIGNING_REQUEST_SIGNATURES
    #ifndef MY_SIGNING_SOFT_RANDOMSEED_PIN
    #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
    #endif
    #ifndef MY_SIGNING_ATSHA204_PIN
    #define MY_SIGNING_ATSHA204_PIN 17
    #endif
    #define MY_RF24_ENABLE_ENCRYPTION
    
    #include <SPI.h>
    #include <MySensors.h>
    

    However with this sketch I'm recieving an error that I can read on the Serial Monitor on my Mac (output from the Arduino sensor node)

    Starting sensor (RNNNAA, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=1)
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSM:FPAR:FAIL
    !TSM:FAILURE
    

    I don't understand what is wrong. I do believe all the wires are correct, so I believe it is related to the Arduino sketch, or more likely the gateway setup on the Raspberry Pi.

    I hope someone can help. I'll gladly pay someone to give me some 1-to-1 support over Skype or similar.

    Hardware mycontroller.org gpio raspberry pi 2 rbp2 nrf24l01

  • How do I setup Raspberry Pi 2 with NRF24L01 as MySensor 2.0 Gateway with MyController as controller
    Christian SimonsenC Christian Simonsen

    @alexsh1 said:

    FPAR: FAIL = Find Parent Fail. The sensor is looking for a parent, but cannot find it. There can be several reasons for this:

    1. Try to add larger capacitors to both radios on GW and the sensor.
    2. Please use a default sketch on the sensor, no signing etc.
    3. Double check if the channel is the same. You are using channel 0 on RPi. What about the sensor? Did you change it from a default 76?
    4. Did you upload both sketches using MySensors 2.0?
    5. Please check the power feed on both GW and the sensor.

    Hi thanks for the support. Hope you are able to elaborate a bit on your points.

    1. Try to add larger capacitors to both radios on GW and the sensor.
      I'm using a 4.7 uF Capacitator on both the NRF24L01 on the Raspberry Pi, and on the NRF24L01 on the Arduino. Do you think I still need a bigger capacitor?

    2. ** Please use a default sketch on the sensor, no signing etc.**

    Can you share a default sketch to use?

    I have tried the below sketch from this page https://www.mysensors.org/download/sensor_api_20#sensor-nodes
    But the sketch do not compile due to non defined NODE_ID. I tried to updated the code by changing NODE_ID to MY_NODE_ID and added a line to #DEFINE MY_NODE_ID 1

    Is this correct? See the updated code that I've used below

    #define MY_RADIO_NRF24
    #define MY_DEBUG
    
    #include <MySensors.h>
    #include <SPI.h>
    
    #define MY_NODE_ID 1
    #define MY_PARENT_NODE_ID 0
    #define MY_PARENT_NODE_IS_STATIC
    
    MyMessage msg(MY_NODE_ID, V_TRIPPED);
    
    void presentation()
    {
        present(MY_NODE_ID, S_DOOR);
    }
    
    void loop()
    {
    
    }
    

    With this code I still get an error (this is the Arduino Uno sensor node)

    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=1)
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSM:FPAR:FAIL
    !TSM:FAILURE
    TSM:PDT
    
    1. Did you upload both sketches using MySensors 2.0?
      Not sure how you upload the sketch to the RPI 2 using MySenors 2.0. However I have atleast tried to follow this tutorial. https://www.mysensors.org/build/raspberry

    The actual steps I did are repeated below.

    git clone https://github.com/mysensors/MySensors.git
    cd MySensors
    
    ./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway --my-radio=nrf24
    
    sudo make all 
    
    sudo make install
    
    sudo systemctl enable mysgateway.service
    
    sudo ./examples_linux/mysGateway -d
    
    1. Please check the power feed on both GW and the sensor.
      How do you do this?
    Hardware mycontroller.org gpio raspberry pi 2 rbp2 nrf24l01

  • How do I setup Raspberry Pi 2 with NRF24L01 as MySensor 2.0 Gateway with MyController as controller
    Christian SimonsenC Christian Simonsen

    @alexsh1

    Thanks for all the tips.

    I've now installed a new 100 uF (16V) Capacitor in parallell with the current 4.7 uF (50V) capacitor on both the units, I also double checked the writing just to be sure. It all looks good. See images below.

    0_1477238490304_Screenshot 2016-10-23 18.01.02.png
    0_1477238495919_Screenshot 2016-10-23 18.01.11.png

    **After adding the capacitor, I uninstalled and cleaned the setting on the Raspberry Pi. **

    Sudo make uninstall

    pi@raspberrypi:~/MySensors $ sudo make uninstall
    Stopping daemon mysgateway (ignore errors)
    removing files
    rm /etc/systemd/system/mysgateway.service /usr/local/bin/mysGateway
    

    Sudo make clean

    pi@raspberrypi:~/MySensors $ sudo make clean
    [Cleaning]
    rm -rf build drivers/Linux/log.o drivers/Linux/noniso.o drivers/Linux/SoftEeprom.o drivers/Linux/EthernetClient.o drivers/Linux/SerialPort.o drivers/Linux/Stream.o drivers/Linux/Print.o drivers/Linux/IPAddress.o drivers/Linux/compatibility.o drivers/Linux/EthernetServer.o examples_linux/mysGateway.o drivers/RPi/piHiPri.o drivers/RPi/bcm2835.o drivers/RPi/rpi_util.o drivers/RPi/Wire.o drivers/RPi/SPI.o examples_linux/mysGateway drivers/Linux/log.d drivers/Linux/noniso.d drivers/Linux/SoftEeprom.d drivers/Linux/EthernetClient.d drivers/Linux/SerialPort.d drivers/Linux/Stream.d drivers/Linux/Print.d drivers/Linux/IPAddress.d drivers/Linux/compatibility.d drivers/Linux/EthernetServer.d examples_linux/mysGateway.d drivers/RPi/piHiPri.d drivers/RPi/bcm2835.d drivers/RPi/rpi_util.d drivers/RPi/Wire.d drivers/RPi/SPI.d
    

    **After uninstalling, reset the configuration, and installed and started the gateway. **

    pi@raspberrypi:~/MySensors $ ./configure --my-debug=enable --my-gateway=serial --my-serial-is-pty --my-serial-pty=ttyMySensorsGateway --my-transport=nrf24 --my-rf24-channel=76
    [SECTION] Detecting target machine.
    [OK] machine detected: SoC=BCM2836, Type=Rpi2, CPU=armv7l, REV=a01041.
    [OK] init system detected: systemd
    [SECTION] Saving configuration.
    [SECTION] Cleaning previous builds.
    [OK] Finished.
    

    Make all

    pi@raspberrypi:~/MySensors $ sudo make all
    cc  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/log.o drivers/Linux/log.c
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/noniso.o drivers/Linux/noniso.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/Print.o drivers/Linux/Print.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/EthernetClient.o drivers/Linux/EthernetClient.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/SerialPort.o drivers/Linux/SerialPort.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/Stream.o drivers/Linux/Stream.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/IPAddress.o drivers/Linux/IPAddress.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/compatibility.o drivers/Linux/compatibility.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/SoftEeprom.o drivers/Linux/SoftEeprom.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/EthernetServer.o drivers/Linux/EthernetServer.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o examples_linux/mysGateway.o examples_linux/mysGateway.cpp
    cc  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/piHiPri.o drivers/RPi/piHiPri.c
    cc  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/bcm2835.o drivers/RPi/bcm2835.c
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/rpi_util.o drivers/RPi/rpi_util.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/Wire.o drivers/RPi/Wire.cpp
    g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY  -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/SPI.o drivers/RPi/SPI.cpp
    g++ -pthread  -o examples_linux/mysGateway drivers/Linux/log.o drivers/Linux/noniso.o drivers/Linux/Print.o drivers/Linux/EthernetClient.o drivers/Linux/SerialPort.o drivers/Linux/Stream.o drivers/Linux/IPAddress.o drivers/Linux/compatibility.o drivers/Linux/SoftEeprom.o drivers/Linux/EthernetServer.o examples_linux/mysGateway.o drivers/RPi/piHiPri.o drivers/RPi/bcm2835.o drivers/RPi/rpi_util.o drivers/RPi/Wire.o drivers/RPi/SPI.o
    

    Sudo make install

    pi@raspberrypi:~/MySensors $ sudo make install
    Installing examples_linux/mysGateway to /usr/local/bin
    install -m0644 initscripts/mysgateway.systemd /etc/systemd/system/mysgateway.service
    systemctl daemon-reload
    MySensors gateway has been installed, to add to the boot run:
      sudo systemctl enable mysgateway.service
    To start the gateway run:
      sudo systemctl start mysgateway.service
    

    start the gateway

    pi@raspberrypi:~/MySensors $ sudo systemctl start mysgateway.service
    

    Start the debug on the gateway:

    pi@raspberrypi:~/MySensors $ sudo ./examples_linux/mysGateway -d
    mysGateway: Starting gateway...
    mysGateway: Protocol version - 2.0.1-beta
    mysGateway: MCO:BGN:INIT GW,CP=RNNG---,VER=2.0.1-beta
    mysGateway: TSF:LRT:OK
    mysGateway: TSM:INIT
    mysGateway: TSM:INIT:TSP OK
    mysGateway: TSM:INIT:GW MODE
    mysGateway: TSM:READY
    mysGateway: MCO:REG:NOT NEEDED
    mysGateway: MCO:BGN:STP
    mysGateway: MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1
    mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysGateway: !TSF:MSG:LEN,0!=7
    mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysGateway: !TSF:MSG:LEN,0!=7
    mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysGateway: !TSF:MSG:LEN,0!=7
    

    Now, the gateway on the Raspberry Pi 2 seem ok and up and running. Moving over to the sensor node, the Arduino Uno with NRF24L01+.

    Uploaded and ran the Clear_EPROM sketch

    /*
    *
    * This sketch clears radioId, relayId and routing info in EEPROM 
    *
    */
    
    #include <SPI.h>
    #include <EEPROM.h>  
    
    void setup()  
    { 
      for (int i=0;i<512;i++) {
        EEPROM.write(i, 0xff);
      }
      Serial.println("EEPROM cleared");
    }
    
    void loop()      
    { 
      // Nothing to do here...
    } 
    

    After this I uploaded your recommended default sketch. However I added "#define MY_RF24_CHANNEL 76"

    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    
    // Enable and select radio type attached
    #define MY_NODE_ID 1
    #define MY_PARENT_NODE_ID 0
    #define MY_PARENT_NODE_IS_STATIC
    #define MY_RADIO_NRF24
    #define MY_RF24_CHANNEL 76
    
    #include <MySensors.h>  
    
    #define CHILD_ID_LIGHT 0
    #define LIGHT_SENSOR_ANALOG_PIN 0
    
    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
    
    MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
    int lastLightLevel;
    
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Light Sensor", "1.0");
    
      // Register all sensors to gateway (they will be created as child devices)
      present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
    }
    
    void loop()      
    {     
      int16_t lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23; 
      Serial.println(lightLevel);
      if (lightLevel != lastLightLevel) {
          send(msg.set(lightLevel));
          lastLightLevel = lightLevel;
      }
      sleep(SLEEP_TIME);
    }
    

    The result, enoyingly is the same it seems based on the output from the Serial Monitor from the Arduino Uno.

    Starting sensor (RNNNA-, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=1)
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSM:FPAR:FAIL
    !TSM:FAILURE
    TSM:PDT
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=1)
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSM:FPAR:FAIL
    !TSM:FAILURE
    TSM:PDT
    

    Frustrating... Can it be other modules, libraries than what I've not installed on the Raspberry Pi that is the reason for the error?

    Hardware mycontroller.org gpio raspberry pi 2 rbp2 nrf24l01

  • How do I setup Raspberry Pi 2 with NRF24L01 as MySensor 2.0 Gateway with MyController as controller
    Christian SimonsenC Christian Simonsen

    @alexsh1

    You are 100 % correct :+1: :)

    I changed the NRF24L01 module with the antenna, with a standard NRF24L01+ module. And it works like a charm.

    Here are the Serial Monitor code from the Arduino (Sensor node). I don't currently understand what all the code says, but it seems like they are communicating.

    Starting sensor (RNNNA-, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=1)
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSP:MSG:READ 0-0-1 s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSP:MSG:FPAR RES (ID=0, dist=0)
    TSP:MSG:FPAR (PPAR FOUND)
    TSP:MSG:PAR OK (ID=0, dist=1)
    TSM:FPAR:OK
    TSM:ID
    TSM:CHKID:OK (ID=1)
    TSM:UPL
    TSP:PING:SEND (dest=0)
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
    TSP:MSG:READ 0-0-1 s=255,c=3,t=25,pt=1,l=1,sg=0:1
    TSP:MSG:PONG RECV (hops=1)
    TSP:CHKUPL:OK
    TSM:UPL:OK
    TSM:READY
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
    TSP:MSG:SEND 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=ok:2.0.0
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0
    TSP:MSG:READ 0-0-1 s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=11,pt=0,l=12,sg=0,ft=0,st=ok:Light Sensor
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.0
    TSP:MSG:SEND 1-1-0-0 s=0,c=0,t=16,pt=0,l=0,sg=0,ft=0,st=ok:
    Request registration...
    !TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=fail:2
    !TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=fail:2
    !TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=2,st=fail:2
    !TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=3,st=fail:2
    Init complete, id=1, parent=0, distance=1, registration=1
    50
    !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=4,st=fail:50
    56
    !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=5,st=fail:56
    !TSM:UPL FAIL, STATP
    58
    !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=fail:58
    58
    58
    
    

    And from the Raspberry Pi

    mysGateway: TSM:INIT:TSP OK
    mysGateway: TSM:INIT:GW MODE
    mysGateway: TSM:READY
    mysGateway: MCO:REG:NOT NEEDED
    mysGateway: MCO:BGN:STP
    mysGateway: MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1
    mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysGateway: !TSF:MSG:LEN,8!=7
    mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysGateway: !TSF:MSG:LEN,0!=7
    mysGateway: TSF:MSG:READ,1-1-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    mysGateway: TSF:MSG:BC
    mysGateway: TSF:MSG:FPAR REQ,ID=1
    mysGateway: TSF:PNG:SEND,TO=0
    mysGateway: TSF:CKU:OK
    mysGateway: TSF:MSG:GWL OK
    mysGateway: TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    mysGateway: TSF:MSG:READ,1-1-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
    mysGateway: TSF:MSG:PINGED,ID=1,HP=1
    mysGateway: TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
    mysGateway: TSF:MSG:READ,0-1-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
    mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0:
    mysGateway: !TSF:MSG:LEN,8!=7
    
    Hardware mycontroller.org gpio raspberry pi 2 rbp2 nrf24l01
  • Login

  • Don't have an account? Register

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