An IoT-enabled system for automated environmental control.

Similar projects worth following
When we had a large conservatory added to our house some five years ago, automated roof vents was essential to ensure that the room remained usable throughout the summer months. To that end, the conservatory was installed with an automated temperature controlled vent controller.
Unfortunately, due to some hardware design issues, it really doesn't work very well and breaks down as the temperature increases(!). This project is my replacement for that system. It's actually my second attempt; the first used an Arduino but worked in a similar way to the original. It never made it off the breadboard. This time, we're going IoT; a separate sensor module will send environmental data to a cloud service. In turn, the service will send commands to an actuator for the vents. A mobile App will provide the essential user experience.

The project splits into a number of separate components:

  • A WiFi-connected Sensor Module that periodically sends environmental information, including two temperature readings, humidity, luminosity and barometric pressure. This module can also respond to commands received (such as a remote restart).
  • A WiFi-connected Actuator Module that responds to control messages to determine the position of the vents. This module has two local buttons and a rain sensor, as there are certain functions that the module must be able to carry out autonomously, without relying on a cloud service.
  • A message broker. The modules communicate using MQTT, a lightweight telemetry protocol. They send messages to, and receive messages from, a message broker in 'the Cloud'. Other software components of the solution integrate with this message broker, so that they can receive messages from, and send messages to, this central point.
  • A mobile App to allow user control and monitoring. This will be a Xamarin App, as it allows for a native cross-platform implementation and capitalises on my existing .NET skills.

There may also be a website for control and monitoring away from a suitable mobile device.

Security is a concern. Whilst I have no issue with someone being able to monitor the environmental data, I don't want anyone to be able to inject spurious data into the system or gain direct control over the vents. To that end, each message is signed. Ideally, I'd like to encrypt the whole message, but that's quite a heavyweight task for these tiny microcontrollers. For now, an MD5 hash using a shared secret will have to do.

Code and Eagle files are at

  • Actuator Module Progressing

    Steve Morgan08/13/2015 at 20:54 0 comments

    Having got the sensor module working, I shifted my attention to the Actuator module. This is built on an identical board to the Sensor Module, but has the following connectors instead of the I2C bus connectors:

    • Interface to relay board. I'm using a separate, but cheap, Arduino two-channel relay board. This requires a 5V power supply, but can be interfaced to the controller at 3.3V. Some people have said this is unreliable. Thus far, I've had no problems at all, but if it becomes an issue, it's just a matter or replacing a couple of resistors on the relay board. Ultimately, I'd like to combine this into a single board with the controller.
    • Connections for two push buttons. To save GPIO pins, these modify a potential divider to produce one of four different voltages for the ADC pin on the Thing.
    • Connections for a rain sensor. This is another separate board that provides a digital signal when the sensors gets wet.

    At the moment, I only have the relay board connected. I've updated the Actuator sketch to control the relays, operating the vent motors. One issue that I currently have is that there's no feedback loop for me to know the actual vent position. Instead, the Actuator module forces the vents closed when it boots, thus giving me a 'known state'. The original vent controller didn't do this, which was a problem if it had to be restarted or the power failed. It's also responding to commands over MQTT to set the vent position. This is how the system will ultimately function; an external cloud-based service will determine the desired vent position from the sensor data and send a message to the Actuator Module over MQTT to establish that position. At the moment, my test service sends random position commands to the module, so it's sitting here clicking relays on and off on an irregular basis.

  • Sensor Module Complete

    Steve Morgan08/10/2015 at 08:31 0 comments

    I've designed a basic board around the ESP8266 and had three produced by Ragworm in the UK.

    The first, I've incorporated into the Sensor Module, which I'm pleased to say is now working fine. Environmental data is being send to my message broker every 15 seconds. I've some concerns about the temperature readings, which may be a little high. I wonder if the airflow in the enclosure isn't quite enough and it's heating up. I can always add some more ventilation, or even bring the sensor out of the enclosure, if necessary.

View all 2 project logs

Enjoy this project?



Chuma A wrote 08/12/2015 at 15:48 point

I like this!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

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