Thanks for your valuable input. I think I got some direction to move on.
Posts made by rajeev2301
-
RE: Raspberry Pi3 Gateway
-
RE: Raspberry Pi3 Gateway
Thanks , really appreciate your quick response. Yes , I am aware of TCP but isn’t that it needs an Internet for communication.My plan is to exchange data between sensors wirelessly using radio frequency ( e.g, NRF24L01) so that I don’t have dependency on TCP/Internet. Also, my plan is to create a master-slave kind of setup. Where all sensor’s data really into central raspberry pi environment and then I can play around with dataset from multiple sources.
Your guidance would be highly appreciated. -
RE: Raspberry Pi3 Gateway
Thanks , I really appreciate your time for helping me out on this. I have recently started diggging into IOT world so I may be asking a trivial question. ( my apology and Thanks in advance
I have a following scenario:
I am trying to pull the temperature and humidity data from Arduino Nano and then transmitting it through NRF24L01 transreceivers. It works perfectly fine between arduino to Arduino Communication. However I am stuck when I am trying to receive the same information into my Raspeberry Pi3.
I believe , I have successfully setup a gateway by following step by step instruction (https://www.mysensors.org/build/raspberry) but now I want to receive the message relaying through my Arduino Nano for which I need to write a code in Raspberry Pi. That’s the reason I am writing a simple python code to receive that message. Please suggest if there are alternate way to receive the message from my arduino’s.Thanks again for your kind guidance.
-
RE: Raspberry Pi3 Gateway
- What is your recommendation for doing general programming on raspeberry Pi?
- if not python , what code/programming language do you recommend to setup a serial gateway on raspberry pi so that I can receive messages from multiple arduino,s.
-
RE: 💬 Building a Raspberry Pi Gateway
@macvictor
I followed all the step that you mentioned in your post to establish the serial gateway. However I am still not able to receive the message from arduino. Could you please what to do?import RPi.GPIO as GPIO
from lib_nrf24 import NRF24
import time
import spidevGPIO.setmode(GPIO.BCM)
pipes = [[0xE8, 0xE8, 0xF0, 0xF0, 0xE1], [0xF0, 0xF0, 0xF0, 0xF0, 0xE1]]
radio = NRF24(GPIO, spidev.SpiDev())radio.begin(0,8)
radio.setPayloadSize(32)
radio.setChannel(0x76)
radio.setDataRate(NRF24.BR_1MBPS)
radio.setPALevel (NRF24.PA_MAX)
radio.setAutoAck(True)
radio.enableDynamicPayloads()
radio.enableAckPayload()
radio.openReadingPipe(1 ,pipes[1])
radio.printDetails()
radio.startListening()
radio.GPIO.cleanup()Please find below my raspberry code..can you please suggest , if there is any issue with code or am I missing anything ?
-
RE: Raspberry Pi3 Gateway
@mfalkvidd Thanks a lot ! I followed the exact process at https://www.mysensors.org/build/raspberry.It looks like I have the required environment setup correctly. But when I run the below code , I still don't receive the correct message comming from Arduino ( I am using NRFL01 transceivers) .. Please suggest what am I missing..
mport RPi.GPIO as GPIO
from lib_nrf24 import NRF24
import time
import spidevGPIO.setmode(GPIO.BCM)
pipes = [[0xE8, 0xE8, 0xF0, 0xF0, 0xE1], [0xF0, 0xF0, 0xF0, 0xF0, 0xE1]]
radio = NRF24(GPIO, spidev.SpiDev())radio.begin(0,8)
radio.setPayloadSize(32)
radio.setChannel(0x76)
radio.setDataRate(NRF24.BR_1MBPS)
radio.setPALevel (NRF24.PA_MAX)
radio.setAutoAck(True)
radio.enableDynamicPayloads()
radio.enableAckPayload()
radio.openReadingPipe(1 ,pipes[1])
radio.printDetails()
radio.startListening()
radio.GPIO.cleanup()while True:
while not radio.available(0): time.sleep(1/100) Temp = [] radio.read(Temp, radio.getDynamicPayloadSize()) print("Received Temp: {}".format(Temp)) print("Translating our received Message into Unicode character...") string1 = "" for n in Temp: if (n >=32 and n <= 126): string1 += chr(n) print (" Our received message decodes to : {} ".format(string1))
===============output =========
STATUS = 0x01 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=1
RX_ADDR_P0-1 � =
0x001effffff 0xffffffffff
RX_ADDR_P2-5 � =
0xff
0xfe
0xfe
0xfeTX_ADDR =
0xffffffffff
RX_PW_P0-6 � =
0x00
0x00
0x00
0x00
0x00
0x00EN_AA =
0x03EN_RXADDR � =
0x00RF_CH =
0x07RF_SETUP � =
0x00CONFIG =
0x00DYNPD/FEATURE � =
0x00
0x00Data Rate = 1MBPS
Model = nRF24L01
CRC Length = Disabled
PA Power = PA_MIN
Received: [4]
Translating the receivedMessage into unicode characters
Out received message decodes to:
Received: [5]
Translating the receivedMessage into unicode characters
Out received message decodes to:
Received: []
Translating the receivedMessage into unicode characters
Out received message decodes to:
Received: []
Translating the receivedMessage into unicode characters
Out received message decodes to:
Received: []
Translating the receivedMessage into unicode characters
Out received message decodes to:
Received: [] -
RE: Raspberry Pi3 Gateway
[0_1516950236523_config.txt](Uploading 100%) @gohan
Please find the attached config settings.
Sensor version : git clone https://github.com/TMR20/RF24.git<<problem comes here, when I tried installing PiRaspberrySerial========================>>
pi@raspberrypi:~ $ git clone https://github.com/mysensors/Raspberry.git
Cloning into 'Raspberry'...
remote: Counting objects: 292, done.
remote: Total 292 (delta 0), reused 0 (delta 0), pack-reused 292
Receiving objects: 100% (292/292), 220.51 KiB | 0 bytes/s, done.
Resolving deltas: 100% (126/126), done.
pi@raspberrypi:~ $ cd Raspberry
pi@raspberrypi:~/Raspberry $ make all && make install
g++ -c -o MyGateway.o MyGateway.cpp -Wall -Ofast -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -D_TTY_NAME="/dev/ttyMySensorsGateway" -D_TTY_GROUPNAME="tty" -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I. -I/usr/local/include/RF24
MyGateway.cpp: In member function ‘void MyGateway::setInclusionMode(boolean)’:
MyGateway.cpp:234:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (newMode != inclusionMode)
^~
MyGateway.cpp:237:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
serial(PSTR("0;0;%d;0;%d;%d\n"), C_INTERNAL, I_INCLUSION_MODE, inclusionMode?1:0);
^~~~~~
g++ -c -o MySensor.o MySensor.cpp -Wall -Ofast -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -D_TTY_NAME="/dev/ttyMySensorsGateway" -D_TTY_GROUPNAME="tty" -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I. -I/usr/local/include/RF24
g++ -c -o MyMessage.o MyMessage.cpp -Wall -Ofast -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -D_TTY_NAME="/dev/ttyMySensorsGateway" -D_TTY_GROUPNAME="tty" -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I. -I/usr/local/include/RF24
g++ -c -o PiEEPROM.o PiEEPROM.cpp -Wall -Ofast -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -D_TTY_NAME="/dev/ttyMySensorsGateway" -D_TTY_GROUPNAME="tty" -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I. -I/usr/local/include/RF24
g++ -c -o PiGateway.o PiGateway.cpp -Wall -Ofast -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -D_TTY_NAME="/dev/ttyMySensorsGateway" -D_TTY_GROUPNAME="tty" -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I. -I/usr/local/include/RF24
g++ -o PiGateway MyGateway.o MySensor.o MyMessage.o PiEEPROM.o PiGateway.o -Wall -Ofast -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -D_TTY_NAME="/dev/ttyMySensorsGateway" -D_TTY_GROUPNAME="tty" -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I. -I/usr/local/include/RF24 -lrf24-bcm
g++ -c -o PiGatewaySerial.o PiGatewaySerial.cpp -Wall -Ofast -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -D_TTY_NAME="/dev/ttyMySensorsGateway" -D_TTY_GROUPNAME="tty" -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I. -I/usr/local/include/RF24
In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
from /usr/include/c++/6/ios:40,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from ./MyMessage.h:37,
from ./MySensor.h:18,
from ./MyGateway.h:16,
from PiGatewaySerial.cpp:36:
/usr/include/c++/6/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
/usr/include/c++/6/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
In file included from ./MySensor.h:18:0,
from ./MyGateway.h:16,
from PiGatewaySerial.cpp:36:
/usr/include/c++/6/bits/stl_algobase.h:195:5: error: expected unqualified-id before ‘const’
min(const _Tp& __a, const _Tp& __b)
^
/usr/include/c++/6/bits/stl_algobase.h:195:5: error: expected ‘)’ before ‘const’
/usr/include/c++/6/bits/stl_algobase.h:195:5: error: expected initializer before ‘const’
/usr/include/c++/6/bits/stl_algobase.h:219:5: error: expected unqualified-id before ‘const’
max(const _Tp& __a, const _Tp& __b)
^
/usr/include/c++/6/bits/stl_algobase.h:219:5: error: expected ‘)’ before ‘const’
/usr/include/c++/6/bits/stl_algobase.h:219:5: error: expected initializer before ‘const’
In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
from /usr/include/c++/6/ios:40,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from ./MyMessage.h:37,
from ./MySensor.h:18,
from ./MyGateway.h:16,
from PiGatewaySerial.cpp:36:
/usr/include/c++/6/bits/stl_algobase.h:243:5: error: ‘std::min’ declared as an ‘inline’ variable
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^~~
/usr/include/c++/6/bits/stl_algobase.h:246:7: error: expected primary-expression before ‘if’
if (__comp(__b, __a))
^~
/usr/include/c++/6/bits/stl_algobase.h:246:7: error: expected ‘}’ before ‘if’
/usr/include/c++/6/bits/stl_algobase.h:246:7: error: expected ‘;’ before ‘if’
/usr/include/c++/6/bits/stl_algobase.h:248:7: error: expected unqualified-id before ‘return’
return __a;
^~~~~~
/usr/include/c++/6/bits/stl_algobase.h:265:5: error: ‘max’ declared as an ‘inline’ variable
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^~~
/usr/include/c++/6/bits/stl_algobase.h:268:7: error: expected primary-expression before ‘if’
if (__comp(__a, __b))
^~
/usr/include/c++/6/bits/stl_algobase.h:268:7: error: expected ‘}’ before ‘if’
/usr/include/c++/6/bits/stl_algobase.h:268:7: error: expected ‘;’ before ‘if’
/usr/include/c++/6/bits/stl_algobase.h:270:7: error: expected unqualified-id before ‘return’
return __a;
^~~~~~
/usr/include/c++/6/bits/stl_algobase.h:271:5: error: expected declaration before ‘}’ token
}
^
Makefile:61: recipe for target 'PiGatewaySerial.o' failed
make: *** [PiGatewaySerial.o] Error 1 -
RE: Raspberry Pi3 Gateway
I. am using Raspbian which was achieved through NOOBs
-
Raspberry Pi3 Gateway
When I am running command to setup PiGatewaySerial , I get the below error. ![alt text](![image url](image url))
Raspberry $ make all && sudo make install
g++ -c -o PiGatewaySerial.o PiGatewaySerial.cpp -Wall -Ofast -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -D_TTY_NAME="/dev/ttyMySensorsGateway" -D_TTY_GROUPNAME="tty" -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -I. -I/usr/local/include/RF24
In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
from /usr/include/c++/6/ios:40,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from ./MyMessage.h:37,
from ./MySensor.h:18,
from ./MyGateway.h:16,
from PiGatewaySerial.cpp:36:
/usr/include/c++/6/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
/usr/include/c++/6/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
In file included from ./MySensor.h:18:0,
from ./MyGateway.h:16,
from PiGatewaySerial.cpp:36:
/usr/include/c++/6/bits/stl_algobase.h:195:5: error: expected unqualified-id before ‘const’
min(const _Tp& __a, const _Tp& __b)
^
/usr/include/c++/6/bits/stl_algobase.h:195:5: error: expected ‘)’ before ‘const’
/usr/include/c++/6/bits/stl_algobase.h:195:5: error: expected initializer before ‘const’
/usr/include/c++/6/bits/stl_algobase.h:219:5: error: expected unqualified-id before ‘const’
max(const _Tp& __a, const _Tp& __b)
^
/usr/include/c++/6/bits/stl_algobase.h:219:5: error: expected ‘)’ before ‘const’
/usr/include/c++/6/bits/stl_algobase.h:219:5: error: expected initializer before ‘const’
In file included from /usr/include/c++/6/bits/char_traits.h:39:0,
from /usr/include/c++/6/ios:40,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from ./MyMessage.h:37,
from ./MySensor.h:18,
from ./MyGateway.h:16,
from PiGatewaySerial.cpp:36:
/usr/include/c++/6/bits/stl_algobase.h:243:5: error: ‘std::min’ declared as an ‘inline’ variable
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^~~
/usr/include/c++/6/bits/stl_algobase.h:246:7: error: expected primary-expression before ‘if’
if (__comp(__b, __a))
^~
/usr/include/c++/6/bits/stl_algobase.h:246:7: error: expected ‘}’ before ‘if’
/usr/include/c++/6/bits/stl_algobase.h:246:7: error: expected ‘;’ before ‘if’
/usr/include/c++/6/bits/stl_algobase.h:248:7: error: expected unqualified-id before ‘return’
return __a;
^~~~~~
/usr/include/c++/6/bits/stl_algobase.h:265:5: error: ‘max’ declared as an ‘inline’ variable
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^~~
/usr/include/c++/6/bits/stl_algobase.h:268:7: error: expected primary-expression before ‘if’
if (__comp(__a, __b))
^~
/usr/include/c++/6/bits/stl_algobase.h:268:7: error: expected ‘}’ before ‘if’
/usr/include/c++/6/bits/stl_algobase.h:268:7: error: expected ‘;’ before ‘if’
/usr/include/c++/6/bits/stl_algobase.h:270:7: error: expected unqualified-id before ‘return’
return __a;
^~~~~~
/usr/include/c++/6/bits/stl_algobase.h:271:5: error: expected declaration before ‘}’ token
}
^
Makefile:61: recipe for target 'PiGatewaySerial.o' failed
make: *** [PiGatewaySerial.o] Error 1