Saturday 21 March 2020

Smart Dustbin using arduino

Code:-

#include <Servo.h>   //servo library
Servo servo;     
int trigPin = 5;    
int echoPin = 6;   
int servoPin = 7;
int led= 10;
long duration, dist, average;   
long aver[3];   //array for average


void setup() {       
    Serial.begin(9600);
    servo.attach(servoPin);  
    pinMode(trigPin, OUTPUT);  
    pinMode(echoPin, INPUT);  
    servo.write(0);         //close cap on power on
    delay(100);
    servo.detach(); 

void measure() {  
 digitalWrite(10,HIGH);
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin, HIGH);
delayMicroseconds(15);
digitalWrite(trigPin, LOW);
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
dist = (duration/2) / 29.1;    //obtain distance
}
void loop() { 
  for (int i=0;i<=2;i++) {   //average distance
    measure();               
   aver[i]=dist;            
    delay(10);              //delay between measurements
  }
 dist=(aver[0]+aver[1]+aver[2])/3;    

if ( dist<50 ) {
//Change distance as per your need
 servo.attach(servoPin);
  delay(1);
 servo.write(0);  
 delay(3000);       
 servo.write(150);    
 delay(1000);
 servo.detach();      
}
Serial.print(dist);
}

Wednesday 18 March 2020

Real Time clock Using Arduino

Code:-



#include<LiquidCrystal.h>
#include <DS3231.h>


// Init the DS3231 using the hardware interface
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
DS3231  rtc(SDA, SCL);

void setup()
{ rtc.begin();
  lcd.begin(16,2);
 
 
  
  
  // The following lines can be uncommented to set the date and time
  rtc.setDOW(WEDNESDAY);     // Set Day-of-Week to SUNDAY
  rtc.setTime(5, 32, 00);     // Set the time to 12:00:00 (24hr format)
  rtc.setDate(18, 3, 2020);   // Set the date to January 1st, 2014
}

void loop()
{
  // Send Day-of-Week
  //Serial.print(rtc.getDOWStr());
  lcd.print("DATE:");
  lcd.print(rtc.getDateStr());
  lcd.setCursor(0,2);
  lcd.print(rtc.getTimeStr());
  lcd.setCursor(9,2);
  lcd.print(rtc.getTemp());
 lcd.print("*C");
  
  // Send date
  //Serial.print(rtc.getDateStr());
  //Serial.print(" -- ");

  // Send time
  //Serial.println(rtc.getTimeStr());
  delay(1000);
  // Wait one second before repeating :)
  
}

Temperature controlled Fan using Arduino

Components using:-

Arduino uno
LM35
LCD 16x2
DC Motor With Blade


Circuit




Code:-

 #include<LiquidCrystal.h>
 LiquidCrystal lcd(12,11,5,4,3,2);
 int val;
int tempPin = A0;
int fan=7 ;
void setup()
{
  lcd.begin(16,2);
Serial.begin(9600);
pinMode(fan,OUTPUT);
digitalWrite(fan,LOW);
lcd.setCursor(0,0);
  lcd.print("Welcome in");
  lcd.setCursor(0,2);
  lcd.print("Technical Hut");
  delay(2000);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Temp controlled");
  lcd.setCursor(0,2);
  lcd.print("cooling System");
  delay(2000);
  lcd.clear();
}
void loop()
{
  
  
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000; 
float cel = mv/10;
lcd.setCursor(0,0);
lcd.print("TEMPRATURE = ");
lcd.print(cel);
lcd.setCursor(0,2);
lcd.print("*C");
delay(1000);

if(cel>40)
{
  digitalWrite(fan,HIGH);
}
else
{ digitalWrite(fan,LOW);
}

}


For discounted price of this kit you can contact to us on wats app 9424581238. Delivery is available in all over india.