Site icon Circuit Ideas for You

How to Interface Microcontroller and Arduino with Relay

Imagine a tiny computer microcontroller or Arduino that can not control strong currents directly.

A relay is like a switch that can handle strong currents for things like lights, motors or heaters.

To connect them safely, we use a translator transistor and a special isolator optocoupler.

This lets the tiny computer tell the relay switch what to turn on or off, even though they use different kinds of power.

Circuit Working:

Parts List:

TypeValueQuantityNote
Resistors (all resistors are 1/4 watt)1k1
10k1
33k1
CapacitorsElectrolytic 100µF125V
SemiconductorsOptocoupler PC8171
Transistor BC5471
Diode 1N40071
OtherRelay 12V1

Many microcontroller designs often combine various interfacing methods.

A microcontroller µC system functions by reading inputs, processing them and then writing outputs.

Microcontrollers are valuable because they can communicate with other devices, such as sensors, motors, switches, keypads, displays memory and even other microcontrollers.

There is often a need to connect the microcontrollers output to an electromagnetic relay EMR.

Relays are devices that allow low power circuits to switch high currents and/or voltages on and off.

Below is a simple microcontroller relay interface circuit with ‘galvanic isolation.’

Galvanic isolation refers to the separation between two circuits without any metal conduction between them.

This isolation can be achieved through optical or inductive methods.

“Galvanic” refers to direct current DC, and galvanic isolation ensures that DC current cannot bridge the connection.

The most common method for achieving galvanic isolation is using an optical isolator optocoupler/photocoupler.

The PC817 Semiconductor is an optically coupled pair consisting of a gallium arsenide infrared emitting diode optically coupled to a silicon NPN phototransistor.

This device can transmit signal information while maintaining a high degree of electrical isolation between its input and output.

Connecting this circuit to a µC is basic.

The circuits input can be connected to a selected output port of the µC through the input terminals.

However, it is essential to observe the supply polarity.

The entire circuit can be powered by any DC source capable of delivering about 50 mA at 12V DC.

Formulas:

The circuit shown above is a simple setup for connecting a microcontroller and Arduino to a relay and amplifying it with a transistor BC547.

Below are some general electrical formulas are involved:

Transistor Base Current Calculation: to guarantee sufficient driving of the transistor toward saturation.

Ib = (Vcc – Vbe) / R3

where,

Transistor Collector Current Calculation: to make sure the load current can be handled by the transistor.

Ic = hfe * Ib

where,

Relay Coil Current Calculation: To verify the relay is properly driven.

Ir = Vr / Rcoil

Using the given circuit arrangement, you may successfully connect a microcontroller and Arduino with a relay by comprehending these fundamental ideas and choosing components with care.

How to Build:

To build a Interface Microcontroller with Relay follow the below mentioned connections steps:

Note:

Conclusion:

Interfacing a microcontroller with a relay is a simple process that involves using components like transistors and optocouplers to safely control high voltage devices.

Understanding the relays specifications and the microcontrollers output requirements is crucial for a successful interface design.

References:

Relay control by using microcontroller

Connect of microcontroller to the Relay

Exit mobile version