Introduction: DINternet IoT Controller

About: Trombone playing Tinkerer from the North East of England

IoT DIN Rail Controller, part of my DINternet Network project. Easy to use, flexible and clean DIN Rail installation.
Usable as a standalone device or as a slave device in a multi-unit setup, this versatile device brings wireless monitoring and automation to your home network.


In recent months and years I have been working on a series of projects that have involved the usual suspects; Raspberry Pi, Arduino, ESP8266 devices etc.

The projects I ave been working on have ranged from Aquarium monitors and other home automation/monitor applications all the way to an industrial controller running in a factory to notify staff of PLC activity.

Having found many ways to connect these projects to the networks they are used on I decided it was time to develop a universal setup that I can deploy for a all the variety of projects i attempt.

My new universal setup contains two, DIN mountable units; the controller and the Hub.

The Hub, a Raspberry Pi powered unit, acts as an access point for all the controllers and connects the DINternet Network to the Home or Work network.

The controller, an ESP8266-powered unit, is the focus of this project.

The controller itself is a simply build; a Wemos D1 (ESP8266 board in the Arduino Uno form factor), a 4 channel arduino relay shield, and a fantastic case (the ArduiBox from hwhardsoft.de) with it's additional OLED display shield.

While simple, it is a very versatile unit; the onboard relays can control a variety of devices in a home automation setup or trigger all kinds of equipment, the Wemos pins broken out to the screw terminals can be used to interface with a vast array of inputs and outputs, the case's built in prototyping area can be used to add to your c ircuitry (such as perhaps adding a port expander to add more Analog pins to the Wemos' solitary Analog pin), and the opnboard display can show a variety of sensor information, relay status or even the IP address information for the device.

I am currently in the process of migrating my coding for the project to MQTT, so the Controller devices will be able to publish data to the MQTT broker (server running on the Pi) and can also subscribe to other channels, creating a great platform to create all kinds of projects.

The Pi itself will act as a MQTT client as well as the broker, meaning it will be able to display all data from all the controllers in an centrally controlled interface.

:-)

Step 1: Components

To create the Controller you need to assemble a handful of parts:

Wemos D1
4 channel Arduino relay shield
hwhardsoft ArduiBox enclosure
hwhardsoft oled display add on

Step 2: Assembly: the Enclosure

Putting together the Controller is really simple.
The ArduiBox, by hwhardsoft, is a DIN rail enclosure designed for Arduino Uno. It is really flexible; it can hold an Arduino Uno and an Arduino shield, has screw terminals and a prototyping area for expanding your project, can be purchased with an onboard regulator for easy powering options, and can also hold an oled add-on shield (also by hwhardsoft) adding a display and buttons for project control.
To get started attach the screen to the lid of the enclosure using the provided adhesive tape and set it aside, rest to mount once all the components are mounted.

Step 3: Assembly: Wemos D1

The Wemos D1 is an ESP8266 powered board in the Arduino Uno format.
The ESP8266 is a fantastic chip, bringing Wi-Fi functionality to the project for a low cost.
Since the chip became popular support has grown, including an easy to use Arduino library.
Arduino IDE compatibility and the Uno form factor make the Wemos D1 perfect to use in this project.
ok
Plug it into the Arduino header pins in the ArduiBox enclosure.

Step 4: Assembly: Relay Shield

The relay shield is a convenient way to add relays to your Arduino project.

Relays are an important part of many Arduino projects, as they allow your 5v tolerant board to control higher voltage devices, such as heaters, lights, and domestic appliances.

Always check your relays are rated suitably for the current and voltage you are going to be running through them.

To add your relay shield, simply plug it into the socket in the case. It will overlap the Wemos D1 and fit together nicely.

Step 5: Assembly: Attach the Lid

A nice and simple step here.

Take the lid and connect the wires into the relevant holes; ground to ground, 5v to 5v, and your SDA and SCL cables to the two pins you have decided to use with your shield.

Depending on your relay shield you may already have the pins broken out to plug the wires into; if not, you can solder the display wires to the relevant pins.

Then just clip the lid onto the base.

Step 6: Code: MQTT

CODE TO FOLLOW

Step 7: Code: Uploading

Connect to the unit via the Wemos D1's USB port.

Select the correct COM port in the IDE and ensure you've selected the correct board type before uploading.

Hit the 'Upload' button, and the code should be uploaded to the Wemos.

Step 8: Installation

The great thing about the DIN rail format is it's easy to install.

You can screw a small bit of the rail anywhere to allow for the devices to be installed, or you can even mount it to an existing DIN rail cabinet at home or at work.

Once you've clipped the unit to a rail all you need to do is provide power via the two screw terminals and then plug in any additional sensors you want to use with the device.

Voila!

Step 9: That's It!

Very soon I will be creating another instructable to detail the assembly of the Hub unit for the project.

Once up I will be making a final revision to my code and adding it for everyone's use.

Between the two devices I have a fantastically flexible setup that can be catered for a huge amount of applications, from monitoring devices around the home to industrial monitoring or office automation.

Feel free to drop me a comment with and questions of suggestions.

Cheers!

Wireless Contest

Participated in the
Wireless Contest