Sunday, May 31, 2015

Export Temperature data to Thingspeak using ESP8266 and DHT11

Hi all , If you want to make a simple and less cost IOT (Internet Of Things)  which transfer temperature and humidity data to a website and stores your real time data for monitoring , then this post will full fill all your requirement.

All you need for this project is a esp8266 esp-12 WiFi module and a DHT11 temperature and humidity sensor, no need for arduino or any other microcontroller to support this WiFi module for this project , esp8266 esp-12 can work standalone without using a microcontroller to support it.


Step by Step instruction to make this work is explained in the video below:







How to upload nodemcu firmware and other details can be find in the link here

1) Register in Thingspeak.com and create a new channel with 2 fields namely, Temperature and humidity.

2) download the lua program here

3) connect dht11 to the gpio2 of the esp8266 WiFi module.

4) connect esp8266 to your PC

5) extract dht11.rar file that downloaded

6) Open the downloaded file in the Esplorer window

7) Copy the Write key provided from the thingspeak and paste into the dht11.lua program (refer to the video if you are not sure about this)

8) Edit your Wifi SSID and password in the Init.lua Program.

9) Firslty save the dht11.lua to the esp8266 , Secondly save the Init.lua file to the WiFi module.

10) you can check the program successfully uploaded in the esplorer window, once it connected to your Home WiFi network, you can see the IP address assigned to the WiFi module, and you can also see the current temperature and humidity in the Esplorer window.

11) check your channel in the thingspeak.com, you can see the real-time data from your WiFi moudle.





Monday, May 11, 2015

Automating CD Driver Stepper Motor Using IR Sensor





Take a look at this video you know what is project is all about.



I had a CD driver which has not been used for a very long time with me, I removed the case and opened the lens carriage, I thought of using it for a portable plotter before going for the exact idea I wanted to operate the motor automatically with IR sensors , that's how this project was started. It was so much of fun doing this, where you can easily do this project less than $10 if you have arduino with you.



I started it by removing the upper case of the CD driver, which is really easy to do, in the bottom of the driver it had some 4 screws to remove, you don't need to be a professional for doing this kind of job, anyone can do it. 




This lens carriage is the only part that required for this project, apart from this lens carriage there are also a CD Open and closer mechanism and a motor also present inside this CD driver which I can use for some other project. 


If possible remove the stepper motor from the lens carriage, which would allow us to easily solder the stepper motor, or you can also solder without removing it. 



connect the stepper motor to the L293d Motor driver , complete the circuit with the help of the above fritzing .

Arduino Program: 
// I have modified the stepper one revolution program, you can also write your own version for this, programming a stepper with arduino is really easy with the available library, If you are using this project Easy stepper driver Please note this program will not work for it, you need modification for it, please leave a comment , I can also upload the program for easy drive if you really need it.


------------------------------------------------------------------------------------------------------------------------------
#include <Stepper.h>

int motor = 1;

const int stepsPerRevolution = 180;  // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
  pinMode(2, INPUT);
  pinMode(3, INPUT);
  // set the speed at 60 rpm:
  myStepper.setSpeed(60);
  // initialize the serial port:
  Serial.begin(9600);
}

void loop() {
  // step one revolution  in one direction:
  int sensor1 = digitalRead(2);
  int sensor2 = digitalRead(3);
  
  if(sensor1 == HIGH && sensor2 == LOW){
    motor = 1;
  }
  
  if (sensor1 == LOW && sensor2 == HIGH){
   motor = 2;}
  
   
    if(motor ==1){
  Serial.println("clockwise");
  myStepper.step(stepsPerRevolution);
  delay(5);
  }
  // step one revolution in the other direction:
  else
{
  Serial.println("counterclockwise");
  myStepper.step(-stepsPerRevolution);
  delay(5);}
}

--------------------------------------------------------------------------------------------------------------------------------

alternatively you can download the same program here

You can also make your own IR sensor following the video below: 


IR sensors are easily available in all the online electronics and hobbyist shops, you can also make your own IR sensor with just a dollar. 

Sunday, May 10, 2015

Temperature Indicator using LM35, Arduino and display temperature using LCD 16x2


Temperature Indicator is a simple easy to do project, which I did it in less than 10 minutes, If you want to build your own temperature display for your home, you can choose this project, or you can use this project to submit in your school too, to get some extra credit. 

What are the components Used :
1.Arduino
2.LM35 (temperate sensor) very less cost compare to any other temperature sensor
3.LCD 16x2 
4.10k Pot , breadboard and connecting wires.


You can check the above video to know How this circuit works


Arduino Program:

-----------------------------------------------------------------------------------------------------------------------------

#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int Tempsensor = A0;


void setup() {
  lcd.begin(16, 2);
  pinMode(5, OUTPUT);
}

void loop() {
  
  float temp = analogRead(Tempsensor);
  temp = temp * 0.48828125; // (5*1000)/1024 = 0.48828125
  delay(100);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print(" Temperature");
  lcd.setCursor(0, 1);
  lcd.print(temp);
  lcd.print((char)223); // degree symbol for displaying temperature in arduino LCD
  lcd.print("C");
  delay(200);
}

-----------------------------------------------------------------------------------------------------------------------------


LM35 Pin diagram



Wednesday, May 6, 2015

Automatic Water level controller with Level display on LCD





previously I made an automatic water level controller , you can check this link here, Please check the link which I have given to know more about the detail of this project. This is an upgrade version to the previous one, I've added an LCD display to the project to display the water level.

Arduino Code:

/*
 HC-SR04 Ping distance sensor:
 VCC to arduino 5v 
 GND to arduino GND
 Echo to Arduino pin 9 
 Trig to Arduino pin 8*/
 /* LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)*/

#include<LiquidCrystal.h> // include the library code for lcd
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //  
#define echopin  9 // echo pin
#define trigpin 8 // Trigger pin

int maximumRange = 50;
long duration, distance;

void setup() {
  lcd.begin(16,2);
  Serial.begin (9600);
  pinMode (trigpin, OUTPUT);
  pinMode (echopin, INPUT );
  pinMode (4, OUTPUT);
  pinMode (13,OUTPUT);
}
  
void loop ()
{
  {
    digitalWrite(trigpin,LOW);
    delayMicroseconds(2);
    
    digitalWrite(trigpin,HIGH);
    delayMicroseconds(10);
    
    duration=pulseIn (echopin,HIGH);
    
    distance= duration/58.2;
    delay (50);
    Serial.println(distance);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("water level :");
    lcd.print(distance);
    delay(100);
    
  }
  
 if (distance >= 25 ){
   digitalWrite (7,HIGH);// connect to relay(motor)
   digitalWrite (13,HIGH);
   lcd.setCursor(0,1);
   lcd.print("Motor Started");
   delay(100);
 }

 else if (distance <=5) {
   digitalWrite (7,LOW); // connect to relay(motor)
   digitalWrite (13,LOW);
   lcd.setCursor(0,1);
   lcd.print("Tank is full");
   delay(100);
   
 }

}

----------------------------------------------------------------------------------------------------------------------------

Arduino file can be downloaded from this link here