Difference between revisions of "Reading Temperature with Starter AVR"
(6 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
Refer [[Reading Temperature with AVR ADC]] for basics of Atmega32 ADC and LM35 temperature sensor. | Refer [[Reading Temperature with AVR ADC]] for basics of Atmega32 ADC and LM35 temperature sensor. | ||
=Hookup= | =Hookup= | ||
− | Instead of LM35 temperature we can | + | [[file:0_LM35_Starter_AVR.png]] |
+ | Instead of LM35 temperature we can use on board pot to read the raw data from ADC. | ||
− | =Code= | + | =Code to Read Voltage= |
− | = | + | This code is for reading a raw data from a ADC0 pot on board, which is connected to PA0 |
+ | <html> | ||
+ | <script src="https://gist.github.com/vaibhavkatkar18/53bc1278f642e8a05ace5aa9051bb65b.js"></script> | ||
+ | </html> | ||
+ | =Code to Read Temperature= | ||
+ | This code is to read data from LM35, connected to PA1. | ||
+ | <html> | ||
+ | <script src="https://gist.github.com/vaibhavkatkar18/f0bde21e1256bf2b17f5a9a89d397f1c.js"></script> | ||
+ | </html> | ||
+ | |||
+ | =Demo= | ||
+ | To display the ADC value open the terminal connect the COM port, we will get output as shown in below image. | ||
+ | [[file:ADC temp.PNG]] | ||
+ | = Downloads= | ||
+ | Download the complete project folder from the below link: | ||
+ | https://github.com/ExploreEmbedded/ATmega32_ExploreStarterAvr/archive/master.zip<br> | ||
+ | |||
+ | |||
+ | |||
+ | Have a opinion, suggestion , question or feedback about the article let it out here! | ||
{{DISQUS}} | {{DISQUS}} |
Latest revision as of 15:26, 20 April 2016
In this tutorial we will set up and read the temperature from LM35 using ADC of Atmega32 from Starter AVR board.
Basic
Initially we will read a raw data from ADC. Atmega32 comes with 10-bit 8-channel inbuilt ADC. We will connect 10k Pot to channel 0, vary it and read the raw voltage. After that we will connect the LM35 temperature sensor to channel 0 and read the temperature as shown in hook up. We will display the converted value on terminal.
Refer Reading Temperature with AVR ADC for basics of Atmega32 ADC and LM35 temperature sensor.
Hookup
Instead of LM35 temperature we can use on board pot to read the raw data from ADC.
Code to Read Voltage
This code is for reading a raw data from a ADC0 pot on board, which is connected to PA0
Code to Read Temperature
This code is to read data from LM35, connected to PA1.
Demo
To display the ADC value open the terminal connect the COM port, we will get output as shown in below image.
Downloads
Download the complete project folder from the below link:
https://github.com/ExploreEmbedded/ATmega32_ExploreStarterAvr/archive/master.zip
Have a opinion, suggestion , question or feedback about the article let it out here!