Lesson 19--Microduino "Sampling ADC of internal reference source"

来自Microduino Wikipedia
Jasonsheng讨论 | 贡献2014年2月18日 (二) 12:29的版本 (Created page with "{| style="width: 800px;" |- | ==Objective== When using LM35, voltage increased 10mv, corresponding temperature rises 1℃, there is a linear relationship between them, theref...")
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索

Objective

When using LM35, voltage increased 10mv, corresponding temperature rises 1℃, there is a linear relationship between them, therefore, it needs high stablility for the voltage. This experiment will collect temperature combine LM35 by calling Microduino internal reference source (3.3V or 1.1V voltage).

Equipment

  • Microduino-Core
  • Microduino-FT232R
  • Other hardware equipment
    • Breadboard Jumper one box
    • Breadboard one piece
    • LM35D sensor one
    • USB Data cable one
    • Digital multimeter one

Experimental schematic

The VCC pin of LM35 connects to 5V,GND connect to GND,and VOUT connect to A0.

Experiment One

  • Use Microduino-Ft232RL power
    • Program
void setup() {
   Serial.begin(115200);         //Set the baud rate 115200
   pinMode(A0, INPUT); 
}
void loop() {
  int n = analogRead(A0);    //Read the voltage from A0 port
  double vol = n * (5.0 / 1024.0*100);   //Use double type variable to save the temperature value which converted from voltage
  Serial.println(vol);                   //Output the temperature from serial
    delay(1000);                       //Wait for 1s to refresh data
}

The data in serial monitor:

Experiment two

  • Use Microduino internal reference source 1.1V to calcuate temperature value
    • Program
void setup() {
  Serial.begin(115200);         //Set the baud rate 115200
  analogReference(INTERNAL);  //Invoke 1.1V onboard power souce
}
void loop() {
  int n = analogRead(A0);    //Read the voltage from A0 port
  double vol = n * (1.1 / 1024.0*100);    //Use double type variable to save the temperature value which converted from voltage
  Serial.println(vol);                   //Output the temperature from serial
  delay(1000);                        //Wait for 1s to refresh data
}

The data in serial monitor:

Experiment three

  • Use Microduino internal reference source 3.3V to calcuate temperature value

Note:Use the aref pin as the base source, connect the 3.3V base source to aref pin of Microduino

Use the 3.3V as the external base source, please refer to:http://www.geek-workshop.com/thread-5717-1-1.html

  • Program
void setup() {
  Serial.begin(115200);         //Set the baud rate 115200
 analogReference(EXTERNAL);  //Use the aref pin as the base source, connect the 3.3V base source to aref pin
}
void loop() {
  int n = analogRead(A0);    //Read the voltage from A0 port
  double vol = n * (3.3 / 1024.0*100);   //Use double type variable to save the temperature value which converted from voltage
  Serial.println(vol);                   //Output the temperature from serial
  delay(1000);                           //Wait for 1s to refresh data
}

The data in serial monitor:

Analysis

Use three methods to test the temperature and got three different value.

  • Use the USB power, the result is beter. The power voltage is 4.99V, deviating from the 5 v voltage is 0.2%
  • Use internal 1.1V and 3.3V souce, after a bulk sample, the average error range of 1.1V internal reference source is about 1.22%, up 2.2%.
  • Under 5V range, the Arduino ADC sampling precision is 10bit that is 1024 level, minimum resolution is 5/1024=0.0048828125V=4.8828125mV
  • Under 3.3V internal source range, the Arduino ADC sampling precision is 10bit and the minimum resolution is 3.3/1024=0.00322265625V=3.22265625mV
  • Under 1.1V internal source range, the Arduino ADC sampling precision is 10bit and the minimum resolution is 1.1/1024=0.00107421875V=1.07421875mV
  • For LM35, every 10mv represents 1℃, so under 5V range, resolution close to 0.5 degrees, Under 3.3V range resolution close to 0.3 degrees, Under 1.1V range resolution close to 0.1 degrees.

Result

According to the above analysis, use USB power supply, the reference source error is smaller then other power relatively. USB power supply temperature closer to the real temperature, when the power supply isn't stable, the internal reference source will play a role. If require a higher precision, then need to use the external precision reference source. Referance error is smaller, and the accuracy of the ADC is higher too. According to the requirement to choose suitable reference source in all kinds of production is also very important.

Video