Microcontroller 8051 - circuit configurations - TESLA InstituteBasic connections that will help you design circuit for 8051/2 microcontrollers properly.

 

 

 

 

 

 

 

 

 

 

Power supply circuit

Voltage requirements: mostly +5Vdc

Microcontroller 8051 - circuit configurations - TESLA Institute

 

The basic circuit to make microcontroller AT89C51/AT89S51/AT89C52/AT89S52 work at start is given below (Here our main aim is only to start a controller assuming there is no external RAM).

Microcontroller 8051 - circuit configurations - TESLA Institute

And to interface microcontrollers AT89C2051 and AT894051 we keep the circuit same accept the pins change this time.

Microcontroller 8051 - circuit configurations - TESLA Institute

 

Interfacing input to the microcontroller

There are lots of ways you can do that. I usually use two methods.

1. Pull up resistor type.
2. Transistor driver type.

Transistor driver type has high successful rate of driving inputs and outputs of microcontrollers. The input can be another microcontroller output or driver output or any other logic circuit.

Microcontroller 8051 - circuit configurations - TESLA Institute

The above circuit will work only if the input signal is digital to the transistor. Value of R1 and R2 are calculated according to maximum ratings. Assuming the source of the signal and transistor Q1 are same.


R2 = Vin/Ib
where Vin is digital input voltage (+5v) , Ib is ideal base current to drive Q1 (5mA).
R2 = 5 / 0.005 = 1k ohms

To calculate R1 we need to know what is the ideal drive current for At89c51 microcontroller. If you check our the datasheet you will find it is 20mA.

R1 = Vcc/Imax = 5/.020 = 250Ohms

In this configuration, when the input at transistor is high (+5V), the input at the microcontroller will be low (0V). And when input at transistor is low (0V), the input at the microcontroller will be high (+5V).  If the voltage varies at the input of R2. You need to see the max value of voltage there and adjust the value of R2 according to the above formula.



Interfacing a switch

Microcontroller 8051 - circuit configurations - TESLA Institute

 

This configuration of Switch Input can also be given to External Interrupt Pins ( INT0, INT1) for interrupt based switch trigger in the case of using power down modes to save power.



Outputs of microcontroller

Typically the output varies from 2.4V to 4.5V here. You need to find out which port gives what voltage after constructing basic circuit on bread board.

Assuming voltage 2.4V lets construct our output driver for 5V logic circuit.

Microcontroller 8051 - circuit configurations - TESLA Institute
This is also similar circuit as input accept the voltages are different here.
In this case, the input voltage to the transistor now varies from 2.4V to 4.5V depending on full load over the IC.
Lets assume the output of the microcontroller is 2.4V.
R2 = 2.4/0.005 = 480Ohms
Since we gonna drive TTL logic of +5V we will assume output at Vcc level at 25mA (Maximum current of
the device you going to drive at +5V).
R1 = 5/0.025 = 200Ohms

In this configuration, when the input at transistor is high (+5V), the digital output will be low (0V). And when input at transistor is low (0V), the digital output will be high (+5V).  If the voltage varies at the input of R2. You need to see the max value of voltage there and adjust the value of R2 according to the above formula.

Outputs in sinking mode
 

Microcontroller 8051 - circuit configurations - TESLA Institute

 
To turn this LED on in software you have to write '0' instead of  '1'. The logic becomes opposite. Setting the Pin to 0 makes the logic 0 hence connected to ground internally creating a circuit to light up the red LED.
But make sure you do not cross limit of 25mA on each pin. Sinking above 25mA will cause heat up on the IC causing loss of power. For low power LED's this mode can be applied. Even can be applied for 7 - Segment display.
 
 
USB interface

For serial communication, if you need USB interface and to use serial communication through virtual com port on PC (For users without RS-232 Interface).

Microcontroller 8051 - circuit configurations - TESLA Institute

 

RS-232 Interface
Make sure you short RS232_RX with RS232_RX at MAX232 IC. They are nodes. Similarly goes for RS232_TX. MAX232 IC is a Standard RS232 Interface IC used by many hobbyists. DB9 is mostly used for PORT, considering the port is FEMALE on-board connector Pin 2 becomes RX and Pin 3 becomes TX and for male it is interchanged so that when you connect them together the interchanging is done automatically. This are the syntax you need to remember while designing the schematics and hardware. If this DB9 port was a male on-board connector I have to make TX as pin 2 and RX as pin 3 as universal port connections.

You can also replace DB9 with 3 Pin Terminal Block and make use of multi-stranded wires for communication in case of two microcontrollers at distance of 15meters. For larger distance communication RS-485 is used. The circuit configuration for RS-485 is different. We use MAX485 IC.
 

Microcontroller 8051 - circuit configurations - TESLA Institute

 
 
MAX485 IC has been designed to transmit only one data at a time i.e.  it works only in simplex mode. Right now the above circuit is strictly configured to only send data on RS485 Line.

To change this configuration to only receive, you need to remove resistor R4 and change R6 to 10K ohms.
This will now configure above circuit strictly to receive data on RS485 line.

For far away communications I recommend to use two chips and separate Transmit and Receive, because at far distance duplex mode of communication is necessary. RS485 lines can go up to 1km distance.

 

 

Learn with TESLA

b small 1 TESLA INSTYTUTE

TESLA Project

b small 2 TESLA INSTYTUTE

TESLA Training Center

b small 3 TESLA INSTYTUTE

Sunday the 19th. Custom text here - TESLA INSTITUTE