Featured Posts

Most selected posts are waiting for you. Check this out

How To Make Arduino Countdown Timer with LCD || MSD

How To Make Arduino Countdown Timer with LCD || MSD

 Circuit --

Circuit





Code ---
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
#include <LiquidCrystal.h>
#include<EEPROM.h>
const int rs = 7, en = 6, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
const int stsp = A0;
const int inc = A1;
const int dec = A2;
const int set = A3;
const int buzz = 9;
const int relay = 8;
int hrs = 0;
int Min = 0;
int sec = 0;
unsigned int check_val = 50;
int add_chk = 0;
int add_hrs = 1;
int add_min = 2;
bool RUN = true;
bool min_flag = true;
bool hrs_flag = true;
void setup()
{
  lcd.begin(16, 2);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Mr. Screw Driver");
  lcd.setCursor(0, 1);
  lcd.print("COUNTDOWN TIMER");
  pinMode(stsp, INPUT_PULLUP);
  pinMode(inc, INPUT_PULLUP);
  pinMode(dec, INPUT_PULLUP);
  pinMode(set, INPUT_PULLUP);
  pinMode(buzz, OUTPUT);
  pinMode(relay, OUTPUT);
  digitalWrite(relay, LOW); 
  digitalWrite(buzz, LOW);
  if (EEPROM.read(add_chk) != check_val)
  {
    EEPROM.write(add_chk, check_val);
    EEPROM.write(add_hrs, 0);
    EEPROM.write(add_min, 1);
  }
  else
  {
    hrs = EEPROM.read(add_hrs);
    Min = EEPROM.read(add_min);
  }
  delay(1500);
  INIT();
}

void loop()
{
  if (digitalRead(stsp) == LOW)
  {
    lcd.clear();
    delay(250);
    RUN = true;
    while (RUN)
    {
      if (digitalRead(stsp) == LOW)
      {
        delay(1000);
        if (digitalRead(stsp) == LOW)
        {
          digitalWrite(relay, LOW); 
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print("  TIMER STOPPED");
          lcd.setCursor(0, 1);
          lcd.print("----------------");
          delay(2000);
          RUN = false;
          INIT();
          break;
        }
      }
      digitalWrite(relay, HIGH); 
      sec = sec - 1;
      delay(1000);
      if (sec == -1)
      {
        sec = 59;
        Min = Min - 1;
      }
      if (Min == -1)
      {
        Min = 59;
        hrs = hrs - 1;
      }
      if (hrs == -1) hrs = 0;
      lcd.setCursor(0, 1);
      lcd.print("****************");
      lcd.setCursor(4, 0);
      if (hrs <= 9)
      {
        lcd.print('0');
      }
      lcd.print(hrs);
      lcd.print(':');
      if (Min <= 9)
      {
        lcd.print('0');
      }
      lcd.print(Min);
      lcd.print(':');
      if (sec <= 9)
      {
        lcd.print('0');
      }
      lcd.print(sec);
      if (hrs == 0 && Min == 0 && sec == 0)
      {
        digitalWrite(relay, LOW); 
        lcd.setCursor(4, 0);
        RUN = false;
        for (int i = 0; i < 20; i++)
        {
          digitalWrite(buzz, HIGH);
          delay(100);
          digitalWrite(buzz, LOW);
          delay(100);
        }
        INIT();
      }
    }
  }
  if (digitalRead(set) == LOW)
  {
    delay(500);
    while (min_flag)
    {
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("SET MINUTE: ");
      lcd.print(Min);
      delay(100);
      if (digitalRead(inc) == LOW)
      {
        Min = Min + 1;
        if (Min >= 60) Min = 0;
        delay(100);
      }
      if (digitalRead(dec) == LOW)
      {
        Min = Min - 1;
        if (Min <= -1) Min = 0;
        delay(100);
      }
      if (digitalRead(set) == LOW)
      {
        min_flag = false;
        delay(250);
      }
    }
    while (hrs_flag)
    {
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("SET HOUR: ");
      lcd.print(hrs);
      delay(100);
      if (digitalRead(inc) == LOW)
      {
        hrs = hrs + 1;
        if (hrs > 23) hrs = 0;
        delay(100);
      }
      if (digitalRead(dec) == LOW)
      {
        hrs = hrs - 1;
        if (hrs <= -1) hrs = 0;
        delay(100);
      }
      if (digitalRead(set) == LOW)
      {
        hrs_flag = false;
        delay(250);
      }
    }
    if (hrs == 0 && Min == 0)
    {
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("  INVAID TIME");
      delay(2000);
    }
    else
    {
      EEPROM.write(add_hrs, hrs);
      EEPROM.write(add_min, Min);
    }
    INIT();
  }
}

void INIT()
{
  hrs = EEPROM.read(add_hrs);
  Min = EEPROM.read(add_min);
  sec = 0;
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Start / Set Time");
  lcd.setCursor(4, 1);
  if (hrs <= 9)
  {
    lcd.print('0');
  }
  lcd.print(hrs);
  lcd.print(':');
  if (Min <= 9)
  {
    lcd.print('0');
  }
  lcd.print(Min);
  lcd.print(':');
  if (sec <= 9)
  {
    lcd.print('0');
  }
  lcd.print(sec);
  min_flag = true;
  hrs_flag = true;
  delay(500);
}
How To Make A Voltmeter Using Arduino || 0v - 30v ||

How To Make A Voltmeter Using Arduino || 0v - 30v ||

How To Make A Voltmeter Using Arduino 

In order to measure voltages greater than the 5 V reference voltage, you need to divide the input voltage so that the voltage actually input to the Arduino is 5 V or less. in this experiment, we will use a 90.9 kohm resistor and a 10 kohm resistor to create a 10:1 divider. This will allow us to measure voltages up to 50 V.



Hardware Required
  • 1x Arduino UNO
  • 1x 90.9 kohm resistor
  • 1x 10 kohm resistor
  • 1x LCD (Liquid Crystal Display)
  • 1x 5k potentiometer
  • 1x breadboard
  • female connector
  • jumper wires

Wiring Diagram




Code


#include <LiquidCrystal.h>

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

float input_voltage = 0.0;
float temp=0.0;
float r1=90900.0;
float r2=10000.0;


void setup()
{
   Serial.begin(9600);     //  opens serial port, sets data rate to 9600 bps
   lcd.begin(16, 2);       // set up the LCD's number of columns and rows: 
   lcd.print("DIGITAL V METER");
}
void loop()
{
   
//Conversion formula

   int analog_value = analogRead(A0);
    temp = (analog_value * 5.0) / 1024.0; 
   input_voltage = temp / (r2/(r1+r2));
   
   if (input_voltage < 0.1) 
   {
     input_voltage=0.0;
   } 
    Serial.print("v= ");
    Serial.println(input_voltage);
    lcd.setCursor(0, 1);
    lcd.print("Voltage= ");
    lcd.print(input_voltage);
    delay(300);
}




How To Make Multifunction LED Chaser With Arduino ||5 in 1||

How To Make Multifunction LED Chaser With Arduino ||5 in 1||

LED Chaser With Arduino

Hello friends. What's up? Hope doing well. Today we are going to make a simple but very interesting LED Chaser with Arduino.

So let's started............



Required Components:


1. Arduino 

2. LED * 4 Pcs { you can take more }
3. Push Button
4. 100 ohm Resistor [ 1/4 watt ] * 4 Pcs
5. Breadboard
6. Some jumper wires.
7. 10k ohm Resistor 



Circuit Diagram:


Here is the circuit diagram.......






Code:




int buttonstate = 0;
int led1 = 3;
int led2 = 5;
int led3 = 6;
int led4 = 9;
int button = 8;
int brightness = 0;

void setup()
{
  pinMode(button, INPUT);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  
  Serial.begin(9600); 
  
}

void mode1(){
  digitalWrite(led1,HIGH);
  digitalWrite(led2,HIGH);
  digitalWrite(led3,HIGH);
  digitalWrite(led4,HIGH);
  delay(100);
  digitalWrite(led1,LOW);
  digitalWrite(led2,LOW);
  digitalWrite(led3,LOW);
  digitalWrite(led4,LOW);
  delay(100);
  }
  
void mode2(){
  digitalWrite(led1,HIGH);
  delay(100);
  digitalWrite(led2,HIGH);
  delay(100);
  digitalWrite(led3,HIGH);
  delay(100);
  digitalWrite(led4,HIGH);
  delay(100);
  digitalWrite(led1,LOW);
  delay(100);
  digitalWrite(led2,LOW);
  delay(100);
  digitalWrite(led3,LOW);
  delay(100);
  digitalWrite(led4,LOW);
  delay(100);
  }

void mode3(){
  digitalWrite(led4,HIGH);
  delay(100);
  digitalWrite(led3,HIGH);
  delay(100);
  digitalWrite(led2,HIGH);
  delay(100);
  digitalWrite(led1,HIGH);
  delay(100);
  digitalWrite(led4,LOW);
  delay(100);
  digitalWrite(led3,LOW);
  delay(100);
  digitalWrite(led2,LOW);
  delay(100);
  digitalWrite(led1,LOW);
  delay(100);
  }

void mode4(){
 
  for (brightness = 0; brightness <= 255; brightness += 5) {
    analogWrite(led1, brightness);
    analogWrite(led2, brightness);
    analogWrite(led3, brightness);
    analogWrite(led4, brightness);
    delay(30); // Wait for 30 millisecond(s)
  }
  for (brightness = 255; brightness >= 0; brightness -= 5) {
    analogWrite(led1, brightness);
    analogWrite(led2, brightness);
    analogWrite(led3, brightness);
    analogWrite(led4, brightness);
    delay(30); // Wait for 30 millisecond(s)
  }

  digitalWrite(led4,HIGH);
  delay(100);
  digitalWrite(led3,HIGH);
  delay(100);
  digitalWrite(led2,HIGH);
  delay(100);
  digitalWrite(led1,HIGH);
  delay(100);
  digitalWrite(led4,LOW);
  delay(100);
  digitalWrite(led3,LOW);
  delay(100);
  digitalWrite(led2,LOW);
  delay(100);
  digitalWrite(led1,LOW);
  delay(100);
  }

 void mode5(){
  mode1();
  mode2();
  mode3();
  mode4();
  }  

void loop()
{
  int value = digitalRead(button);
 
  if(value == 1){
    delay(1000);
  buttonstate = buttonstate + 1 ;
  }
  Serial.println(buttonstate);
  if(buttonstate > 5){
     buttonstate = 0;
  }
  
  if(buttonstate == 1){
     mode1();
  }

  if(buttonstate == 2){
     mode2();
  }

  if(buttonstate == 3){
     mode3();
  }
  if(buttonstate == 4){
     mode4();
  }
  if(buttonstate == 5){
  
  mode5();
  }  


}




Hurray...Our chaser is ready.
This has 5 different function. Pressing the button you can change the chasing style.
 Enjoy : )