Is it a good idea to use a Pi 3 as Gateway and Pi zero W as nodes ?
I have a small domotic installation at home with Pi3 as controller and some Arduinos that receive commands by RF 433 or BLE. As I did the communication part myself, Domoticz doesn't know the exact state of my components since it can only send commands to them.
While I was searching a way to improve communication, I found MySensors and it sounds great so I want to give it a try !
I first have to choose between the communications hardware, in my case it would be RFM69 (433) or Wifi.
Looking at the price of a RFM69 board (5.7€ with shipping) and the fact that I would need an arduino to control it (a bad copy would be arround 5€ I guess), I'm wondering if it's not better to buy a Pi Zero W with built-in Wifi to create the node.
I'm not sure if it's easy to get the state of a relay or a sensor with a Pi as it is with an Arduino, so I'm asking for advice if someone has already done that
I have an other question : while reading the docs for installing the Gateway, you have to set a gateway type (ex: ethernet - same as wifi I guess) and a transport protocol (rfm69).
I don't really understand this, if I choose an ethernet Gateway, shouldn't it communicate with nodes using WiFi ? Is it mandatory to have a Radio component for communication ?
Thanks for the advices
The USB, ethernet or mqtt are interfaces for communication with controller, they don't talk to each other over wifi. If you want to use wifi, just get a bunch of esp8266 but you will most likely need to power it with a 5v supply. If you go with standard arduino pro mini and a rfm69 or nrf24 you could have the nodes battery powered. It's all up to your needs.
Ok that makes sense there is a communication type between the gateway and controller, and another one between the gateway and the nodes if I understand correctly.
I guess my Pi 3 would be the Gateway, but also run the Controller (Domoticz) and it could communicate with the controller and the nodes using WiFi !
Thanks for the help
That is the setup most people have. If you want to use esp8266 nodes, you need to use the esp8266 ethernet/mqtt gateway sketch, comment out the define for the nrf24 or rfm69 radio and add the code as it was a normal mysensors node. In domoticz you will need to add each esp8266 as mysensors gateway with its ip address or mqtt topic
I agree with @gohan if you go for wifi, use esp8266.
You can also save yourself a lot of trouble by going for Sonoff devices including the ESP8266, they are extremely cheap (starting at around 5$ for the basic version with 1 relay) and include everything: esp8266, power supply, relay, ...
They can also be reprogrammed easily, you can just solder some headers for the first programming, then use OTA.
The only drawback of sonoff switches is they aren't easily expandable as you would need to solder thin wires in some places on the pcb or directly on esp8266 chip. For basic relay they work just fine.
So If all my nodes use esp8266 and are declared as gateway, I don't have to make my raspberry work as a gateway right ? So I only need to install MySensors lib for my Arduinos sketchs.
@Nca78 I didn't know about Sonoff, it could replace my whole relay installation of arduinos
I'll look into it!
I'm gonna do some research about MQTT aswell, because it means nothing to me
If your network is only based on wifi, you don't need mysensors gateway on raspberry.
If you plan to go only the esp8266 way, you may have a look at the espeasy project (also for the esp-based sonoff-devices).
BUT: The big advantage of MySensors - especially when using serial gateways - is: You don't have the need for additional infrastructure as LAN or regular WiFi-Network. Additionally, the wifi data is stored on the ESP-chips, so in case you change your WiFi password, you will also have to reflash all ESPs (at least to my understanding).
Then: Using only "real" linux machines as you originally intended by using the zero Ws means also, you will have to take care about regular updates on all these devices to keep them secure. Using arduino devices is different: once the firmware is working, you will only have to make updates when there are significant changes in transmission protocols. At least until now, you can use "old" nRF-nodes programmed with mysensors Version 1.5.4 (or even older) alongside with GW's using the most recent code version.
So also these "old-fashioned" Arduinos have their (big) advantages. Imo changing from Arduino to "modern" devices is not the best idea. My personal preference would be to include old Arduino-based hardware using RS485 (2 wires) over rfm69 (@868MHz) to nrf24. The RS485 and nRF24 modules are pretty cheap, I bought my last ones at around 3.50 to 5 Euro per 10 pieces... (OK, nRF are often fakes, this is why rfm69 might be the better choice, but once the nRF-nodes work, you also don't have to worry about them any more).
@rejoe2 I've read many discussions about choosing between nRF24 and RFM69, and all the people agreed that the range of nRF24 was really bad.
I haven't tested it myself, but I'm using that kind of things :
And the range is really bad, I can't communicate from one side of my apartment to the other (even with self made antennas! - 2 walls to pass and about 12m).
I'm buying a house, the place will be bigger and there will be a second floor, so I want to invest in something working at longer range
For what I've read, I like the idea of MQTT Broker and the use of Node Red with Domiticz to handle the sensors. But I'm still open the the RF way for small cost sensors... Since my Wifi sensors won't need a gateway, I can still use my Pi as a RF gateway and use both networks if I need !
Someone should create a Doc page with the pro and cons of each communication method, like in this topic, it could help people like me trying to choose the right things
@pouniok My personal experience with nRF24 isn't bad. I used a pa+na-Version for the GW and a Repeater Node 2 floors downstairs to cover my hole house, both together with an adopter plate @70ct.
The receiver in your picture is known to be some of the worst rf-hw ever sold, so no wonder, this doesn't really work (sender is ok). Better use RXB12 (or similar), they are really good receivers and available on ebay for 4 Euro/5 pieces, if you like to stay at 433 (which imo is a bad rf-band to use, it's too noisy).
With MQTT, I have no experience, but imo, this only is usefull, if you have also to integrate other HW that natively "speaks" MQTT or want to make some parts available over internet. Otherwise, it just doubles data handling to controller (this is at least the case when using FHEM as controller) and may cause some delay (and a lot more possible points of failure). For me, this is more or less a no-go, I like to keep things as simple as can...
@rejoe2 I ordered better receivers and it's night and day. Now I can control things between walls without problem, so I'll stick with the RF network and gateway
NRF24 and RFM69 also offer higher security level than normal RF
@pouniok Thx for updating on this.
But nevertheless, I also would recommend to use a different Type of RF (ob even better: RS485, if you have at least 2 wires of any type where you want to place your nodes ).
I'm using RF 433 Mhz because most of the commercial RF power outlet are at this frequency. It allows me to control my lights without creating relays.
But I'm planning to use 868 Mhz for the roller shutter, but still hasn't found a suitable library to handle it with the Pi and Domoticz
@pouniok Controlling commercial Outlets is just one possible application within MySensors. @gohan and me are more talking about the communication between a MySensors-GW and MySensors-Nodes.
To use RF@868 you needn't much more than RFM69-Modules and the MySensors lib. For controlling Roller-Shutters there exists a working example at openhardware.io from @scalz . (Also with hw-design).
@pouniok just hope you don't have any neighbour that likes to tinker with home automation in RF devices or you could face the issue of having things turning on and off out of your control