# Interfacing circuits with microcontrollers

Interfacing circuits with microcontrollers, in this article I have discussed various elements and circuits interfacing with microcontrollers. These circuits are useful for those who want to work on embedded system projects, but thy don’t have a knowledge of electronics and embedded electronics. Following circuits will help you in design of embedded system hardware circuits.

### Transistor interfacing circuit

Figure below shows how to interface transistor with microcontroller. Diode D1 is used to avoid back emf voltage in case of inductive as motor is used as a load in diagram below.

transistor interfacing with microcontroller

### Relay interfacing with microcontroller

There are many applications where you need to interface relay with microcontroller like in high power applications where you want to operate high power loads like motors with the help of control signals from microcontroller and power input from another power source in such situations we need to relay to separate low power control signals generating device from high power load as shown in figure below:

relay interfacing with microcontroller

### LED interfacing with microcontroller

I know , it is very easy to connect one led with microcontroller using a resistor, but one should careful before connecting a current limitind resistor wit led. Every microcontroller have a limit to sink and source current from its input/output pins. PIC microcontrollers can sink or source current upto 30mA.One should take care of current limit while selecting resistor value. For example if current limit is 30mA and you want to calculate resistor value, you can easily calculate it using ohm law :

V = I * R;

We know maximum input and output voltage from microcontroller pin is about 5 volt and already know value of current i.e 30mA. So by using above relation

R = V / I = 5 / 30  mA = 167.76

So one can use standard resistor value of 200 ohm.

LED interfacing with microcontroller

### LCD interfacing with microcontroller

Diagram below shows 16 * 2 LCD interfacing with microcontroller. D0-D8 are data pins used to send data to LCD. Rest of the pins are control pins used to perform various LCD commands like to write on LCD, to clear LCD screen , to shift cursor to any position, to adjust text position LCD. Variable resistor is used to adjust contrast/light of LCD.

LCD interfacing with microcontontroller

### L293D Motor driver IC interfacing with microcontroller

L293D is DC motor driver IC. It is serve the purpose of H bridge up to 1 ampere. It is used for  direction control of DC motor especially in university level robotics. Interfacing circuit is shown below :

Motor driver IC L293D interfacing with microcontroller

if you need any interfacing circuit , feel free to comment on this post.