So i just bought a Raspberry Pi 2 and so far i have gotten to the point in this tutorial where i have set up wireless access to my Pi. I stopped following the tutorial here because it seems like it wants me to set up a script that listens for RF24 signals nonstop and picks them up and publishes them. The problem is that the given script runs constantly and only receives on the Pi side and sends on the arduino side. Whereas i need to do both on both sides. And if its constantly running, will my Pi be blocked from doing other things like sending/receiver to/from Z-wave devices when i eventually add those into the mix?
I have a set of WS2812B LED strips (RGB individually addressable) which i can easily control using arduino using the FastLED library. This is my goal:
Connect an nRF24L0+ to my arduino and my Raspberry Pi
Receive instructions from OpenHab running on Pi to do the following:
- Turn LEDs on/off
- Change color using color picker
- Start a scripted pattern thats coded onto the arduino.
Send the following data back to the Raspberry Pi:
- Current on/off status
- current color or pattern running
OpenHab (Pi) Side:
Send following data to arduino:
- Tell it to turn on/off
- Tell if which color to change to
- Tell it which pattern to start running
Receive from arduino:
- Current on/off status
- color or pattern currently running
So as you can see both the Pi and Arduino need to be able to send and receive a variety of messages.
This shouldn’t be too hard to code on the arduino side but i am not sure how i should go about receiving the data and how often i should send it. Processing the data to control the lights should be easy.
How do i ensure that the message i am receiving is from OpenHab instead of another potential RF transceiver?
What library should i use for sending MQTT messages over the nRF24L0+ on my Arduino to OpenHab?
As for the OpenHab side, i have a lot of questions:
Which hardware should i use for picking up these signals from the arduino?
How do make it possible to send/receive only when there is data to be sent or received?
Is MQTT the best way to set this up?
What library should i use for sending MQTT messages over the nRF24L0+ on my Pi to arduino?
EDIT: It seems some people use an entire arduino to pick up the RF signals from the other arduinos, then this arduino sends the MQTT data over to OpenHab (either over Serial USB or Ethernet). Is this the best solution? Can’t the Pi access the nRF24L0+ directly? or is it a better idea to have this transceiver arduino as a gateway to the Pi?