Posts

Showing posts from October, 2024

Measuring and Displaying Solar Panel Voltage on an LCD using Arduino

Image
 Measuring and Displaying Solar Panel Voltage on an LCD using Arduino Step 1: Components Required Arduino Board (e.g., Arduino Uno) Solar Panel (small panel with known voltage range) Voltage Divider Resistors (e.g., 15kΩ and 5kΩ) 16x2 LCD with I2C Interface Jumper Wires Breadboard (optional for ease of connections) Step 2: Circuit Diagram Connect the Solar Panel: Connect the positive terminal of the solar panel to the input of the voltage divider circuit. Use resistors R1 (15kΩ) and R2 (5kΩ) to step down the voltage to a range readable by the Arduino (0-5V). Voltage Divider Connections: Solar Panel + connects to the junction between R1 and R2. R2 connects to GND . The voltage reading point (junction between R1 and R2) goes to A0 (analog input) of the Arduino. Connect the LCD: If using an I2C LCD , connect the LCD pins as follows: GND to Arduino GND VCC to Arduino 5V SDA to Arduino A4 SCL to Arduino A5 Step 3: Arduino Code Use the following code to read the solar panel ...
arduino comunication  

4.Displaying Weight and Force from an FSR on an I2C LCD using Arduino

 Displaying Weight and Force from an FSR on an I2C LCD using Arduino Circuit: FSR Setup : Connect one end of the FSR to 5V. Connect the other end of the FSR to an analog pin (e.g., A0) and a 10kΩ resistor. Connect the other side of the resistor to GND. I2C LCD Setup : Connect the LCD's SDA and SCL pins to the corresponding pins on the Arduino (usually A4 and A5 for Arduino Uno). Connect VCC to 5V and GND to GND. Code: Here's the code that reads the FSR value and displays the weight in grams and force in newtons on the LCD: C++ Code # include <Wire.h> # include <Adafruit_LiquidCrystal.h> Adafruit_LiquidCrystal lcd ( 0 ) ; // Initialize the I2C LCD (default I2C address 0x20) int fsrPin = A0; // Analog pin connected to FSR int fsrReading; // Variable to store the FSR reading float calibrationFactor = 0.5 ; // Calibration factor to convert FSR reading to weight in grams (example value) float weight; // Calculated weight in gr...

3.FSR with Buzzer

 FSR with Buzzer Circuit: FSR Setup : Connect one end of the FSR to 5V. Connect the other end of the FSR to an analog pin (e.g., A0) and a 10kΩ resistor. Connect the other side of the resistor to GND. Buzzer Setup : Connect the positive terminal of the buzzer to a digital pin (e.g., pin 11). Connect the negative terminal of the buzzer to GND. Code: The code below reads the FSR value and activates the buzzer if the force exceeds a defined threshold. C++Code int fsrPin = A0; // Analog pin connected to FSR int fsrReading; // Variable to store the FSR reading int threshold = 600 ; // Threshold value to activate the buzzer int buzzerPin = 11 ; // Pin connected to the buzzer void setup () { pinMode (buzzerPin, OUTPUT); // Set the buzzer pin as an output Serial. begin ( 9600 ); // Start serial communication at 9600 baud } void loop () { fsrReading = analogRead (fsrPin); // Read the value from FSR Serial. print ( "FSR Reading: " ); Seria...

2. FSR with led

 FSR with led Circuit: FSR Setup : Connect one end of the FSR to 5V. Connect the other end of the FSR to an analog pin (e.g., A0) and a 10kΩ resistor. Connect the other side of the resistor to GND. LED Setup : Connect the positive (anode) of the LED to a digital pin (e.g., LED1 to pin 13, as per your setup). Connect the negative (cathode) of the LED to a current-limiting resistor (e.g., 220Ω) and then to GND. Code: The code below reads the FSR value and turns on the LED if the force exceeds a defined threshold. C++ Code int fsrPin = A0; // Analog pin connected to FSR int fsrReading; // Variable to store the FSR reading int threshold = 600 ; // Threshold value to turn on the LED int ledPin = 13 ; // Pin connected to LED1 void setup () { pinMode (ledPin, OUTPUT); // Set the LED pin as an output Serial. begin ( 9600 ); // Start serial communication at 9600 baud } void loop () { fsrReading = analogRead (fsrPin); // Read the value from FSR Se...

1.Force Sensor Serial print

 Force Sensor Serial print Circuit: Connect one end of the FSR to 5V. Connect the other end of the FSR to an analog pin (e.g., A0) and a 10kΩ resistor. Connect the other side of the resistor to GND, creating a voltage divider. Code: The code below reads the analog value from the FSR and converts it into weight using a simple calibration factor. C++Code int fsrPin = A0; // Analog pin connected to FSR int fsrReading; // Variable to store the FSR reading float calibrationFactor = 0.5 ; // Calibration factor to convert FSR reading to weight (example value) void setup () { Serial. begin ( 9600 ); // Start serial communication at 9600 baud } void loop () { fsrReading = analogRead (fsrPin); // Read the value from FSR float voltage = fsrReading * ( 5.0 / 1023.0 ); // Convert analog reading to voltage // Convert voltage to force (in Newtons or weight in grams based on calibration) float weight = voltage * calibrationFactor; Serial. print ( "FSR Rea...

