Complex sys needs lots of I/Os ... as I need help

Hey,

I'm building a smart home system for the entire new house. I plan to use:

  • 1 Arduino per room with the followings:

  • RJ45 shield and webserver

  • no logic implemented here, just handling I/O, calling/receiving HTTP GETs to central server

  • control 12 relays, on some kind of extension board(?)

  • contols 2 led adjustable(?) white stripes

  • 8 phisycal input/switch

  • reading 2 pir, 1 thermo, 1 humidity sensors (latter 2 will read by the central server via interval HTTP req.)

  • I intend to create 7 identical subsys stated above

  • The will be controled by a node.js server, all logic will be there

What is your precious suggestion to achive the Arduino part? There are ethernet relay boards and they are really easy to control (http://.../port[xxx] call switch one relay on or off), but there is no extended input, so I guess it's better to have all managed by the Arduino.

Thanks in advance!

Something like an ESP8266/ESP32 with an I2C I/O expander (or two)
(Using WiFi, not ethernet)

For home automation, a CAN bus is a must to avoid EMI, have a multimaster network with long distance cables.

If you go with an ESP32 and CAN.
The library ESP32CAN, can do background receive/transmits.
Here I break down 2 32 bit numbers into the ESP32 structure

     if (!PassTwo)
        {
          rx_frame.FIR.B.FF = CAN_frame_std;
          rx_frame.MsgID = 1;
          rx_frame.FIR.B.DLC = 8;
          rx_frame.data.u8[0] = *item & 0xFF;
          rx_frame.data.u8[1] = (*item >> 8) & 0xFF;
          rx_frame.data.u8[2] = (*item >> 16) & 0xFF;
          rx_frame.data.u8[3] = (*item >> 24) & 0xFF;
          PassTwo = true;
        } else {
          rx_frame.data.u8[4] = *item & 0xFF;;
          rx_frame.data.u8[5] = (*item >> 8) & 0xFF;
          rx_frame.data.u8[6] = (*item >> 16) & 0xFF;
          rx_frame.data.u8[7] = (*item >> 24) & 0xFF;
          ESP32Can.CANWriteFrame(&rx_frame); // send items over CAN buss
          PassTwo = false;
        }

You'll need transceivers, I use these Amazon.com. Twist the H/L pairs.

Sounds familiar. I used Mega's because in the long run it was a lot less work then using port expanders. I did it on RS485 in a multi master configuration. I chose this because I did not want any access from the outside and it is much more reliable. It is no big problem to add a gateway with another Arduino and an ethernet shield or one of the ESP devices, that gives me total control to the network access. So far the communications is working great. Another advantage of the Mega is the additional serial ports. I used the MAX485 chip and hardwired receive active all the time. This way I monitor what I put on the buss to determine if the message crashed and not burn time waiting for an ACK. The 8 and 4 channel relay boards work great. The software I use works on the Nano and Uno as well utilizing the Software Serial at 19,200 baud it worked the best. I send packets that range from 13 bytes to 260 bytes depending on the command. Hopefully this gives you some ideas.
Good Luck, & Have Fun!
Gil

I would be inclined to use off the shelf ethernet relay modules to simplify things, and use multiple ESP8266 or ESP32 devices per room to provide the rest of the functionality. I suspect you will inevitably need a webserver on a raspberry pi or similar running cron jobs and scripts to gather and manage all the data from all these devices.

ard_newbie:
a CAN bus is a must to avoid EMI, have a multimaster network with long distance cables

TCP/IP over ethernet will be slow and/or unreliable? Most of devices is mine or found library to communicate with via http calls (eg. GREE hvac and smart plugs). Isn't it much more complex to implement via CAN/RS485? The longest ethernet cable will be about 8 meters.

gilshultz:
I used Mega's because in the long run it was a lot less work then using port expanders. Good Luck, & Have Fun!
Gil

I don't remember why I ignored the Mega, all ports are there I need, so thanks for the reminder! Fun is guaranteed! :slight_smile:

DrAzzy:
I suspect you will inevitably need a webserver on a raspberry pi or similar running cron jobs and scripts to gather and manage all the data from all these devices.

Yepp, I think I'll use a DELL SFF as server. Haven't decided on node.js versus laravel, latter is my familiar territory.

Thank you guys for helping to decide!

gram_o_phone:
TCP/IP over ethernet will be slow and/or unreliable? Most of devices is mine or found library to communicate with via http calls (eg. GREE hvac and smart plugs). Isn't it much more complex to implement via CAN/RS485? The longest ethernet cable will be about 8 meters.

Yepp, I think I'll use a DELL SFF as server. Haven't decided on node.js versus laravel, latter is my familiar territory.

I would avoid CAN if you can do everything with Ethernet and WiFi (really, don't sell WiFi short - it's super cheap with ESP8266/ESP32, and it lets you do with just a power wire to each device. If I were doing this, I would likely have several types of sensor/input/etc nodes based on the appropriate ESP. I would use ESP-12F (the good ones, with QIO support) on the WeMo D1 mini boards that come without the module mounted (as they normally only do DIO, meaning slower code execution).

Heh - you are way ahead of me on what you're running on the master server. My raspberry pi is running a combination of python scripts in cron jobs and apache with php and the apcu-cache for data that persists between requests (no database, because i don't know how to set that up - also, I would need the database remote somewhere anyway, at least not on a raspi (they have a fairly high incidence of trashing SD cards.. A raspi or other could pack it up and ship it off to a bac