How to control 350+ devices...Zigbee? Wifi? BLE? Magic? - Page 1
Forum section: electronics / rf-microwave

author: JamesG-J
author_rank: Contributor
timestamp: March 12, 2020, 06:12:17 am
content: Hello!I'm helping a friend automate his vertical farm which has 120 independent grow beds. Each of these requires control of 2 independent lights and a fan and he's currently using the switches on a bunch of power bars to control them manually. He's tried automating part of it with wifi smart plugs but has had issues with disconnections as well as the future issue of scalability (once his router runs out of IP addresses he'll be stuck, or maybe have to buy a fancier router?). Another issue is that integrating them with any sort of custom control software requires IFTTT which requires access to the internet so they can't be used on just the local network if his internet goes down.Zigbee seems like a great solution as the Zigbee Alliance website claims that you can run an unlimited number of devices using their protocol with mesh networking, and it's all local. The issue is that off-the-shelf Zigbee smart outlets are harder to find and tend to be more expensive than wifi plugs.One solution is for me to build him some power bars that use one Zigbee module (the expensive part) and a bunch of cheap relays, etc. to reduce the overall cost per outlet - there seems to be 15 IO pins per Zigbee module, so in theory I could control 15 outlets per RF module which would actually be a decent price per outlet.Although this sounds like a fun project, he would prefer to buy off-the-shelf products, so...1 - Is there an easy and reliable way to continue using wifi plugs in large numbers?2 - Are there other types of RF modules I could use that would have off-the-shelf products for controlling mains powered devices? (BLE seems like an option but I've had plenty of issues with bluetooth pairing in my life and having to deal with constantly pairing 350+ devices sounds like a truly horrific nightmare)3 - If I do have to build my own, is Zigbee really the best way to go?Excited to hear any ideas you may have!

author: ataradov
author_rank: Super Contributor
timestamp: March 12, 2020, 07:01:19 am
content: ZigBee has inherent limit of 65K devices. It uses 16-bit network addresses. So it is unlimited in the same way cell plans are "unlimited".But the issue is that things start to fall apart much-much sooner. 350 devices with ZigBee is almost impossible. If you make most of them sleeping waking up once an hour, it might somewhat work. But not if they all are routers. Your network will drown in mandatory service traffic.What sort of network configuration you want to get? Given that you consider Wi-Fi, is it all a direct line of sight link? How often you need to send messages?

author: martin1454
author_rank: Regular Contributor
timestamp: March 12, 2020, 07:16:03 am
content: I would go for a hubitat + zigbee wall plugs - Then you can control it in any way you want, and build apps for it.

author: ataradov
author_rank: Super Contributor
timestamp: March 12, 2020, 07:18:20 am
content: 350 ZigBee wall plugs will not work reliably in the same network.

author: Kalvin
author_rank: Super Contributor
timestamp: March 12, 2020, 03:30:33 pm
content: Instead of using a single, large WIFI network subnet address space, you could organize the devices into groups of N devices in one group, and each group would have a separate WIFI subnet address space. Then, you would need one router device for each subnet (ie. one router for N devices), but you won't run out of router capacity any time soon. The system should scale up pretty nicely. The nodes could be simple ESP32 or similar inexpensive readily available devices which are able to control relays quite easily. Connecting the routers (ie. backbone) may require wired Ethernet cabling for improved reliability, should you have issues with signal quality.

author: JamesG-J
author_rank: Contributor
timestamp: March 12, 2020, 07:27:16 pm
content: Great idea, Kalvin!I'll look into subnets now, seems like a great way to manage this system!

author: TK
author_rank: Super Contributor
timestamp: March 12, 2020, 07:43:33 pm
content: If you need basic communication, try RFM69HCW modules from HOPERF. You control them through SPI and it requires very small code. They can work in packet mode, where you can define NETWORKS and NODES within these networks. The master can poll each remote slave node and receive sensor data and send control commands. You can have multiple networks with one master on each network. You can use a small microcontroller to control these modules, I tested them with AVR 1-Series, TI MSP430 (low power), STM32, etc. There is a nice Arduino library (https://github.com/LowPowerLab/RFM69)that can be used as a normal C++ library if you are not using Arduino.

author: Ian.M
author_rank: Super Contributor
timestamp: March 12, 2020, 09:16:01 pm
content: The whole problem is that you are trying to do effectively industrial process control with crappy consumer products. All the lights and fans should be wired back to SSR modules in a number of power distribution cabinets. Each distribution cabinet needs enough local processing to control its bank of SSRs and probably to monitor the environmental condition sensors for its grow beds. If you want to use exclusively off-the-shelf hardware and code, you are probably looking at a PLC controller in each cabinet. Each should be capable of running autonomously, but be connected to a wired Ethernet (or possibly MODBUS over RS-485 cabling) network for supervision and control from a dedicated central PC, and also to be able to push out programming updates to them from the same PC. It could probably be done somewhat cheaper with one master PLC and remote RS-485 controlled I/O expanders in each distribution cabinet, or even with a PC as the master instead of a PLC, but that gives you a single point of failure for the whole farm.If you are a cheap-skate and want to roll your own code, you could replace the PLCs with an Arduino Mega 2560 + a screw terminal breakout shield for it in each cabinet. A RS-485 interface module would allow remote control and monitoring from a central PC or SBC, and if you flashed the Megas with custom addressable bootloaders, would also permit remote firmware updates.Although they are far less common in North America, it may be worth looking at using DIN rail cabinets, SSRs and circuit breakers. If you go down the Arduino Mega road, you can even get high reliability DIN rail mount 12V PSUs.IMHO wireless is a bad idea for reliability reasons, and it also makes scalability and remote program updates more difficult. It only really makes sense for applications where the cost of running twisted pair cabling is prohibitive or stuff is getting moved around so frequently that its impractical to maintain a wired connection.

author: TheMG
author_rank: Frequent Contributor
timestamp: March 13, 2020, 02:29:36 am
content: I agree with the above. This is the type of thing that industrial control devices would be ideally suited for. It doesn't even need to be complex with a full blown PLC or anything, there's a myriad of relay modules out there with various interfaces such as ethernet, RS232/422, MODBUS, etc, and they are available with a variety of different channel configurations (anywhere from 1 to as many as 32 relay outputs per module).Just a random example of such a device from a quick Google search:https://www.online-devices.com/product-631-32_Channel_Ethernet_5Amp_Relay_Board_Controller,_TCPIP_Web_controlled_Relay_board.aspxI'm sure you could find something less expensive, this is just to give an idea. But even at that price... how much do 32 individual zigbee or wifi controlled outlets cost?

author: Tom45
author_rank: Frequent Contributor
timestamp: March 13, 2020, 03:37:09 am
content: As this sounds like a business rather than a hobby project, I would go along with the PLC recommendations. Take a look at the entry level PLCs from Automation Direct.

author: Habropoda
author_rank: Regular Contributor
timestamp: March 13, 2020, 04:52:20 am
content: It's quite a kludge but the Sonoff 4chr2 four channel switch might work. At least you could fit them on one network. The pro version of that has 433MHZ remote as well.You could also hack it with the Tasmota firmware for custom control or just use Alexa with stock lol.I only hacked a couple of Sonoff plugs with Tasmota. It worked very well but I have no experience with the 4chr2. It won't compare with an industrial setup.

author: JDubU
author_rank: Frequent Contributor
timestamp: March 13, 2020, 05:34:54 am
content: DMX-512, commonly used for theatrical lighting, might be another possibility.