close-circle
Close
0%
0%

Cheap Ethernet IO extension board for smarthome

Cheap low power smarthome extension board with Ethernet/Modbus/1-wire/DMX512/Wifi connection

Similar projects worth following
At the moment I am renovating my house. This is the time to change my home electric system to a smarthome system. I like the Loxone (www.loxone.com), but it uses KNX. This is a nice home automation system, but VERY expensive. A single KNX switch costs about 60-70 euros. I want to make an extension board for the Loxone with network connection (ethernet and an ESP8266 if ethernet isn't a possibility for you). I also want to add a Mod bus interface and a KNX interface. There is just one problem. I am a hardware design engineer, but not a software engineer. I need someone to make the firmware for the Cortex-M0 controller. I think the MCU will be an ATSAMD21 to make it arduino compatible. The ethernet interface will be an ENC28j60 board from Aliexpress. The PCB will have 64 IO's. I will not use relays on the board. The digital outputs can be connected to a solid state relais (search aliexpress for 5 channel DIN rail S

On 22 March 2017 I went to the High Tech Campus in Eindhoven to attend a seminar about 'smarthomes' (presented by tweakers.net). I am renovating my bungalow from 1967 and was curious about the current state of technology for smarthomes. I decided to turn my home into a smarthome. It's already disconnected from the gas supply line and it will be a house with a heat pump and solar panels. So besides the water the house will be a 100% sustainable home.

Now I am looking for a smart solution for my smarthome. The Loxone Miniserver is a very nice device, but additional KNX devices that you need for the system are very expensive. Let's make a cheaper solution to expand the inputs & outputs. A device that can be connected to the network and send the active button signal to the Loxone by ethernet. I also can add a KNX connection and Modbus, but I need someone to write the firmware for this. This project can also be used by someone that doesn't use a Loxone. With a webpage on the ATSAMD21 you can have a realtime insight in the digital inputs and set the digital outputs. But the device can also generate TCP request when an input changes. You can also connect some PIR sensors on the digital inputs (with a AC to DC level adapter in between) and generate an alarm when you're from home (send a notification by the internet to your phone).

These are my first thoughts about the hardware:

* 16 digital inputs (electrically seperated by opto couplers)

* 16 digital outputs (can be connected to SSR, https://www.aliexpress.com/item/10DA-Din-rail-SSR-quintuplicate-five-5-input-3-32VDC-output-24-380VAC-single-phase-DC/1581576845.html)

Update. There will be 64 IO's on this board. These IO's are not protected (because it more difficult to protect an IO instead of just protecting an input or just protecting an output)

* controller is the ATSAMD21. This controller is arduino compatible (with the right firmware inside)

* The ATSAMD21 has no ethernet connection. That's right. That's why I will add an ENC28j60 device (SPI to ethernet). I will also add an ESP8266 device to communicate by WiFi

* Modbus interface chip. I will connect a MAX485/SP485/ST485 to the ATSAMD21

Update. 2 RS485 connections will be on the board. 1 for the Modbus and 1 for the DMX512 bus.

* KNX interface chip. The NCN5120 can be connected to the KNX bus. The software stack is the problem. Please help ;)

* Step down power converter. The 24VDC will be converted to 3v3 for powering the MCU.

I don't know if just one ethernet connection is sufficient, but I am also able to connect the other interface chips. I need someone to write the firmware for the controller. I don't know if it makes sense to implement all these bus standards, so I can also remove some interfaces from the project. Please leave me a comment about your thoughts. I want to be able to connect this device to the Loxone. This board will also support MQTT. I am still new in home automation, so I am updating the specs as we go on with the project.

Ps. the picture is of an existing modbus board that has 16 inputs and 14 output relays

  • 1 × ATSAMD21G18A-AUT Atmel ® | SMART ™ SAM D21 is a series of low-power microcontrollers using the 32-bit ARM ® Cortex ® -M0+ processor, and ranging from 32- to 64-pins with up to 256KB Flash and 32KB of SRAM.
  • 1 × PCAL6416APW,118 Interface and IO ICs / I2C, SMBus
  • 1 × ST1480ACDR RS485 interface IC
  • 1 × DS2484R+T I2C to 1-wire
  • 1 × NC3FAAV2 DMX/XLR-3 connector

  • DC-DC converter power supply for the PCB

    markbng5 days ago 0 comments

    This week I will finish the board. Today I made the power supply for the unit. I wanted a synchronous DC-DC converter with a high efficiency. The voltage difference between 24VDC and 3V3 is a lot. It's a waste to burn the 20,7V up in heat. That's why I want a DC-DC converter with a high efficiency. So the DC-DC converter must also be able to handle the 24VDC input voltage. I want to generate 3.3V and 5V. The ethernet device ENC28J60 uses a lot of power and also the ESP-12 that is on the board. I will also make it possible to have the ENC28J60 and BLE on the board. But you have to choose: WiFi or BLE (due to the restrictions of number of SERCOMs. a shared sercom for both devices). I will use the Ethernet mainly, so maybe I will go for the BLE option. The BLE module is the JDY-10 (it is $1.38 on aliexpress with shipping).

    But back to the task of today. The power supply of the PCB. To be safe I calculated the DC-DC to be able to handle a 500mA output current.

  • Loxone 2017 ;) with SSR outputs

    markbng07/02/2017 at 14:35 0 comments

    The Loxone is an amazing peace of hardware. It works good and I am very satisfied with it. But the output relay (click clack) are not from this century anymore, so I decided to change the outputs of my Loxone. I bought some cheap SSR relays on aliexpress (https://www.aliexpress.com/item/FREE-SHIPPING-S216S02-S216S02F-S216-TO3P-4-5PCS/32802165635.html ). They work fantastic. Do you also want SSR relay on your board. These are the steps how to do it:

    * open your Loxone. Carefully put a small flat screwdriver between the plastic tabs and pop it open.

    * Look for the white relay. Carefully put some leaded tin on the bottom side of the PCB where the relay is soldered. Desolder it by using soldering wick, an desolder station or carefully heat up the whole footprint of the relay with a SMD hot air gun (please be careful with the last option, because it's a double sided board and you don't want to desolder other parts. This option is not recommended for beginners).

    * When the relay is gone, now you need 3 part for each relay output: The solid state relay itself. A 1W 1500R resistor and a varistor. I use the S216S02 SSR, the 1k5 1W from farnell, ERZE08A511 - TVS Varistor Surge Absorber for each output. The 1k5 resistor limits the current (16mA for the LED input of the SSR) and the TVS protects the SSR against high voltages on the output (inductive load). The SSR outputs will be connected with the terminal block and the connections of the relay coil will be replaced by the 1k5 resisor in series with the SSR LED. So connect the + of the coil to one side of the 1k5 and the other side of the 1k5 will be connected to the + of the LED of the SSR. The - of the SSR LED will be connected to the other connection of the relay coil. Tuesday I will provide pictures. Put a varistor in parallel to the connections of the terminal block. This will protect the SSR. You can also add a resettable fuse if you want a 'perfect' ouput.

    * Tuesday I will post my solder work and further instructions ;). The SSR will stay cool, so I probably don't need any heatsinks. The is 1 downside to the solid state relay... You can only use it for switching AC voltage and not little analog voltages or DC voltages. For debugging it is annoying that you lost your click signal to check if the relay in turning on or off. But this is why I want it in my house. No click sounds. The SSR is a semiconductor, so it should last much longer (if you use the varistor against high voltages). The SSR that I use here can also handle more current (16A max). To maximize the current up to 16A you have to put wires in parallel with the PCB connections from the SSR to the terminal block. The PCB lines are not that thick and can probably not handle 16A.

    This is my test with the SSR. And yes, I know, the blue wire from the mains must be isolated with tape ;)

    Disclaimer: Please only do this when you know what you are doing. I can not be held responsible for any damage caused by modifying the Loxone. You probably risk that you don't have any warranty on the product anymore. Making the wrong connections can harm the PCB and also yourself (output of the AC voltage of the SSR connected to the low voltage part of the Loxone).

    See my other project page just for this modification of the Loxone.

  • Modbus and RGBW drivers

    markbng06/23/2017 at 23:43 0 comments

    It has been while since my last log. But this doesn't mean that there is no progress. I ordered some parts on aliexpress and I played with a room thermostat that has a modbus connection. This thermostat can measure the room temperature and can switch on the valves to heat the room. But this isn't why I want this thermostat. I just want it as a input device/terminal for user input. So the Loxone can read out the room temperature and see what temperature is desired by the user in that room. The Loxone will decide what action has to be taken with the given values. It's not really a high tech device though. It measures the temperature with an inaccurate NTC resistor. I also noticed that the time on the device is not very accurate. But the last thing isn't a problem, since the time will be regularly updated by the NTP time from the Loxone. The positive things about the device....it looks nice and does exactly what I wanted (being able to set and read values from the outside by connecting it to a Modbus master).

    I also bought DMX RGBW LEDStrip PWM dimmers. I haven't tested the units yet (I don't have the RGBWW LEDstrip yet), but I also have found a cheap alternative. The PCA9685 from NXP. It's a 16 channel 12bit PWM device with I2C connection. I will not place this device on my board, but I will make the I2C bus available to expand this PCB with a PCA9685 device. It is really simple to make a RGBW dimmer (4ch PWM LED dimmer). Just connect the I2C to the PCA9685. Connect FETs to the LED outputs of the PCA9685 (with probably a FET driver eg PMD3001D) and you are ready to go. The FET will be able to switch the 12VDC on and off. The FET driver will prevent the FET from becoming too hot. It's the time between the on- and off- state when the FET heats up the most (relative high voltage and high current). The FET driver will shorten the switching time and will prevent excessive heat losses. You don't have to use a FET driver when you just switch 2 times a minute, but since it's a PWM signal, the switching frequency is high.

    Below you see a picture of the thermostat. Yeah, I know, it was pretty hot that day....

  • The first draft of the schematic diagrams

    markbng05/31/2017 at 23:29 0 comments

    I have been busy lately with the renovation of my home. The floor isolation is applied and the floor heating tubes and the upper cement layer is also applied in my home. The electrical connections are plenty and I still have to complete many connections (all connected to a central point in my house)

    But now I have also worked on my project. I have made a first draft to show you my ideas. Any requests and/or comments are more than welcome. Now is the time, because I will make a PCB on a short notice. I still have to connect the I2C buses and the SPI bus (of the ENC28J60) to the main controller. As a hardware engineer I know how to connect the sercoms, but maybe you can give me some advise which pins to use from a software perspective (easy Arduino implementation). Or does it not matter which sercoms/pins I will use?

    I have also added an I2C LCD to the project. This makes it easier to debug the device and see what is going on with the IO's. Please notice the costs of the components that I use. It will be a very cheap solution (as promised ;) ). LCD is $2.40. ESP-12F is $1.63. The ENC28J60 board is $2.16.

  • Omnipolar hall sensor is good!

    markbng05/15/2017 at 11:33 0 comments

    I had a problem with the latching hall sensors last friday. Today I got the omnipolar hall sensors from Farnell. And these sensors work as it should. So I will use these sensors in my door and windows frames. The output is high when no magnet is detected and is low when a magnetic field is present. I have used a high pull-up resistor (1M ohm), so the high level is only 4.5V.

  • Door/window sensor

    markbng05/12/2017 at 11:52 0 comments

    How does the door/window sensor work? I will place a small magnet in the door/window (has to be painted again, so it doesn't matter) and a hall sensor in the frame of the door/window.

    Today I got my hall sensors from Farnell. Yesterday I was in a hurry and just ordered a few hall sensors (in TO92 housing). What can go wrong? Well, the hall sensor I ordered can not be used as a door/window sensor. The sensor I ordered is bipolar. The output is set when a S field is applied and reset when a N field is applied. The state of the output is maintained when there is no magnetic field present. I need a sensor that has an active output when a magnetic field is present (so a S or N magnetic field when the door/windows is closed) and the output is not active when no field is present(door/window is open). This means I need an omnipolar hall sensor for the door and window sensors. The output becomes active (this means low because of the open colector output) when a magnetic field is present. On monday I will receive the omnipolar sensors....To be continued.

  • Sensors for the extension PCB

    markbng05/06/2017 at 13:12 0 comments

    I will add the posibility for a KNX TP-UART2. If I don't have enough sercoms on my Atmel device, I will use zero ohm resistors to enable the KNX uart OR another function.

    When I finish this project, I will have some very nice sensors that I will modify:

    * PIR with separate Ambient light output and PIR sensor output. I have bought a cheap PIR from hornbach (12Eur, Q-link Wall mount sensor.). This pir is a ceiling pir for a round mounting hole in the ceiling. Just like a ceiling spot light. I will modify this PIR to have 2 separate digital outputs. 1 open collector digital output for the ambient light strength (PIR unit will handle the Lux threshold) and the other open collector digital output is for the PIR sensor. Separation enables me to switch the light with the Loxone when it's dark, but it will also enable me to use this PIR unit to enable the alarm (also when it's light, so during the day).

    * CO2 sensor. I have found a cheap CO2 sensor on aliexpress. I will also use this sensor in my livingroom and bedroom to maintain a healthy climate in those rooms. It will switch the perilex socket of the Heat recovery ventilation (HRV). A humidity sensor will be used in my bathroom. https://www.aliexpress.com/item/MH-Z19-NDIR-CO2-Sensor-Module-0-5000ppm-new-and-original-in-stock-free-shipping/32697750985.html

    * Windows/door sensor. For the windows and some doors I will not use a reed-relay, but probably a hall sensor with small PCB to make a open collector output. https://www.aliexpress.com/item/50-pcs-SS41F-41F-0H41-SH41-S41-Bipolar-Hall-Effect-Position-Sensors-SIP-3/1903012341.html

    Most of these sensors will be handled after this extension PCB. Some of these sensors will be developed in parallel to this project.

    PS. why am I not using reed relay and a normal relay? I want to use hall sensors and SSR because these semiconductor parts have no mechanical parts that can wear down. I want to make the system durable.

  • Dali?

    markbng05/04/2017 at 15:36 0 comments

    It's also possible to add Dali, but too many interfaces seems overkill. Software for Dali can be found here: http://blog.perquin.com/blog/arduino-dali-interface/

    This is the schematic that I can implement :

  • Arduino Modbus and KNX software & hardware

    markbng05/03/2017 at 09:11 0 comments
  • The status of the project....so far.

    markbng05/02/2017 at 19:25 0 comments

    It has been quiet for some time, but I have made some progress. This is the current status of project. I am making the schematics in Altium designer. These are the features I will add to the project:

    * main controller is the ATSAMD21G18A-AUT. I want to make the schematic Arduino M0/Arduino zero compatible. Controller and SWD connections have been drawn (controller is now in PCB library).

    * 64 IO's with IO expanders. I can make them with 3v3 or 5v level output. I chose for the 5v level for a better robustness against interference. The IO's are expanded by PCAL6416APW,118 IO expanders (16 IO's). These expanders can also generate an interrupt when an input changes and can therefore react very fast when a button is pushed. I have 64 IO's, so this means 4 expanders. There is only 1 addr line on the I2C device, so actually I can only have 2 expanders on 1 I2C bus. I solved this by using the 4053 that switches between I2C-group1 (expanders 1 and 2) and I2C-group2 (expanders 3 and 4). The IO's are NOT protected against 220VAC or 24VDC, but have a normal ESD protection. These digital IO's can be connected to a relais board or SSR board (I will make this board afterwards). The inputs can be connected to an optocoupler board to separate the safe electric zone of the IO expander with the unsafe zone, but you can also switch the 5V directly with the momentary switches from the outside (less safe). The IO expander schematic is finished. I use 1 sercom for this I2C connection and the I2C from this sercom is only for the expenders.

    * Ethernet. The ethernet connection is provided by the ENC28J60 board from aliexpress. Cheap and fully functional. I have to add this to the schematic

    * RS485/Modbus/DMX. Since we have ethernet, it may be possible to make an ethernet to MODBUS and/or DMX interface. I have added 2 RS485 connections. One for the Modbus and the other for the DMX bus. The RS485 will be half duplex and will be connected to 2 sercom uart interfaces. The RS485 interface IC's are the MAX485CSA or the ST1480ACDR. I have already added this to the schematic.

    * 1-wire. I will also add a DS2484R+T device. This is an I2C to 1 wire interface. Most home automation systems have the DS18S20 thermometer sensors to measure the temperature. This will also be possible with our device. I2C will be connected to a sercom. I can optionally add an I2C graphic LCD. Please leave a comment if you think this is useful. I have only drawn the D2484 in the library.

    * KNX. I wanted to add KNX to this device. But it doesn't make sense to address KNX devices from this device (since the Loxone can do that) and I think the main connection to the outside will be TCPIP, so making the KNX device connection to the Loxone will also not be an option. Please leave a comment if you think it is useful that this device will functions as a KNX device. It's also more expensive due to the software stack. No KNX connection is present in the current schematic.

    * Wifi. I will use ethernet, but I think that many people want Wifi on this device. I chose for the 'old' ESP8266 and not the ESP32 (with BLE). I will add the ESP12 module. I have added this to the schematic.

    * USB. I want to make board with the ATSAMD21 arduino M0 compatible, but I don't know if we need an host USB connection. It's a small effort to make it possible to make this connector host capable, but then I have to use micro USB. I prefer the good old USB B connector to make the connector more tough. This means the ATSAMD21 will only be an USB device. Do you use the host function?

    * Power. DC-DC synchronous switches will convert 24VDC to 5VDC and 3V3. This has not been implemented yet.

    Schematics will be shown here on a short notice.

    Just a question....I have muliple functions added to this PCB. It will have an ethernet to 1-wire function, ethernet to Modbus, ethernet to DMX and ethernet to IO function. Is it possible to have all these function with 1 ethernet connection?

View all 10 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates