90
90 points

Napravite vrlo jedostavno svoj mjerač temperatre sa Arduinom i LM35 senzorom. Arduino-Temperature-sensor-LM35Spojite senzor na način kako je prikazano na slici, a u Arduino stavite ovaj kod:

float temp;
int tempPin = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
temp = analogRead(tempPin);
temp = temp * 0.48828125;
Serial.print("TEMPRATURE = ");
Serial.print(temp);
Serial.print("*C");
Serial.println();
delay(1000);
}

Temperature Sensor: LM35 LM35DZ LM35CAZ TO-92 (order here)

Da biste vidjeli temperaturu pogledajte u “Serial monitor” u Arduino softveru.

Evo kako smo dobili broj 0.48828125:
(SUPPLY_VOLTAGE x 1000 / 1024) /10, gdje je:

  • SUPPLY_VOLTAGE –  5.0V (voltaža za napajanje LM35 senzora)
  • 1024 je 2^10, vrijednost gdje je analogna vrijednostvalue where the analog value can be represented by ATmega (cmiiw) or the maximum value it can be represented is 1023. The actual voltage obtained by VOLTAGE_GET / 1024.
  • 1000 is used to change the unit from V to mV
  • 10 is constant. Svaki 10 mV je direktno proporcionalno sa 1 Celcius.

Broj smo dobili izračunom: (5.0 * 1000 / 1024) / 10 = 0.48828125

 Tako je za 4.5V izračun ovakav:

(SUPPLY_VOLTAGE x 1000 / 1024) / 10 = (4.5 x 1000 / 1024) / 10 =0.439453125

Ovaj senzor bi trebao mjeriti temperature od -55 to +150 *c

 

Ovo je kod:

float temp;
int tempPin = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
temp = analogRead(tempPin)/9.31;
Serial.print("TEMPRATURE = ");
Serial.print(temp);
Serial.print("*C");
Serial.println();
delay(500);
}

Ovo je drugi kod:


float temp;
int tempPin = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
temp = analogRead(tempPin)/9.31;
Serial.print("TEMPRATURE = ");
Serial.print(temp);
Serial.print("*C");
Serial.println();
delay(1000);
}

plus500
Plus500

Like it? Share with your friends!

90
90 points
Admin

0 Comments

Choose A Format
Personality quiz
Series of questions that intends to reveal something about the personality
Trivia quiz
Series of questions with right and wrong answers that intends to check knowledge
Poll
Voting to make decisions or determine opinions
Story
Formatted Text with Embeds and Visuals
List
The Classic Internet Listicles
Countdown
The Classic Internet Countdowns
Open List
Submit your own item and vote up for the best submission
Ranked List
Upvote or downvote to decide the best list item
Meme
Upload your own images to make custom memes
Video
Youtube, Vimeo or Vine Embeds
Audio
Soundcloud or Mixcloud Embeds
Image
Photo or GIF
Gif
GIF format