Posts

Showing posts from December, 2024

Arduino code program to display text on the LCD

Image
  Arduino code program to display text on the LCD To interface an Arduino Uno with an LCD , you typically use an LCD module with an HD44780 controller . This is one of the most common types of LCDs used in Arduino projects. Below is a step-by-step guide: Components Required Arduino Uno 16x2 LCD (HD44780 compatible) 10k Ohm potentiometer (for contrast adjustment) Breadboard and jumper wires 220 Ohm resistor (for backlight LED) Arduino Code Example Here’s a simple program to display text on the LCD: # include <LiquidCrystal.h> // Initialize the library with the pins connected to the LCD LiquidCrystal lcd ( 12 , 11 , 5 , 4 , 3 , 2 ) ; void setup () { // Set up the LCD's number of columns and rows: lcd. begin ( 16 , 2 ); // Print a message to the LCD. lcd. print ( "Hello, Arduino!" ); } void loop () { // Move the cursor to the second line lcd. setCursor ( 0 , 1 ); // Print another message lcd. print ( "LCD Interface" ); } Exp...

School Project: Temperature Controlled Fan using Arduino in Proteus

Image
Below is an Arduino code for a temperature-controlled fan using an analog temperature sensor (e.g., LM35) connected to an analog pin. The fan speed is controlled using PWM output. This code is suitable for simulation in Proteus. Arduino Code: Copy the code and Paste: // Temperature-Controlled Fan Using Arduino // Components: LM35 (Temperature Sensor), DC Fan, Arduino UNO, and NPN Transistor // Pin configuration const int tempPin = A0;       // Analog pin connected to LM35 const int fanPin = 9;         // PWM pin connected to the fan (via transistor) // Temperature thresholds const float tempMin = 25.0;   // Minimum temperature (in Celsius) for the fan to start const float tempMax = 40.0;   // Maximum temperature (in Celsius) for full fan speed void setup() {   pinMode(fanPin, OUTPUT);    // Set the fan pin as an output   Serial.begin(9600);         // Initialize serial communica...