Circuit Documentation
Summary
This circuit features an Arduino UNO microcontroller interfaced with an LCD display and includes a trimmer potentiometer for contrast adjustment and a resistor for backlight current limiting. The Arduino UNO controls the LCD, displaying the elapsed time since the circuit was powered on. The potentiometer allows for the adjustment of the display's contrast, and the resistor ensures the correct current flows through the LCD's backlight.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13.
LCD Display (16 pin)
- Description: A 16x2 character LCD display for showing text.
- Pins: VSS, VDD, VO, RS, R_W, E, DB0-DB7, A, K.
Trimmer Potentiometer
- Description: A variable resistor with a 10k Ohm value for adjusting voltage and current.
- Pins: leg1, wiper, leg2.
- Properties: Resistance: 10,000 Ohms.
Resistor
- Description: A fixed resistor used to limit current.
- Pins: pin1, pin2.
- Properties: Resistance: 200 Ohms.
Wiring Details
Arduino UNO
- 5V connected to LCD VDD, Trimmer Potentiometer leg1.
- GND connected to LCD VSS, LCD K, LCD R_W, Trimmer Potentiometer leg2.
- D12 connected to LCD RS.
- D11 connected to LCD E.
- D5 connected to LCD DB4.
- D4 connected to LCD DB5.
- D3 connected to LCD DB6.
- D2 connected to LCD DB7.
LCD Display (16 pin)
- VDD connected to 5V power supply through Arduino UNO.
- VSS, K, R_W connected to ground through Arduino UNO.
- VO connected to the wiper of the Trimmer Potentiometer.
- RS connected to Arduino UNO D12.
- E connected to Arduino UNO D11.
- DB4-DB7 connected to Arduino UNO D5-D2 respectively.
- A connected to one end of the Resistor.
Trimmer Potentiometer
- leg1 connected to 5V power supply through Arduino UNO.
- wiper connected to LCD VO.
- leg2 connected to ground through Arduino UNO.
Resistor
- pin1 connected to 5V power supply through Arduino UNO.
- pin2 connected to LCD A.
Documented Code
#include <LiquidCrystal.h>
// Initialize the LCD with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
unsigned long startTime;
void setup() {
// Set up the LCD's number of columns and rows
lcd.begin(16, 2);
// Print a message to the LCD
lcd.print("Elapsed Time:");
// Initialize the start time
startTime = millis();
}
void loop() {
// Calculate the elapsed time in milliseconds
unsigned long elapsedTime = millis() - startTime;
// Convert elapsed time to seconds with one decimal place
float elapsedTimeSec = elapsedTime / 1000.0;
// Set the cursor to the second row, first column
lcd.setCursor(0, 1);
// Print the elapsed time to the LCD
lcd.print(elapsedTimeSec, 1); // 1 specifies the number of decimal places
// Add a small delay to avoid flickering
delay(100);
}
This code is designed to run on the Arduino UNO microcontroller. It initializes the LCD display and continuously updates it with the elapsed time since the Arduino was reset or powered on. The time is displayed in seconds with one decimal place. The LCD is configured to use a 4-bit data interface with the Arduino, and the potentiometer is used to adjust the contrast of the display.
