Most of the new hotels equip an automation system inside the rooms. The standard configuration provides access to the room via an RFID card, the subsequent activation of the room's electrical system and temperature control. I built a standalone proof-of-concept (PoC) system to demonstrate the integration of the Azure Sphere system in the building automation field.
The prototype is housed inside a 8-module DIN module recovered from an old 27Vac transformer. Feel free to use any box or leave everything uncovered.
- Visual Studio 2019 with Azure Sphere environment configured;
- Source code of the project (GitHub).
HARDWARE SETUP AND SCHEMATICS:
Wire up everything as shown below.
- GPIO16/31/32/33/34 SPI Bus to RC522;
- GPIO37/38 I2C Bus to OLED display;
- GPIO00 DHT11 signal;
- GPIO02 Relay1;
- GPIO28 Relay2;
- GPIO01 Relay3;
- GPIO42 Puls+;
- GPIO43 Puls-;
- GPIO26 PulsOk;
- GPIO17 Limit switch;
Once the connections are complete, it is possible to insert everything in a DIN module or a box of your choice. If you have electrical equipment available, you can prepare a demo panel.
Keep in mind that the following steps are completely optional and do not affect the correct functioning of the device. In the repository there is a file called "RFIDHolder.stl". It is a printable cover to be placed above the limit switch to accommodate the RFID card.
WARNING: Be careful while working with the mains voltage. Always check that you have the necessary protections (differential switch) and operate only if you are sure of what you are doing.
I have prepared a short demonstration video, available at the bottom of the page. In my setup I had only two relays available and I chose not to connect the thermoregulation one. Inside the DIN box there is also a 230Vac/5Vdc power supply. The intervention of the two relays is signaled by the lighting of two small lamps connected to the sockets positioned on the right.
Download the code from the link proposed in software requirements section. Open the solution with Visual Studio 2019. The projects does not require any change in the source code and is ready to use. Once the Azure Sphere board is connected via USB just click "Remote GDB Debugger" to compile and upload the code to the board.
There are three subroutines in the system: one deals with temperature, one with access control and one with power management. It is possible to change some settings from a configuration menu.
- Thermoregulation relay goes high when the temperature detected by DHT11 is lower than the one set in the configuration.
- Door relay (for the control of an electric lock) goes high when the scanned RFID card matches the ID set in the configuration.
- Room relay (master switch) goes high when a card is inserted in the card holder.
The configuration panel can be opened by pressing the OK button. You can scroll through the available settings by pressing the - and + buttons, and once selected by pressing the OK button. In the temperature menu set the degrees and press OK to return to the main page. In the RFID menu, scan a card to register it as the access card. Then press OK to return to the main page.
The main page shows actual temperature, humidity and room status (ENABLED/DISABLED).
The settings are saved in the MutableStorage, so they will not be deleted until the application is deleted.
CREDITS AND NOTES:
RoomSphere-master.zip 37.5 KB