Ocean of Programming: Project
Showing posts with label Project. Show all posts
Showing posts with label Project. Show all posts

Wednesday, 21 February 2018

How to interface LM35(Temperature Sensor) with Arduino

February 21, 2018 0
How to interface LM35(Temperature Sensor) with Arduino
       In this article, I am going to explain how to connect LM35 with Arduino. The LM35 series are precision integrated-circuit temperature devices with an output voltage linearly proportional to the Centigrade temperature. It operates from 4 V to 30 V and Calibrated Directly in Celsius (Centigrade). It Rated for Full −55°C to 150°C Range and low-Impedance Output, 0.1 Ω for 1-mA Load. 
        From Arduino ADC we read the analog value and then we will convert it to the °C. Arduino has 10bit ADC so we need to multiply the read value by 1024 and divide it by the voltage provided to LM35 to get the temperature in °C.

void setup() {
Serial.begin(9600); 
}
void loop()  
{
int analog = analogRead(A0);
float MV = (analog/1024.0) * 5000; //5000 is the voltage provided
float celsius = MV/10;
Serial.print("In Degree Celsius= ");
Serial.println(celsius);
delay(1000);
}
          In the above program, I am reading the analog value from A0 pin and multiplying it by 1024 and dividing it by 5000. Diving it by 5000 is necessary due to supplied voltage to LM35 is 5V and 5000 it is in millivolts. Change the value according to your power to LM35 but put the value in millivolts only.
         Consider instead of 5V you provided 3.3V then put the value as 3300 if you put wrong value then you will get the wrong result. It will continuously read the temperature at the interval of 1000ms. If you are simulating in Proteus then must connect TXD of Arduino to the RXD of the serial window.
           After dumping the program into Arduino start serial monitor to observe the values. I am adding a screenshot of Protus Simulation software.
           Please feel free to comment if you find anything incorrect or you want to share more information about the topic discussed above.

Tuesday, 20 February 2018

How to interface LED with Arduino

February 20, 2018 0
How to interface LED with Arduino
            In this tutorial, I am going to tell you how to interface an LED with Arduino. I am using the inbuilt LED of Arduino for this tutorial. Inbuilt LED is present at pin number 13. When the output signal is HIGH then LED turns on and when the output signal is LOW then the LED is off. In between on and off provided 1000ms delay observing the output.
            In void setup, the setup is provided that is pin 13 is made as an output pin and in a void loop, the instructions are provided that executes continuously. In place of ledPin directly you can put pin number or LED_BUILTIN to connect the built-in LED.
int ledPin = 13;
void setup() {
  pinMode(ledPin,OUTPUT);
}
void loop() {
  digitalWrite(ledPin,HIGH);
  delay(1000);
  digitalWrite(ledPin,LOW);
  delay(1000);
}

Output When LED ON
Output when LED OFF
           Please feel free to comment if you find anything incorrect or you want to share more information about the topic discussed above.