π¬ Building a Raspberry Pi Gateway
-
I have it working :smiley: only need to play with the debounce value
-
@shfg There were some reports about this problem in the past, do you see any error messages in your mosquitto log?
@ericvdb yes, you can attach a function to handle an interruption like this:
uint8_t mode = FALLING; // Valid options are: CHANGE, FALLING, RISING uint8_t physPin = 16; // Choose a pin that fits your needs void irqHandler(void) { // Process the interrupt } void setup() { attachInterrupt(physPin, irqHandler, mode); }Support for I2C was added in the latest version.
@marceloaqno I finally have the MQTT gateway working after upgrading mosquitto to the latest build... I had installed mosquitto with apt-get under Wheezy which apparently pulled an older version. In retrospect probably should have just upgraded to Jessie from the outset! Working perfectly now (still under wheezy though FWIW)... thanks!
-
@Christian-Simonsen start the gateway with debug enabled:
mysGateway -d -
Hi,
Background: I have a raspberry Pi 2 that I've installed MyController on. This works fine, I can access it via the browser. I have also wired up an NRF24L01+ module to the GPIO pins on the Raspberry Pi. I have also set up the raspberry pi as a gateway in the MyController Gateway setup page in Safari. It found it and it seem to work.
However to my question. How do I know if the Raspberry Pi gateway with NRF24L01 work? How can I monitor what the Raspberry Pi gateway receive? Is there a similar way as the "Serial Monitor" that I use in the Arduino application, when accessing Arduino Uno via USB?
If there is I need to monitor this via OSX Terminal.
@Christian-Simonsen If you don't have debug enabled you could also just use:
tail -f /dev/ttyUSB20My port is named ttyUSB20. You should substitute whatever you have named your port.
-
@Christian-Simonsen If you don't have debug enabled you could also just use:
tail -f /dev/ttyUSB20My port is named ttyUSB20. You should substitute whatever you have named your port.
Thanks I'll test it. But it seems like I've jumped over a step or two. Or something isn't working. Nothing happened when I wrote "Make" in Terminal, so I jumped over this step. I guess that might be the problem.
Do I have to configure (./configure -help) or can I use the default values when I connect the NRF24L01 to the GPIO pins?
-
@b0rmann what happened? Did you fixed the problem you described in your last message?
-
@b0rmann what happened? Did you fixed the problem you described in your last message?
it's my problem. accidentally disconnected power from nrf24 on running gw
-
@marceloaqno I have it completely working now. :satisfied: A Raspberry Pi PulseCounter for water/gas/electricity consumption measurements with ethernet/mqtt. I can post my code here if you want.
Minor detail:
millis() / 1000;should be
millis() * 1000;to get micros() ;)
-
@marceloaqno I have it completely working now. :satisfied: A Raspberry Pi PulseCounter for water/gas/electricity consumption measurements with ethernet/mqtt. I can post my code here if you want.
Minor detail:
millis() / 1000;should be
millis() * 1000;to get micros() ;)
@ericvdb Congrats! oops, sorry about my mistake.
-
This post is deleted!
-
Seems I'm closing in to working solution. I didn't understand how to use the ./configure element before now. However I ended up with these configurations
pi@raspberrypi:~ $ ./MySensors/configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway --my-radio=nrf24 --my-rf24-irq-pin=15 [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. make: *** No rule to make target 'clean'. Stop. [OK] Finished. pi@raspberrypi:~ $ sudo ./MySensors/examples_linux/mysGateway -d mysGateway: Starting gateway... mysGateway: Protocol version - 2.0.1-beta mysGateway: MCO:BGN:INIT GW,CP=RNNG--Q,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: TSM:READY:NWD REQ mysGateway: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: mysGateway: TSF:SRT:OKBased on this it seem to all be ok on the Raspberry Pi side.. So I uploaded the "MockMySensors" sketch to my Arduino Uno with NRF24 connected. Below is the code and failure message I get from the Arduino. Do I need to set a gateway address or something?
Starting sensor (RNNNA-, 2.0.0) TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=254) TSM:FPAR TSP:MSG:SEND 254-254-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 254-254-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 254-254-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 254-254-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``` -
Seems I'm closing in to working solution. I didn't understand how to use the ./configure element before now. However I ended up with these configurations
pi@raspberrypi:~ $ ./MySensors/configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway --my-radio=nrf24 --my-rf24-irq-pin=15 [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. make: *** No rule to make target 'clean'. Stop. [OK] Finished. pi@raspberrypi:~ $ sudo ./MySensors/examples_linux/mysGateway -d mysGateway: Starting gateway... mysGateway: Protocol version - 2.0.1-beta mysGateway: MCO:BGN:INIT GW,CP=RNNG--Q,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: TSM:READY:NWD REQ mysGateway: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK: mysGateway: TSF:SRT:OKBased on this it seem to all be ok on the Raspberry Pi side.. So I uploaded the "MockMySensors" sketch to my Arduino Uno with NRF24 connected. Below is the code and failure message I get from the Arduino. Do I need to set a gateway address or something?
Starting sensor (RNNNA-, 2.0.0) TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=254) TSM:FPAR TSP:MSG:SEND 254-254-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 254-254-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 254-254-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 254-254-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```@Christian-Simonsen you need to be within the MySensors folders to execute commands configure and make.
I recommend you to test that everything is working before using the option --my-rf24-irq-pin=15Like this:
cd MySensors ./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway --my-radio=nrf24 make sudo ./examples_linux/mysGateway -d -
Thanks for adding signing.
I want to use my rPi to generate random soft serials for my sensors.
Could all three "gen" commands output the line to put in SecurityPersonalizer.ino like it does when using the "set" commands? -
@Christian-Simonsen you need to be within the MySensors folders to execute commands configure and make.
I recommend you to test that everything is working before using the option --my-rf24-irq-pin=15Like this:
cd MySensors ./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway --my-radio=nrf24 make sudo ./examples_linux/mysGateway -d@marceloaqno said:
cd MySensors
./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway --myThanks for letting me know, didn't know that not running it from the specific folder would have an impact.
I reconfigured it as you recommended. and restarted the gateway, with the result below.
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 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,14!=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 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,14!=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!=7What is the best way to test if the gateway work? What sketch should I use on the arduino? and how do I see in Terminal that the mysGateway receive the transfer successfully?
-
very interesting data...
journalctl -u mysgateway --since 13:15 | grep MSG:READ
Oct 21 13:16:30 pi mysGateway[30406]: TSF:MSG:READ,3-3-0,s=3,c=1,t=23,pt=2,l=2,sg=0:97 Oct 21 13:16:30 pi mysGateway[30406]: TSF:MSG:READ,3-3-0,s=4,c=1,t=23,pt=2,l=2,sg=0:6 Oct 21 13:16:30 pi mysGateway[30406]: TSF:MSG:READ,3-10-0,s=3,c=1,t=23,pt=2,l=2,sg=0:97 Oct 21 13:16:30 pi mysGateway[30406]: TSF:MSG:READ,3-10-0,s=0,c=1,t=0,pt=7,l=5,sg=0:24.6 Oct 21 13:16:30 pi mysGateway[30406]: TSF:MSG:READ,3-10-0,s=4,c=1,t=23,pt=2,l=2,sg=0:6 Oct 21 13:16:30 pi mysGateway[30406]: TSF:MSG:READ,3-10-0,s=3,c=1,t=23,pt=2,l=2,sg=0:97 Oct 21 13:16:30 pi mysGateway[30406]: TSF:MSG:READ,3-3-0,s=0,c=1,t=0,pt=7,l=5,sg=0:12.7 Oct 21 13:16:31 pi mysGateway[30406]: TSF:MSG:READ,3-10-0,s=0,c=1,t=0,pt=7,l=5,sg=0:12.7 Oct 21 13:16:31 pi mysGateway[30406]: TSF:MSG:READ,3-10-0,s=4,c=1,t=23,pt=2,l=2,sg=0:6 Oct 21 13:17:17 pi mysGateway[30406]: TSF:MSG:READ,2-2-0,s=251,c=1,t=0,pt=7,l=5,sg=0:24.5 Oct 21 13:17:17 pi mysGateway[30406]: TSF:MSG:READ,2-2-0,s=167,c=1,t=0,pt=7,l=5,sg=0:24.6 Oct 21 13:17:18 pi mysGateway[30406]: TSF:MSG:READ,2-10-0,s=251,c=1,t=0,pt=7,l=5,sg=0:24.5 Oct 21 13:17:18 pi mysGateway[30406]: TSF:MSG:READ,3-10-0,s=0,c=1,t=0,pt=7,l=5,sg=0:12.7 Oct 21 13:17:18 pi mysGateway[30406]: TSF:MSG:READ,2-10-0,s=167,c=1,t=0,pt=7,l=5,sg=0:24.6 Oct 21 13:17:18 pi mysGateway[30406]: TSF:MSG:READ,2-10-0,s=251,c=1,t=0,pt=7,l=5,sg=0:24.5 Oct 21 13:17:19 pi mysGateway[30406]: TSF:MSG:READ,10-10-0,s=12,c=1,t=0,pt=7,l=5,sg=0:34 Oct 21 13:17:19 pi mysGateway[30406]: TSF:MSG:READ,10-10-0,s=14,c=1,t=0,pt=7,l=5,sg=0:24node 2
sensor 167 - dht18b20 indoor
sensor 251 - dht18b20 indoornode 3
sensor 0 - dht18b20 outdoor
sensor 3 - light (0..100)
sensor 4 - light (0..100)questions:
why node 2 and node 3 send messages directly and via node 10?24.6 - is actual value from 2/251, but gateway receive this value from 3/0 How is it possible?
Oct 21 13:16:30 pi mysGateway[30406]: TSF:MSG:READ,3-10-0,s=0,c=1,t=0,pt=7,l=5,sg=0:24.6 -
Hi,
Is there anyone here that can give me some one-to-one support this evening to setup the Raspberry Pi + NRF24L01 as a gateway with MyController, and a Arduino Uno + NRF24L01 as Sensor node. I'm stuck after trying various things over the past week, so looks like I need some additional skills/knowledge to get the first setup working.
Maybe we can use Skype or some other medium. I will gladly pay a bit for this support if anyone is interested. I have some free time from 18:00 CET - 23:30 CET today...