If you are still using the traditional switches, then I’m sorry to say this but they are outdated now. Moreover, these traditional switches have mechanical moving parts which get damaged on continuous use.
Nowadays, old switch boards are getting replaced by modern touch switches that not only enhance the look of our homes but are also far easier and safer to use. Theses modern touch switches have extra functions and as no moving parts are involved in building them, they also last longer than the traditional ones.
Despite these advantages, many people still use old switches because a modern smart touch switch is quite expensive, and every person can’t afford to have it.
This is the reason why I decided to make an affordable “Smart LCD Display Touch Switch Board” that would be far cheaper than the ones currently available in the market. This switch board, which can be controlled wirelessly through an android app, will also have air temperature displayed on its screen.
Now, let’s collect the components to start the project Fig 1. Touch Switch
Bill Of Materials
Fig 2. TFT display for Arduino
Setting Arduino Library
First of all, we need to install the required library to the Arduino IDE. For this, we will go to Sketch menu and click on the manage library. After this, search the library name and click on install button. The libraries needed for this project are Addafruit GFX library, Touch screen library and NTC thermistor library.
NOTE: Every touch screen has its own Library. So, find the library for your TFT screen model and install that. Here I have used MCUFriend 2.4 TFT LCD Library St7789v and installed it as shown in (Fig 1,2,3,4) . Fig 3. Opening Library manager. Fig 4.Installing touch screen library Fig 5. Installing Adafurit GFX library Fig 6. Installing library for temperature sensor
In the first part of coding, we will initialise the required libraries in code as you can see in Fig 7. Fig 7. Initialising the required library
After that we will create a function to get the point of touch on LCD screen in X and Y Coordinates. Refer (Fig .8).
Fig 8. Getting touch points on LCD
Next, we will add codes for the colours we are going to use in our LDC Display (Refer Fig 9). Fig 9. Setting colour code for display
Then we will create a setup function where we will add the codes to show buttons and all other elements on LCD display. (Refer Fig 10,11) Fig 12. Getting touch points Fig 12.1 Setting touch buttons’ function
Since we are now done with the coding part. Next is app building.
First, we will create a layout for app and then add the following components to it: – 4 Buttons 1 list picker 1 Bluetooth Clint Fig 13. APP Layout
After this you can go to MIT App inventor code blocks. Pick and place the code block according to fig below Refer Fig 11. Fig .14 MIT App Inventor Code Blocks
Now, we need to connect the components and fix all the components and relay module in switch box as illustrated in Fig 15,16,17,18,19.
Arduino UNO Components 5V Bluetooth VCC GND Bluetooth GND TX RX RX TX PIN 13 Relay IN 1 PIN 14 Relay IN 2 VIN & VCC of Relay Power Supply 5-6V GND & GND of Relay Power Supply Terminal -Ve PIN A5 Thermistor Sensor Fig 15. Circuit Diagram Fig 16. Fixing all the components in a box Fig 17. Setting TFT display in a box Fig 18. The completed touch switch board
Fig 20. Touch Switch Display Font view
Congrats!! Your “Smart Touch Switch Board” is ready now.
Check each connection carefully as any wrong connect might result in electric short circuit. When you are sure that all the connections are being done correctly, power the Arduino and relay with 5V DC and then plug the AC appliances connected to relay for switching.
When you press the OFF button, the relay turns off the electronic appliances connected to it. When you touch the ON button, it will turn on the electronic appliances connected to it.
Now, try it using the app. Open the app and click on the Bluetooth Icon button and connect to Bluetooth HC 05 of Switch Board and then click on the ON/OFF button in app to control the electronic appliances wirelessly.
This content was originally published here.