💬 Building a Orange Pi Gateway
-
FYI i configure like this:
./configure --spi-spidev-device=/dev/spidev0.0 --my-transport=nrf24 --my-rf24-ce-pin=2 --my-rf24-cs-pin=67 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSB10 --my-serial-baudrate=115200 -
NOTE for Armbian and Orange Pi Zero.
Set static IP address or the device will lose connection on next DHCP request. I use only the LAN and was having problems for few days.
-
Hi,
You should set your gateway as a ethernet / network gateway. By default, it run on port 5003 (ex : [gwipadresse]:5003.
If you controler is hosted on the same machine that the gateway, then you can call the ip adresse : 127.0.0.1:5003. (the localhost adress) whatever the real IP adresse of your PI.
if you got a good router on u'r network, that it running DHCP server and give IP adresses of your devices on the network, then you can define static IP adresse for the MAC adresse of your PI.Regards.
-
I had to use spidev0.0 and not spidev1.0:
+++
opilite@orangepilite:~/MySensors$ sudo ./bin/mysgw -d
mysgw: Starting gateway...
mysgw: Protocol version - 2.2.0-beta
mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0-beta
mysgw: TSF:LRT:OK
mysgw: TSM:INIT
mysgw: TSF:WUR:MS=0
mysgw: TSM:INIT:TSP OK
mysgw: TSM:INIT:GW MODE
mysgw: TSM:READY:ID=0,PAR=0,DIS=0
mysgw: MCO:REG:NOT NEEDED
mysgw: MCO:BGN:STP
mysgw: MCO:BGN:INIT OK,TSP=1
+++
opilite@orangepilite:~/MySensors$ ./configure --spi-spidev-device=/dev/spidev0.0 --my-transport=nrf24 --my-rf24-ce-pin=2 --my-rf24-cs-pin=67 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway -
With mqtt gateway I got further ahead:
+++
opilite@orangepilite:~/MySensors$ ./configure --spi-spidev-device=/dev/spidev0.0 --my-transport=nrf24 --my-rf24-ce-pin=2 --my-rf24-cs-pin=67 --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=my_mqtt_gateway
+++
opilite@orangepilite:~/MySensors$ sudo ./bin/mysgw -d
mysgw: Starting gateway...
mysgw: Protocol version - 2.2.0-beta
mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0-beta
mysgw: TSF:LRT:OK
mysgw: TSM:INIT
mysgw: TSF:WUR:MS=0
mysgw: TSM:INIT:TSP OK
mysgw: TSM:INIT:GW MODE
mysgw: TSM:READY:ID=0,PAR=0,DIS=0
mysgw: MCO:REG:NOT NEEDED
mysgw: MCO:BGN:STP
mysgw: MCO:BGN:INIT OK,TSP=1
mysgw: Attempting MQTT connection...
mysgw: connected to 127.0.0.1
mysgw: MQTT connected
mysgw: Sending message on topic: mysensors-out/0/255/0/0/18
+++
mysensors-out/0/255/0/0/18 : msg.payload : string[10]
"2.2.0-beta" -
Ok, now I load a sketch into an arduino nanowith nrf24l01+ and this is all I got:
+++
opilite@orangepilite:~/MySensors$ sudo ./bin/mysgw -d
mysgw: Starting gateway...
mysgw: Protocol version - 2.2.0-beta
mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0-beta
mysgw: TSF:LRT:OK
mysgw: TSM:INIT
mysgw: TSF:WUR:MS=0
mysgw: TSM:INIT:TSP OK
mysgw: TSM:INIT:GW MODE
mysgw: TSM:READY:ID=0,PAR=0,DIS=0
mysgw: MCO:REG:NOT NEEDED
mysgw: MCO:BGN:STP
mysgw: MCO:BGN:INIT OK,TSP=1
mysgw: Attempting MQTT connection...
mysgw: connected to 127.0.0.1
mysgw: MQTT connected
mysgw: Sending message on topic: mysensors-out/0/255/0/0/18
mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=255
mysgw: TSF:CKU:OK,FCTRL
mysgw: TSF:MSG:GWL OK
mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=255
mysgw: TSF:PNG:SEND,TO=0
mysgw: TSF:CKU:OK
mysgw: TSF:MSG:GWL OK
(...)
+++Stuck again.
-
Ok, now I load a sketch into an arduino nanowith nrf24l01+ and this is all I got:
+++
opilite@orangepilite:~/MySensors$ sudo ./bin/mysgw -d
mysgw: Starting gateway...
mysgw: Protocol version - 2.2.0-beta
mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0-beta
mysgw: TSF:LRT:OK
mysgw: TSM:INIT
mysgw: TSF:WUR:MS=0
mysgw: TSM:INIT:TSP OK
mysgw: TSM:INIT:GW MODE
mysgw: TSM:READY:ID=0,PAR=0,DIS=0
mysgw: MCO:REG:NOT NEEDED
mysgw: MCO:BGN:STP
mysgw: MCO:BGN:INIT OK,TSP=1
mysgw: Attempting MQTT connection...
mysgw: connected to 127.0.0.1
mysgw: MQTT connected
mysgw: Sending message on topic: mysensors-out/0/255/0/0/18
mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=255
mysgw: TSF:CKU:OK,FCTRL
mysgw: TSF:MSG:GWL OK
mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
mysgw: TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
mysgw: Sending message on topic: mysensors-out/255/255/3/0/3
mysgw: TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=255
mysgw: TSF:PNG:SEND,TO=0
mysgw: TSF:CKU:OK
mysgw: TSF:MSG:GWL OK
(...)
+++Stuck again.
-
Am getting this error:
ERROR Could not open /sys/class/gpio/gpio24/direction
My config is:./configure --spi-spidev-device=/dev/spidev1.0 --my-node-id=1 --my-transport=rfm95 --my-rfm95-cs-pin=13 --my-rfm95-irq-pin=10 --my-rfm69-frequency=915E6Whole output is:
root@ttn-gateway:~/MySensors# sudo ./bin/mysgw May 23 09:37:31 INFO Starting gateway... May 23 09:37:31 INFO Protocol version - 2.3.0-alpha __ __ ____ | \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___ | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __| | | | | |_| |___| | __/ | | \__ \ _ | | \__ \ |_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/ |___/ 2.3.0-alpha May 23 09:37:31 DEBUG MCO:BGN:INIT NODE,CP=RLNNL---,VER=2.3.0-alpha May 23 09:37:31 DEBUG TSM:INIT May 23 09:37:31 DEBUG TSF:WUR:MS=0 May 23 09:37:42 ERROR Could not open /sys/class/gpio/gpio24/direction -
Am getting this error:
ERROR Could not open /sys/class/gpio/gpio24/direction
My config is:./configure --spi-spidev-device=/dev/spidev1.0 --my-node-id=1 --my-transport=rfm95 --my-rfm95-cs-pin=13 --my-rfm95-irq-pin=10 --my-rfm69-frequency=915E6Whole output is:
root@ttn-gateway:~/MySensors# sudo ./bin/mysgw May 23 09:37:31 INFO Starting gateway... May 23 09:37:31 INFO Protocol version - 2.3.0-alpha __ __ ____ | \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___ | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __| | | | | |_| |___| | __/ | | \__ \ _ | | \__ \ |_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/ |___/ 2.3.0-alpha May 23 09:37:31 DEBUG MCO:BGN:INIT NODE,CP=RLNNL---,VER=2.3.0-alpha May 23 09:37:31 DEBUG TSM:INIT May 23 09:37:31 DEBUG TSF:WUR:MS=0 May 23 09:37:42 ERROR Could not open /sys/class/gpio/gpio24/direction -
- Does /sys/class/gpio/gpio24/direction exists?
- Does /sys/class/gpio/gpio24 exists?
- Can you write to them using echo?
@pansen No.... nothing...
/sys/class/gpio/gpio24doesn't exist.
even "echo "24" > /sys/class/gpio/exportdoesn't work.
But, yes otherwise if I try the same with 13 i.e "echo "13" > /sys/class/gpio/exportThen a directory is created and then/sys/class/gpio/gpio24/directiondo exist. -
- Does /sys/class/gpio/gpio24/direction exists?
- Does /sys/class/gpio/gpio24 exists?
- Can you write to them using echo?
@pansen Thank you sooooooo much for your reply.!!! By the way, What I actually have to do is "Make an MQTT based LoRa(RA-02) receiver gateway on OrangePi Zero". And I'm stuck since whole week :'( of course spent time trying code without solid base. :/
Yes, yet I'm trying to first set up a LoRa receiver(not MQTT, not gateway) -
@pii --my-rfm95-cs-pin and --my-rfm95-irq-pin options are not currently supported by the configure script.
Until we fix this, could you please try adding the following to your examples_linux/mysgw.cpp (before the #include <MySensors.h>)#define MY_RFM95_CS_PIN 13 #define MY_RFM95_IRQ_PIN 10 #define MY_RFM95_FREQUENCY RFM95_915MHZand run the make command again.
-
@pii --my-rfm95-cs-pin and --my-rfm95-irq-pin options are not currently supported by the configure script.
Until we fix this, could you please try adding the following to your examples_linux/mysgw.cpp (before the #include <MySensors.h>)#define MY_RFM95_CS_PIN 13 #define MY_RFM95_IRQ_PIN 10 #define MY_RFM95_FREQUENCY RFM95_915MHZand run the make command again.
@marceloaqno said in 💬 Building a Orange Pi Gateway:
#define MY_RFM95_CS_PIN 13
#define MY_RFM95_IRQ_PIN 10
#define MY_RFM95_FREQUENCY RFM95_915MHZThank you sooo much. I just did this. But, Now got a new error.
ERROR Could not open /sys/class/gpio/gpio10/directionand when I tried to export pin 10 it says:
:/sys/class/gpio# echo '10' > export -bash: echo: write error: Device or resource busyThough yes still I'm able to export/unexport pin 13(just for testing)
-
@marceloaqno said in 💬 Building a Orange Pi Gateway:
#define MY_RFM95_CS_PIN 13
#define MY_RFM95_IRQ_PIN 10
#define MY_RFM95_FREQUENCY RFM95_915MHZThank you sooo much. I just did this. But, Now got a new error.
ERROR Could not open /sys/class/gpio/gpio10/directionand when I tried to export pin 10 it says:
:/sys/class/gpio# echo '10' > export -bash: echo: write error: Device or resource busyThough yes still I'm able to export/unexport pin 13(just for testing)
@pii Try to connect the IRQ pin from the radio to another GPIO on your Orange Pi, for example the GPIO2.
#define MY_RFM95_IRQ_PIN 2 -
There is an issue now with spi interfaces. With the current armbian image we are stuck at the prepare the system part, no /dev/spidev* available, the old method does not work. (There is no /boot/script.bin file, for example.) Does anyone know the solution, could this guide be updated, please?
-