Secure Bluetooth Relay

Padraic Heberlein

Overview

For this project I wanted to make be able to control a relay switch with a 3.3v control signal. This signal would come from the microcontroller and be controlled via a secure Bluetooth connection. I wanted the whole project to fin in a nice looking wooden box with an outlet cover and power cord that plus directly into the wall.

Image 1 Image 2 Image 3

Hardware

I used the Silicon Labs BGM220PC22HNA microcontroller with a LIVISN DC 24v 30A 1-channel relay module along with two basic outlet receptacles; one outlet for the relay to control and one outlet to power the microcontroller. I kept the relay switch by the out let and ran longer 5v signal wires to the board at the front of a wooden box.

Schematic

Software

I used Simplicity Studio 5 to develop this project. First the program initializes the GPIO and RTCC. If the phone being used has is not bonded to the device, I prompt will appear in the terminal instructing the user to hold the button down for 3 seconds, after which I 6-digit random pass-key is sent to the phone. Once the pass-key has been accepted in the terminal, the device can now be connected to via the phone. Once a connection has been made, the relay switch is toggled. If the connection is dropped, the relay switch shuts off. Other error messages will appear on the terminal if things don’t go according to plan. There is also an option to erase all previous bindings to the device.

Final Thoughts

This project was fairly straight forward, with the most complicated aspect being the implementation of the Bluetooth security feature. I thought it was really cool to learn about the Bluetooth part of it. If I had more time I would have added an OLED screen with a button next to it so sit on top of the box. Then instead of the communication of the device with the user happening in the terminal, text would be displayed on the OLED and all bonding could be initiated straight from the box. This would mean that the OLED on the box would have to display the passkey and the user would have to enter it on the phone instead of vice versa.

Downloads


Last modified:Mon, Jan 23, 2023.

00018