Xathrya Sabertooth |
- List of Component and Device for ARM Tutorial Series
- List of Component and Device for Arduino Tutorial Series
- Arduino Project: Arduino and LM35 Sensor
List of Component and Device for ARM Tutorial Series Posted: 02 Apr 2014 07:53 AM PDT If you want to start tinkering in ARM, you may look at following list. This list is the parts you might need to follow my tutorials. You are not obligate to gather all because I always specify what materials you need in every article. However, you can see following as a reference. BoardI have both learning board and development board. For learning board I mainly focus on Nuvoton LB-NUC140. For development board I mainly focus on DT-ARM NUC120. ComponentBuy one item of component isn’t too useful. A better idea is to buy a pack of that component, if possible.
Some sensors we need:
and actuator:
Tools
Additional GadgetsOf course this is optional.
|
List of Component and Device for Arduino Tutorial Series Posted: 02 Apr 2014 07:46 AM PDT If you want to start tinkering Arduino, you may look at following list. This list is the parts you might need to follow my tutorials. You are not obligate to gather all because I always specify what materials you need in every article. However, you can see following as a reference. Arduino boardNormally I would use my Arduino Uno R3, unless told otherwise. You can use any Arduino board you think suitable for both your budget or your specidication. ComponentBuy one item of component isn’t too useful. A better idea is to buy a pack of that component, if possible.
Some sensors we need:
and actuator:
Tools
Additional GadgetsOf course this is optional.
|
Arduino Project: Arduino and LM35 Sensor Posted: 02 Apr 2014 06:37 AM PDT LM35 is an integrated circuit sensor that can be used to measure temperature with an electrical output proportional to the temperature in Celcius. Compared to thermistor, this component give more accurate result and generate higher voltage than thermocouples which may not require output amplifier. The scale factor for this sensor is .01V/oC and doesn’t require any external calibration or trimming and maintains an accuracy of +/-0.4 oC at room temperature and +/-0.8 oC over range of 0oC to 100 oC. It has three leg: VCC, V-out, GND. The VCC is input voltage to supply the IC. The V-out is the pin which output the result temperature reading. The GND is ground. Objective
Prerequisite
RequirementFollowing is all materials I use for this tutorial.
You can change the Arduino board to higher specification if you like. You also need an USB A to B cable for upload our program to our Arduino. CircuitHere is the circuit image, created using Fritzing. Make sure you have the pin and leg configured properly. We will connect V-out leg to pin Analog 0 or A0. Next we can sense the temperature by read the value of this pin. CodeLet’s see what code we use for this project and discuss it later. const unsigned int TEMP_SENSOR_PIN = 0; // We mean analog 0 const float SUPPLY_VOLTAGE = 5.0; // If you use 3.3V, write it here. const unsigned int BAUD_RATE = 9600; const float get_temperature() { const int sensor_voltage = analogRead(TEMP_SENSOR_PIN); const float voltage = sensor_voltage * SUPPLY_VOLTAGE / 1024; return (voltage * 100); } void setup() { Serial.begin(BAUD_RATE); } void loop() { Serial.print(get_temperature()); Serial.println(" C"); delay(1000); } We define the pin for reading as TEMP_PIN and assign this constant by 0. Remember that our reading will be in analog, so we will use analogRead() function instead of digitalRead() function. We use 5.0V from Arduino and write it as constant SUPPLY_VOLTAGE. If you use different voltage, write it there. ResultOpen serial communication on Arduino IDE. You will see something similar to this: Why it WorksThe heart of this project is get_temperature(). const float get_temperature() { const int sensor_voltage = analogRead(TEMP_SENSOR_PIN); const float voltage = sensor_voltage * SUPPLY_VOLTAGE / 1024; return (voltage * 100); } First, we read the output of sensor. The value range from 0 to 1023, which is a scale actually. We multiply the output with our SUPPLY_VOLTAGE, we got the exact value which has V unit. Division with 1024 is applied as the highest output is 1024 value. Because the precision is 10 mV/oC, we should convert the Volt unit to mV unit which we next multiply it by 1000. But wait, we then should divide it with 10 the scale, so we can get the shortcut: just multiply the voltage with 100. And that’s the recipe. You can revise the code to make compact code by using magic number. const float get_temperature() { return (analogRead(TEMP_SENSOR_PIN) * 0.48828125); } Where did we get this magic number? You should figure it by yourself |
You are subscribed to email updates from Xathrya Sabertooth To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
Tidak ada komentar:
Posting Komentar