4.Keypad-Controlled Lock System with Servo and I2C LCD Using Arduino

 Keypad-Controlled Lock System with Servo and I2C LCD Using Arduino Components Needed: Arduino board 4x4 or 4x3 Keypad I2C LCD Servo motor Jumper wires Breadboard (optional) Connections: Keypad : Connect the keypad pins to Arduino digital pins (e.g., rows to pins 9, 8, 7, 6 and columns to pins 5, 4, 3, 2). I2C LCD : Connect the SDA and SCL pins to Arduino I2C pins (A4 and A5 on an Uno). Servo : Connect the servo motor's signal pin to pin 10. Example Code: #include <Keypad.h> #include <Servo.h> #include <Wire.h> #include <Adafruit_LiquidCrystal.h> const byte ROWS = 4; // Number of rows const byte COLS = 4; // Number of columns char keys[ROWS][COLS] = {   {'1', '2', '3', 'A'},   {'4', '5', '6', 'B'},   {'7', '8', '9', 'C'},   {'*', '0', '#', 'D'} }; byte rowPins[ROWS] = {9, 8, 7, 6};    // Connect to row pins of keypad byte colPins[CO...

3.Controlling a Servo Motor with a Keypad and Arduino

Image
Controlling a Servo Motor with a Keypad and Arduino Components Needed: Arduino board 4x4 or 4x3 Keypad Servo motor Jumper wires Breadboard (optional) Connections: Keypad : Connect the keypad pins to digital pins on your Arduino (e.g., rows to pins 9, 8, 7, 6 and columns to pins 5, 4, 3, 2). Servo : Connect the servo motor: Signal pin to a PWM digital pin on the Arduino (e.g., pin 10). Power (VCC) to 5V. Ground (GND) to GND. Example Code: C++ Code # include <Keypad.h> # include <Servo.h> const byte ROWS = 4 ; // Number of rows const byte COLS = 4 ; // Number of columns char keys[ROWS][COLS] = { { '1' , '2' , '3' , 'A' }, { '4' , '5' , '6' , 'B' }, { '7' , '8' , '9' , 'C' }, { '*' , '0' , '#' , 'D' } }; byte rowPins[ROWS] = { 9 , 8 , 7 , 6 }; // Connect to row pins of keypad byte colPins[COLS] = { 5 , 4 , 3 , 2 }; // Connec...

2.Controlling LEDs with a Keypad and Arduino

Image
 Controlling LEDs with a Keypad and Arduino Components Needed: Arduino board 4x4 or 4x3 Keypad LEDs (e.g., 3 LEDs) Resistors (e.g., 220Ω for each LED) Jumper wires Breadboard (optional) Connections: Keypad : Connect the keypad pins to digital pins on your Arduino (e.g., rows to pins 9, 8, 7, 6 and columns to pins 5, 4, 3, 2). LEDs : Connect the LEDs to digital pins (e.g., LED1 to pin 13, LED2 to pin 12, LED3 to pin 11). Don’t forget to add a current-limiting resistor in series with each LED. Example Code: C++ Code # include <Keypad.h> const byte ROWS = 4 ; // Number of rows const byte COLS = 4 ; // Number of columns char keys[ROWS][COLS] = { { '1' , '2' , '3' , 'A' }, { '4' , '5' , '6' , 'B' }, { '7' , '8' , '9' , 'C' }, { '*' , '0' , '#' , 'D' } }; byte rowPins[ROWS] = { 9 , 8 , 7 , 6 }; // Connect to row pins of keypad byte colPins...

4.Light-Controlled Multi-LED System Using an LDR and Arduino

Image
 Light-Controlled Multi-LED System Using an LDR and Arduino In this project, we'll use an LDR (Light Dependent Resistor) to control multiple LEDs based on the ambient light level. Depending on the light intensity, different LEDs will turn on or off to indicate the current light condition. Components Needed: Arduino board LDR (photoresistor) 10kΩ resistor Multiple LEDs (e.g., 3 different colors) 220Ω resistors (one for each LED) Breadboard and jumper wires Circuit Connections: LDR Circuit : Connect one leg of the LDR to 5V on the Arduino. Connect the other leg of the LDR to an analog input pin (e.g., A0) and a 10kΩ resistor. Connect the other end of the 10kΩ resistor to GND. LED Circuits : Connect the anode (longer leg) of each LED to a different digital pin (e.g., 11, 12, 13). Connect a 220Ω resistor in series with the cathode of each LED, and connect the other end of the resistor to GND. Example Code: C++ Code int ldrPin = A0; // Analog pin for LDR int led1Pin = 11 ; /...

3.Light-Controlled Buzzer Using an LDR and Arduino

Image
 Light-Controlled Buzzer Using an LDR and Arduino Components Needed: Arduino board LDR (photoresistor) 10kΩ resistor Buzzer (active or passive) Breadboard and jumper wires Circuit Connections: LDR Circuit : Connect one leg of the LDR to 5V on the Arduino. Connect the other leg of the LDR to an analog input pin (e.g., A0) and a 10kΩ resistor. Connect the other end of the 10kΩ resistor to GND. Buzzer Circuit : Connect the positive pin of the buzzer to a digital pin (e.g., 9). Connect the negative pin of the buzzer to GND. Example Code: C++ Code int ldrPin = A0; // Analog pin for LDR int buzzerPin = 9 ; // Digital pin for buzzer int threshold = 500 ; // Threshold value for light level void setup () { pinMode (buzzerPin, OUTPUT); // Set buzzer pin as output Serial. begin ( 9600 ); // Start serial communication } void loop () { int ldrValue = analogRead (ldrPin); // Read LDR value Serial. println (ldrValue); // Print LDR value to Serial M...