How to Control a Relay with HMI using Arduino

Introduction

In today’s world, automation plays a crucial role in simplifying our daily tasks. Having the ability to control devices remotely can enhance convenience and efficiency. This article aims to guide you through the process of Control Relay with HMI using Arduino. We will also discuss two popular HMI (Human Machine Interface) options, the 3.5 inch and 2.4 inch HMI displays, as well as the Arduino Nano and the BC547 transistor in detail.

Controlling a Relay with HMI

Relays are electromagnetic switches that allow low-powered signals to control higher current devices. By using an HMI with Arduino, we can easily control a relay and thus manipulate various devices or appliances.

Now, let’s discuss the two HMI options, the 3.5 inch and 2.4 inch HMI displays.

3.5 inch HMI Display

The 3.5 inch HMI display is a compact yet versatile option for controlling various devices with your Arduino. It features a resistive touchscreen, allowing for easy user input. This display supports multiple communication protocols like RS232 and RS485, making it compatible with various devices.

With high resolution and bright colors, the 3.5 inch HMI display offers a crisp and clear user interface. It also comes with preloaded graphic objects, which can be easily customized according to your project’s requirements. Additionally, it has a user memory capacity of 128MB, enabling you to store multiple projects and graphics.

2.4 inch HMI Display

If you are looking for a more budget-friendly option, the 2.4 inch HMI display may be a suitable choice. Although smaller, this display still offers a user-friendly interface and supports various communication protocols like RS232 and RS485.

The 2.4 inch HMI display features a resistive touchscreen, ensuring easy navigation and control. With a resolution of 320×240 pixels, it provides sufficient clarity for most applications. However, due to its compact size, the display area may limit the complexity of the graphics and user interface.

Arduino Nano

The Arduino Nano is a popular choice for projects that require a compact and reliable microcontroller board. It is based on the ATmega328P chip and provides 14 digital input/output pins, including 6 analog inputs. Despite its small form factor, the Nano offers similar capabilities as its larger counterparts.

Programming the Arduino Nano is straightforward, as it utilizes the Arduino IDE and supports the C++ programming language. Its compatibility with numerous libraries and shields makes it ideal for a wide range of applications, including HMI control.

BC547 Transistor

The BC547 transistor is widely used in electronic circuits due to its versatility and low cost. It is a NPN (negative-positive-negative) transistor commonly employed as a switch or amplifier. In our case, we will utilize it as a switch to control the relay.

The transistor acts as a buffer between the Arduino Nano and the relay module. By sending a low voltage signal from the Arduino to the transistor’s base pin, we can control the high voltage required to activate the relay. The BC547 is capable of handling a maximum current of 100mA, making it suitable for most relay modules.



How to Control a Relay with HMI using Arduino
Control a Relay with HMI using Arduino

Circuit Diagram of Control Relay with HMI using Arduino

This project can be designed using a few basic components. The circuit diagram of this project is shown below.

How to Control a Relay with HMI using Arduino Circuit Diagram
Control a Relay with HMI using Arduino Circuit Diagram




More Circuit Layouts






Components List of Control Relay with HMI using Arduino

Following is the list of all components used in this project:

1x 3.5 inch HMI OR 2.4 inch HMI
1x ARDUINO NANO
1X BC547 Transistor
1X 1N4148 Diode
1x 1k Resistor
1x 5V Relay
2x 2 Pin Terminal Blocks
JUMPER WIRES

Project Code Files:

Project Zip:

Explanation of Control Relay with HMI using Arduino

To control a relay with HMI using Arduino, you will need the following components:

  1. Arduino Nano: The Arduino Nano is a compact microcontroller board based on the ATmega328P. It packs all the necessary features required for this project, including digital input/output pins.
  2. HMI Display: The HMI display serves as the interface between the user and the Arduino. It allows for easy interaction and provides real-time feedback.
  3. Relay Module: A relay module is essential for controlling high voltage devices with low voltage signals. It acts as a switch, allowing the Arduino to control the relay.
  4. BC547 Transistor: The BC547 is a general-purpose transistor commonly used for amplification and switching purposes. It will help us in controlling the relay effectively.




Now that we are already familiar with all the major components, let’s get into the connections phase to physically build our project.

Connections of the Circuit:

Step-1: First insert an Arduino Nano and a 2-pin terminal block on the board. Connect one pin of the terminal block to 5v pin of Arduino and the other pin to GND of Arduino.

Step-2: Next insert HMI Display, and connect its VCC pin to 5v pin, GND pin to the GND pin, its TX pin to D3 pin and its RX pin to D4 pin of Arduino.

Step-3: Now insert a BC547 transistor and connect its pin-3 to ground. After that, connect a 1k resister between pin-3 of BC547 transistor and D2 pin of Arduino.

Step-4: Next insert a 5v relay, and connect its coil pin-1 to the 5v pin of Arduino and coil pin-2 to pin-1 of BC547 transistor.

Step-5: Now insert a 2-pin terminal block and connect its one pin to Normally Open pin and its other pin to the Common pin of the relay.

Step-6: In the last connect anode of 1n4148 diode to pin-1 of the BC547 transistor and its cathode to 5v pin of the Arduino.

We have completed all the connections here, now upload the code and test the project. The complete code for Arduino is already provided in the Project Code Files section above for download.

Conclusion of Control Relay with HMI using Arduino

Controlling Relay with HMI using Arduino opens up a world of possibilities for automation and remote control. By combining the power of an Arduino Nano with an HMI display, we can easily interface with various devices and appliances. The 3.5 inch and 2.4 inch HMI displays offer different levels of functionality and affordability, catering to different project requirements.

The Arduino Nano serves as the brain of the operation, providing the necessary computing power and digital input/output pins. To control the relay, we utilize the BC547 transistor as a switch, effectively isolating the low voltage signals from the Arduino to the high voltage required for the relay module.

By following the steps outlined in this article, you can create your own automation projects and enhance the convenience and efficiency of your daily life. Whether you opt for the 3.5 inch or 2.4 inch HMI display, the Arduino Nano, or the BC547 transistor, the possibilities are endless. Get creative and let your imagination lead the way to automation and control.

More projects, You may like:




For more project and circuit diagrams, you can go through the Schematics in the main menu where you can find many interesting projects and circuit diagrams like audio amplifier circuits, voltage booster circuitbattery charger circuit and timer circuits etc., which are all beginner circuit projects. Feel free to check them out!

Thanks for visiting the article and watching the video.

(Visited 173 times, 1 visits today)

Leave a Reply

Your email address will not be published.