In the previous post, the basic circuit is complete but still can't see any result yet. This is because there is no input and output attached to the I/O pins to show any result. Below is the basic input and output circuit for this project:
Input Circuit
Figure 7: Input Circuit
The push button input is a very simple and direct input. It has being put in the circuit replacing the input from J6 connector (signal status from the 1st RCCB) for simulating in the Proteus Software for output generating. As in the circuit above, push button is being pulled up by R4 (10KOhm Resistor) to Vcc. So, when the push button is being released, the voltage will be Vcc (5V, since it is being pulled up to Vcc), and when push button is being pressed, the voltage will be 0V. This type of input is called active low input, where the output voltage is 0V or Logic 0 when it is active (button pressed). Sometime, there is a circuit that will put a resistor before the digital input port. The function of the resistor is to protect the digital input port at the microcontroller, just in case that the digital input port is being configured as an output, and the resistor will limit the current from the port.
Output Circuit
There are 3 output circuit for this project:
1) LED
Figure 8: Basic Output Circuit
When OUTPUT 2 receive logic condition from the microcontroller, R10 (330kohm) will limit the current to the D3 LED. The D3 LED will on.
2) LCD
Figure 9: LCD Pins Diagram
The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line LCDs which have only 1 controller and support at most of 80 characters. Most LCDs with 1 controller has 14 pins. Pin description is shown in the table below:
Figure 10: Character LCD Pins with 1 Controller
Display data RAM (DDRAM) stores display data represented in 8-bit character codes. Its extended capacity is 80 X 8 bits, or 80 characters. The area in display data RAM (DDRAM) that is not used for display can be used as general data RAM. So whatever user sends on the DDRAM is actually displayed on the LCD. For LCDs like 1x16, only 16 characters are visible, so whatever user write after 16 chars is written in DDRAM but is not visible to the user.
Figure 11: DDRAM Address for 2 Line LCD
2.1) LCD Circuit
Figure 12: LCD Circuit Connection
Above is the connection diagram of LCD in 4-bit mode, only 7 pins needed to interface with an LCD. D4 - D7 are the data pins connection and Enable and Register select are for LCD control pins. The Read/Write (RW) pin of the LCD will not be using, as the data only writing on the LCD. So, it has to be grounded permanently. If user wants to use it, then they may connect it on controller but that will only increase another pin and does not make any big difference. The unwanted data pins of LCD i.e. Vss, VEE and D0-D3 are connected to ground.
There are many reasons why use LCD in 4-bit mode instead of 8-bit. One basic reason is lesser number of pins are needed to interface LCD.
More about LCD
3) Relay Switching
Figure 13: Relay Switching Circuit
For the above circuit, when the base of the transistor receive any supply from the microcontroller, it will allow the 5V to the ground without active the relay. Otherwise, the relay will active and create a back e.m.f that will turn the switching from the normally open to normally close (which is turn on the Backup RCCB).