Input Devices

Pablo, Andrea and Daphne have offered to do an online session and help us with the deliveries of Fab Academy input and output devices. The truth is that it has helped us a lot to resolve doubts and detect the small errors that generate frustration.

First we have started looking at different typologies of temperature sensors, such as: LM35 and DHT11. Below we have searched online tutorials on these components to connect the sensors with the Arduino UNO board and enter the example code.



Tutorial: Temperature LM35

https://wiki.keyestudio.com/Ks0022_keyestudio_LM35_Linear_Temperature_Sensor

After understanding the base code, we have compiled it and tested whether the temperature sensor was working correctly. In case it didn’t work we have been reading the code line by line until we slightly modified the values that we thought could give an error. In my case, when checking that the sensor was connected to the pin correctly, I have changed the delay value from 500 to 1000 and the sensor has worked.



Detecting Temperature with LM35

Zoom session with Pablo, Andrea and Daphne as experts and Luang, Ergina and me as students.


LM35 from Keystudio connected to an Arduino UNO. In this LM35 board there's a capacitor attached to the temperature sensor.



Explaining the code of detecting Temperature with LM35

Inside the "void setup" there’s one line of code:

"Serial.begin" starts at 9600 bauts/second, this value needs to be the same as the "serial monitor" to see the values correctly.

Inside "void loop there are different lines of code:

First it is declared to functions "unsigned.int val" and "unsigned.int dat" which means: value and data.

Then it is said that integral value is equal to "analogRead(0)" of pin 0.

"unsigned.int dat" this means that integral data is equal to (500 * value in pin 0) / 1024. This is a conversion factor.

Then "serial.print" displays the temperature on "Serial Monitor" of Arduino code with the script “Temp”.

And also it displays the value of the data temperature, for example: Temp: 32C.

After this it prints the script "C" and also it changes line, for this reason the function is called "serial.println(“C”)".

Finally the "delay(1000)" is the time it takes in milliseconds (1000) until it shows the next value. In the first code, the delay was 500 and when I was doing "Monitor Serie" it wasn’t working well, then I change it to 1000 and the values were correct.



Temperature + Humidity DHT11

The sensor doesn't read the temperature, it appears "Time our error"


After changing the delay from 500 to 1500 the sensor reads well temperature and humidity.


Sensor of temperature and humidity DHT11 connected to an Arduino UNO board.


Here you can find the files:
Temp_LM35
Temp_DHT11



Faculty

Pablo Zuloaga, Andrea Bertran, Daphne Gerodimou and Future Learning Unit Team

Year

12/2/2020

Category

Fab Academy