SlideShare a Scribd company logo
1 of 28
Download to read offline
Contents
ADC
Servomotors
Battery Dimensioning
References
Near Space Arduino Course
Marc Cort´es i Fargas
ESEIAAT, Technical University of Catalonia – BarcelonaTech
marc.cortes.fargas@upcprogram.space
May 21, 2017
1 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Navigation
You can use sections at the top of the pages to navigate through
this document. Also, everything in bolt text is a link to an
external page.
2 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
License
This document is under Creative Commoms CC BY-SA 4.0.
That means you can feel free to use it and adapt it recognising its
author and if you do that, you have to use same license.
3 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Images of this course
All schemes of this course are drawn by using Fritzing.
Also, all the third-images and videos attached are used in a
non-commercial way.
4 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Overview
1 Contents
Contents of the course
Today’s contents
2 ADC
Sampling rate issues
Resolution issues
LM35 temperature sensor
Exercise 1
Exercise2
3 Servomotors
PWM in Servomotors
4 Battery Dimensioning
Generalities
Considerations
Execise 3
5 References
5 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Contents of the course
Today’s contents
Contents of the course
Contents
1 Digital signals (IN and OUT) – Pulldowns,
Arduino basics, Analog signals – A/D, PWM.
22/03/2017
2 Barometer/Termometer (I2C comms), ADC,
Servomotors, Battery dimensioning.
26/04/2017
3 Bluetooth issues (Serial comms.), Relay,
Switch on a lamp using a mobile phone (only
on Android) I2C comms. BMP180
10/05/2017
4 GPS main sentences. Filtering and main
parameters. Communication through Iridium
satellites. 24/05/2017
Figure: Arduino nano.
6 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Contents of the course
Today’s contents
Today’s contents
1 ADC (Analog to Digital converters) Basics
2 ADC in Arduino
3 Example. LM35 sensor.
4 Exercise 1 and 2
5 Arduino’s libraries importing
6 Servos basics
7 Servos controlling and PWM visualisation
8 Exercise 3
9 Battery dimensioning
7 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Sampling rate issues
Resolution issues
LM35 temperature sensor
Exercise 1
Exercise2
Analog to digital conversion
Constrain I - Sampling rate
Sampling rate must be at least twice greater than the bandwidth
of the signal: Nyquist law.
If we want to reconstruct an analog signal, let’s see if we have only
a sample rate twice greater than the bandwidth.
8 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Sampling rate issues
Resolution issues
LM35 temperature sensor
Exercise 1
Exercise2
Analog to digital conversion
Figure: In green, number of samples per period. In blue, original signal.
In red, reconstructed signal.
9 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Sampling rate issues
Resolution issues
LM35 temperature sensor
Exercise 1
Exercise2
Analog to digital conversion
Figure: Reconstructed signal at same sampling conditions. As you can
see, we will reconstruct 0VDC.
Constrains
As a rule of thumb and in Arduino applications, it is recommended
a sampling frequency 10 times greater.
10 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Sampling rate issues
Resolution issues
LM35 temperature sensor
Exercise 1
Exercise2
Resolution
Once we have a proper sampling rate, we have another big big
concerning:
Constrain II - Resolution
Each sample corresponds to a voltage level. Resolution means
having different voltage level. Mores resolution → more voltage
levels → better sample.
11 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Sampling rate issues
Resolution issues
LM35 temperature sensor
Exercise 1
Exercise2
Resolution
Resolution
I.e., we have a signal of 3V3. We have a reference voltage of 5V so
we can have different voltage levels between 0V and 5V. If we have,
for an instance 4 volts level that means we have 1.25 Volt step.
For our sample, we have 2 near values: 2.5V and 3.75V.
We measure the nearest value. Thus, we will measure 3.75V
instead of 3V3.
As a conclusion: more resolution → more voltage values → more
accuracy → better sample.
12 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Sampling rate issues
Resolution issues
LM35 temperature sensor
Exercise 1
Exercise2
Resolution
Resolution in your Arduino
Resolution is measured with ”bits”. The number of voltage levels
is defined by: 2bits. Your Arduino has 10-bit resolution, that means
1024 voltage levels (0-1023) values.
Each value correspond to a 10 bits number: 1111111111 means
1023 (full reference voltage) and 0000000000 means 0 (GND).
I strongly recommend you to go here to know the ADC of your
Arduino.
13 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Sampling rate issues
Resolution issues
LM35 temperature sensor
Exercise 1
Exercise2
To sum up...
Two main parameters: sample rate and resolution.. Whereas
sample rate is important in high-frequency applications (i.e., to
measure magnitudes in a rocket) resolution is important depending
on the application.
Usually, a high-velocity ADC (an ADC with high sampling rate)
comes with low resolution like this 500Msps 8-bit resolution
ADC. Both high resolution and sample rate means higher price.
14 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Sampling rate issues
Resolution issues
LM35 temperature sensor
Exercise 1
Exercise2
Temperature sensor LM35
First at all, go here to download LM35 datasheet. Datasheet are
documents where all the information concerning components are
explained as well as common applications.
From LM35 datasheet
1 Uses: basic temperature sensor vs full-range temperatures
sensor. We will use Basic temperature sensor.
2 Footprint: parts of the sensor identification.
3 Component information
4 LM35 Transfer function (7.3.1):
Vout = 10mV /degC · Temp[degC]
15 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Sampling rate issues
Resolution issues
LM35 temperature sensor
Exercise 1
Exercise2
Temperature sensor LM35
Figure: Your LM35 footprint. Please notice LM35 comes with different
configurations.
Make sure what version of your LM35 do you have. If you connect it and
immediately it warms up, the component is not properly connected and
you must disconnect it to avoid permanent damage!
16 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Sampling rate issues
Resolution issues
LM35 temperature sensor
Exercise 1
Exercise2
Temperature sensor LM35
From LM35 transfer function:
Vout = 10mV /degC · Temp[degC]
We take Temp[degC]:
Temp[degC] = Vout/10mV /degC
And
degC
10mV
Is the slope of our function and Vout is in mV.
17 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Sampling rate issues
Resolution issues
LM35 temperature sensor
Exercise 1
Exercise2
Temperature sensor LM35
Figure: LM35 Graphic
18 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Sampling rate issues
Resolution issues
LM35 temperature sensor
Exercise 1
Exercise2
Exercise 1
Measure temperature of your LM35.
Steps
1 Connect your LM35 following schematic from its footprint
2 Connect Vout to one of the analog pins of your Arduino.
3 Use function AnalogRead(analogPin) to read an analog value.
4 You will read a number between 1023 and 0 (according to
your Arduino’s resolution!)
5 Convert this number to voltage level in mV. Remember, 1023
means 5000mV!
6 Once you have output voltage in mV, use transfer function
to get temperature in deg C.
19 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Sampling rate issues
Resolution issues
LM35 temperature sensor
Exercise 1
Exercise2
Exercise 2
Use a PWM output and your RGB and your own body
temperature to change colour from blue to red of a LED by using
your LM35 sensor. Notice that all variables must be double type if
you want a double output.
That’s homework btw
20 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
PWM in Servomotors
Servomotor controlling
PWM signals are widely used in electronics world. And in RC
applications, PWM signal is used to control Servomotors.
Servomotors are devices used to deflect control surfaces in RC
planes and drones, such as flaps, elevator and ailerons.
Load ./Examples/Servo/sweep and play with delay (never lower
than 5ms)
Figure: Connect your servo with the following wiring
21 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
PWM in Servomotors
Servomotor and PWM
Visualise the PWM signal of your servomotor in the oscilloscope.
Realise how by changing the duty cycle you will change the
position of the servomotor.
Note: To use a PWM signal is not common the use of an Arduino:
it is not necessary to have a controller to generate a PWM signal.
The vastly and famous PWM generator is a NE555
22 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Generalities
Considerations
Execise 3
Generalities of batteries
Battery
1 Pload : is the power consumed by the load. Pload = Vload · Iload
2 Regulator (i.e., a Buck/Boost): power converter. It
increase/decrease input voltage to a consign voltage.
η = Pout
Pin
. In this case Pload = Pout
3 Pbattery : Power delivered by the batteries.
4 Ri : Internal resistance of the batteries.
5 Q: capacity of the batteries. It is usually given in [mA·h].
6 Time of operability is: t[h] = Q[mAh]
I[mA]
7 Ibat must not exceed maximum intensity given by the battery,
Imax . Batteries have a fixed voltage and the intensity they
delivery depends on the load they are feeding. 23 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Generalities
Considerations
Execise 3
Generalities of batteries
We usually need a voltage converters because our load needs a
certain voltage to work. I. e., Arduino 5V entry level needs,
surprising, 5V. If we input different voltage the Arduino won’t
work, and if we go +7V we may burn the Arduino. Vin pin of the
Arduino handles from 7 to 12 V, and uses a linear regulator to go
to 5V to get the microcontroller working.
24 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Generalities
Considerations
Execise 3
Battery schema
Figure: Battery scheme with batteries in series configuration.
25 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Generalities
Considerations
Execise 3
Battery Considerations
Generally:
Pload = f (operation)
Vbat = f (t, T)
Qbat = f (T)
η = f (Vin)
In series: Qtotal = Qsinglebattery and Vtotal = V1bat and
considering n batteries of the same type Vtotal = n · V1bat.
In paralel: Vtotal = Vsinglebattery and Qtotal = Q1bat and
considering n batteries of the same type Qtotal = n · Q1bat.
26 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
Generalities
Considerations
Execise 3
Example
Having:
Pload = 1W = cte, Ri = 0, η = 0.4 = cte, n = 4, and
Q = 2000mAh, Battery tipe AA in series (1.5V), get running time.
Homework: do the same having a Ri from L91 datasheet at
T = 0degC.
27 / 28
Contents
ADC
Servomotors
Battery Dimensioning
References
References
Jeremy Blum
Exploring Arduino
Ed. Wiley
Robert Boylestad et al
Electronic devices and circuit theory
Ed. PHI, 1982
Margolis, Michael
Arduino cookbook
Sebastopol, CA : O’Reilly, cop. 2012, 2nd ed.
You can find this book online here, only for UPC community.
28 / 28

More Related Content

What's hot

Lect2 up380 (100329)
Lect2 up380 (100329)Lect2 up380 (100329)
Lect2 up380 (100329)
aicdesign
 

What's hot (20)

The iot academy_embeddedsystems_training_basicelectronicspart1
The iot academy_embeddedsystems_training_basicelectronicspart1The iot academy_embeddedsystems_training_basicelectronicspart1
The iot academy_embeddedsystems_training_basicelectronicspart1
 
The iot academy_embeddedsystems_training_basicselectronicspart2
The iot academy_embeddedsystems_training_basicselectronicspart2The iot academy_embeddedsystems_training_basicselectronicspart2
The iot academy_embeddedsystems_training_basicselectronicspart2
 
Adc f05
Adc f05Adc f05
Adc f05
 
The iot academy_embeddedsystems_training_circuitdesignpart3
The iot academy_embeddedsystems_training_circuitdesignpart3The iot academy_embeddedsystems_training_circuitdesignpart3
The iot academy_embeddedsystems_training_circuitdesignpart3
 
Lect2 up380 (100329)
Lect2 up380 (100329)Lect2 up380 (100329)
Lect2 up380 (100329)
 
Chapter 03
Chapter 03Chapter 03
Chapter 03
 
Analog to Digital Converters
Analog to Digital ConvertersAnalog to Digital Converters
Analog to Digital Converters
 
Adc dac converter
Adc dac converterAdc dac converter
Adc dac converter
 
Design flash adc 3bit (VHDL design)
Design flash adc 3bit (VHDL design)Design flash adc 3bit (VHDL design)
Design flash adc 3bit (VHDL design)
 
digi mul ppt
digi mul pptdigi mul ppt
digi mul ppt
 
adc dac converter
adc dac converteradc dac converter
adc dac converter
 
Chapter 18
Chapter 18Chapter 18
Chapter 18
 
Digital to analog convertor
Digital to analog convertorDigital to analog convertor
Digital to analog convertor
 
Filters DAC and ADC
Filters DAC and ADCFilters DAC and ADC
Filters DAC and ADC
 
ADC and DAC Best Ever Pers
ADC and DAC Best Ever PersADC and DAC Best Ever Pers
ADC and DAC Best Ever Pers
 
Lica 7th chapter slides
Lica 7th chapter slidesLica 7th chapter slides
Lica 7th chapter slides
 
Is2515571559
Is2515571559Is2515571559
Is2515571559
 
Adc and dac
Adc and dacAdc and dac
Adc and dac
 
Chapter 10
Chapter 10Chapter 10
Chapter 10
 
Digital Signal Conditioning
Digital Signal ConditioningDigital Signal Conditioning
Digital Signal Conditioning
 

Similar to Nsac l2 r1-adc-servos_battery

Mixed Signal Verification of a Voltage Regulator using a State Space approach...
Mixed Signal Verification of a Voltage Regulator using a State Space approach...Mixed Signal Verification of a Voltage Regulator using a State Space approach...
Mixed Signal Verification of a Voltage Regulator using a State Space approach...
Raj Mitra
 

Similar to Nsac l2 r1-adc-servos_battery (20)

An approach to design Flash Analog to Digital Converter for High Speed and Lo...
An approach to design Flash Analog to Digital Converter for High Speed and Lo...An approach to design Flash Analog to Digital Converter for High Speed and Lo...
An approach to design Flash Analog to Digital Converter for High Speed and Lo...
 
Power Efficient 4 Bit Flash ADC Using Cadence Tool
Power Efficient 4 Bit Flash ADC Using Cadence ToolPower Efficient 4 Bit Flash ADC Using Cadence Tool
Power Efficient 4 Bit Flash ADC Using Cadence Tool
 
200 m hz flash adc
200 m hz flash adc200 m hz flash adc
200 m hz flash adc
 
Design and Implementation of Low Power 3-Bit Flash ADC Using 180nm CMOS Techn...
Design and Implementation of Low Power 3-Bit Flash ADC Using 180nm CMOS Techn...Design and Implementation of Low Power 3-Bit Flash ADC Using 180nm CMOS Techn...
Design and Implementation of Low Power 3-Bit Flash ADC Using 180nm CMOS Techn...
 
Modelling and Simulation of a SAR ADC with Internally Generated Conversion Si...
Modelling and Simulation of a SAR ADC with Internally Generated Conversion Si...Modelling and Simulation of a SAR ADC with Internally Generated Conversion Si...
Modelling and Simulation of a SAR ADC with Internally Generated Conversion Si...
 
510 277-283
510 277-283510 277-283
510 277-283
 
Unit IV DA & AD Convertors and Phase Locked Loop
Unit IV  DA & AD Convertors and Phase Locked LoopUnit IV  DA & AD Convertors and Phase Locked Loop
Unit IV DA & AD Convertors and Phase Locked Loop
 
Design of CMOS operational Amplifiers using CADENCE
Design of CMOS operational Amplifiers using CADENCEDesign of CMOS operational Amplifiers using CADENCE
Design of CMOS operational Amplifiers using CADENCE
 
ANALOG TO DIGITALCONVERTOR FOR BLOOD-GLUCOSE MONITORING
ANALOG TO DIGITALCONVERTOR FOR  BLOOD-GLUCOSE MONITORING  ANALOG TO DIGITALCONVERTOR FOR  BLOOD-GLUCOSE MONITORING
ANALOG TO DIGITALCONVERTOR FOR BLOOD-GLUCOSE MONITORING
 
Analog to Digitalconvertor for Blood-Glucose Monitoring
Analog to Digitalconvertor for Blood-Glucose MonitoringAnalog to Digitalconvertor for Blood-Glucose Monitoring
Analog to Digitalconvertor for Blood-Glucose Monitoring
 
analog to digital converter.ppt
analog to digital converter.pptanalog to digital converter.ppt
analog to digital converter.ppt
 
Cmos Full Adder and Multiplexer Based Encoder for Low Resolution Flash Adc
Cmos Full Adder and Multiplexer Based Encoder for Low Resolution Flash AdcCmos Full Adder and Multiplexer Based Encoder for Low Resolution Flash Adc
Cmos Full Adder and Multiplexer Based Encoder for Low Resolution Flash Adc
 
A 1.2V 10-bit 165MSPS Video ADC
A 1.2V 10-bit 165MSPS Video ADCA 1.2V 10-bit 165MSPS Video ADC
A 1.2V 10-bit 165MSPS Video ADC
 
Adc&dac
Adc&dacAdc&dac
Adc&dac
 
Mixed Signal Verification of a Voltage Regulator using a State Space approach...
Mixed Signal Verification of a Voltage Regulator using a State Space approach...Mixed Signal Verification of a Voltage Regulator using a State Space approach...
Mixed Signal Verification of a Voltage Regulator using a State Space approach...
 
Project Report
Project ReportProject Report
Project Report
 
ADC - Types (Analog to Digital Converter)
ADC - Types (Analog to Digital Converter)ADC - Types (Analog to Digital Converter)
ADC - Types (Analog to Digital Converter)
 
Ee660 ex 24_bi_cmos_comparisons_all
Ee660 ex 24_bi_cmos_comparisons_allEe660 ex 24_bi_cmos_comparisons_all
Ee660 ex 24_bi_cmos_comparisons_all
 
ANALOG TO DIGITAL CONVERTERS
ANALOG TO DIGITAL CONVERTERSANALOG TO DIGITAL CONVERTERS
ANALOG TO DIGITAL CONVERTERS
 
Digital voltmeter (DVM) and its Classification
Digital voltmeter (DVM) and its ClassificationDigital voltmeter (DVM) and its Classification
Digital voltmeter (DVM) and its Classification
 

Recently uploaded

Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 

Recently uploaded (20)

Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 

Nsac l2 r1-adc-servos_battery

  • 1. Contents ADC Servomotors Battery Dimensioning References Near Space Arduino Course Marc Cort´es i Fargas ESEIAAT, Technical University of Catalonia – BarcelonaTech marc.cortes.fargas@upcprogram.space May 21, 2017 1 / 28
  • 2. Contents ADC Servomotors Battery Dimensioning References Navigation You can use sections at the top of the pages to navigate through this document. Also, everything in bolt text is a link to an external page. 2 / 28
  • 3. Contents ADC Servomotors Battery Dimensioning References License This document is under Creative Commoms CC BY-SA 4.0. That means you can feel free to use it and adapt it recognising its author and if you do that, you have to use same license. 3 / 28
  • 4. Contents ADC Servomotors Battery Dimensioning References Images of this course All schemes of this course are drawn by using Fritzing. Also, all the third-images and videos attached are used in a non-commercial way. 4 / 28
  • 5. Contents ADC Servomotors Battery Dimensioning References Overview 1 Contents Contents of the course Today’s contents 2 ADC Sampling rate issues Resolution issues LM35 temperature sensor Exercise 1 Exercise2 3 Servomotors PWM in Servomotors 4 Battery Dimensioning Generalities Considerations Execise 3 5 References 5 / 28
  • 6. Contents ADC Servomotors Battery Dimensioning References Contents of the course Today’s contents Contents of the course Contents 1 Digital signals (IN and OUT) – Pulldowns, Arduino basics, Analog signals – A/D, PWM. 22/03/2017 2 Barometer/Termometer (I2C comms), ADC, Servomotors, Battery dimensioning. 26/04/2017 3 Bluetooth issues (Serial comms.), Relay, Switch on a lamp using a mobile phone (only on Android) I2C comms. BMP180 10/05/2017 4 GPS main sentences. Filtering and main parameters. Communication through Iridium satellites. 24/05/2017 Figure: Arduino nano. 6 / 28
  • 7. Contents ADC Servomotors Battery Dimensioning References Contents of the course Today’s contents Today’s contents 1 ADC (Analog to Digital converters) Basics 2 ADC in Arduino 3 Example. LM35 sensor. 4 Exercise 1 and 2 5 Arduino’s libraries importing 6 Servos basics 7 Servos controlling and PWM visualisation 8 Exercise 3 9 Battery dimensioning 7 / 28
  • 8. Contents ADC Servomotors Battery Dimensioning References Sampling rate issues Resolution issues LM35 temperature sensor Exercise 1 Exercise2 Analog to digital conversion Constrain I - Sampling rate Sampling rate must be at least twice greater than the bandwidth of the signal: Nyquist law. If we want to reconstruct an analog signal, let’s see if we have only a sample rate twice greater than the bandwidth. 8 / 28
  • 9. Contents ADC Servomotors Battery Dimensioning References Sampling rate issues Resolution issues LM35 temperature sensor Exercise 1 Exercise2 Analog to digital conversion Figure: In green, number of samples per period. In blue, original signal. In red, reconstructed signal. 9 / 28
  • 10. Contents ADC Servomotors Battery Dimensioning References Sampling rate issues Resolution issues LM35 temperature sensor Exercise 1 Exercise2 Analog to digital conversion Figure: Reconstructed signal at same sampling conditions. As you can see, we will reconstruct 0VDC. Constrains As a rule of thumb and in Arduino applications, it is recommended a sampling frequency 10 times greater. 10 / 28
  • 11. Contents ADC Servomotors Battery Dimensioning References Sampling rate issues Resolution issues LM35 temperature sensor Exercise 1 Exercise2 Resolution Once we have a proper sampling rate, we have another big big concerning: Constrain II - Resolution Each sample corresponds to a voltage level. Resolution means having different voltage level. Mores resolution → more voltage levels → better sample. 11 / 28
  • 12. Contents ADC Servomotors Battery Dimensioning References Sampling rate issues Resolution issues LM35 temperature sensor Exercise 1 Exercise2 Resolution Resolution I.e., we have a signal of 3V3. We have a reference voltage of 5V so we can have different voltage levels between 0V and 5V. If we have, for an instance 4 volts level that means we have 1.25 Volt step. For our sample, we have 2 near values: 2.5V and 3.75V. We measure the nearest value. Thus, we will measure 3.75V instead of 3V3. As a conclusion: more resolution → more voltage values → more accuracy → better sample. 12 / 28
  • 13. Contents ADC Servomotors Battery Dimensioning References Sampling rate issues Resolution issues LM35 temperature sensor Exercise 1 Exercise2 Resolution Resolution in your Arduino Resolution is measured with ”bits”. The number of voltage levels is defined by: 2bits. Your Arduino has 10-bit resolution, that means 1024 voltage levels (0-1023) values. Each value correspond to a 10 bits number: 1111111111 means 1023 (full reference voltage) and 0000000000 means 0 (GND). I strongly recommend you to go here to know the ADC of your Arduino. 13 / 28
  • 14. Contents ADC Servomotors Battery Dimensioning References Sampling rate issues Resolution issues LM35 temperature sensor Exercise 1 Exercise2 To sum up... Two main parameters: sample rate and resolution.. Whereas sample rate is important in high-frequency applications (i.e., to measure magnitudes in a rocket) resolution is important depending on the application. Usually, a high-velocity ADC (an ADC with high sampling rate) comes with low resolution like this 500Msps 8-bit resolution ADC. Both high resolution and sample rate means higher price. 14 / 28
  • 15. Contents ADC Servomotors Battery Dimensioning References Sampling rate issues Resolution issues LM35 temperature sensor Exercise 1 Exercise2 Temperature sensor LM35 First at all, go here to download LM35 datasheet. Datasheet are documents where all the information concerning components are explained as well as common applications. From LM35 datasheet 1 Uses: basic temperature sensor vs full-range temperatures sensor. We will use Basic temperature sensor. 2 Footprint: parts of the sensor identification. 3 Component information 4 LM35 Transfer function (7.3.1): Vout = 10mV /degC · Temp[degC] 15 / 28
  • 16. Contents ADC Servomotors Battery Dimensioning References Sampling rate issues Resolution issues LM35 temperature sensor Exercise 1 Exercise2 Temperature sensor LM35 Figure: Your LM35 footprint. Please notice LM35 comes with different configurations. Make sure what version of your LM35 do you have. If you connect it and immediately it warms up, the component is not properly connected and you must disconnect it to avoid permanent damage! 16 / 28
  • 17. Contents ADC Servomotors Battery Dimensioning References Sampling rate issues Resolution issues LM35 temperature sensor Exercise 1 Exercise2 Temperature sensor LM35 From LM35 transfer function: Vout = 10mV /degC · Temp[degC] We take Temp[degC]: Temp[degC] = Vout/10mV /degC And degC 10mV Is the slope of our function and Vout is in mV. 17 / 28
  • 18. Contents ADC Servomotors Battery Dimensioning References Sampling rate issues Resolution issues LM35 temperature sensor Exercise 1 Exercise2 Temperature sensor LM35 Figure: LM35 Graphic 18 / 28
  • 19. Contents ADC Servomotors Battery Dimensioning References Sampling rate issues Resolution issues LM35 temperature sensor Exercise 1 Exercise2 Exercise 1 Measure temperature of your LM35. Steps 1 Connect your LM35 following schematic from its footprint 2 Connect Vout to one of the analog pins of your Arduino. 3 Use function AnalogRead(analogPin) to read an analog value. 4 You will read a number between 1023 and 0 (according to your Arduino’s resolution!) 5 Convert this number to voltage level in mV. Remember, 1023 means 5000mV! 6 Once you have output voltage in mV, use transfer function to get temperature in deg C. 19 / 28
  • 20. Contents ADC Servomotors Battery Dimensioning References Sampling rate issues Resolution issues LM35 temperature sensor Exercise 1 Exercise2 Exercise 2 Use a PWM output and your RGB and your own body temperature to change colour from blue to red of a LED by using your LM35 sensor. Notice that all variables must be double type if you want a double output. That’s homework btw 20 / 28
  • 21. Contents ADC Servomotors Battery Dimensioning References PWM in Servomotors Servomotor controlling PWM signals are widely used in electronics world. And in RC applications, PWM signal is used to control Servomotors. Servomotors are devices used to deflect control surfaces in RC planes and drones, such as flaps, elevator and ailerons. Load ./Examples/Servo/sweep and play with delay (never lower than 5ms) Figure: Connect your servo with the following wiring 21 / 28
  • 22. Contents ADC Servomotors Battery Dimensioning References PWM in Servomotors Servomotor and PWM Visualise the PWM signal of your servomotor in the oscilloscope. Realise how by changing the duty cycle you will change the position of the servomotor. Note: To use a PWM signal is not common the use of an Arduino: it is not necessary to have a controller to generate a PWM signal. The vastly and famous PWM generator is a NE555 22 / 28
  • 23. Contents ADC Servomotors Battery Dimensioning References Generalities Considerations Execise 3 Generalities of batteries Battery 1 Pload : is the power consumed by the load. Pload = Vload · Iload 2 Regulator (i.e., a Buck/Boost): power converter. It increase/decrease input voltage to a consign voltage. η = Pout Pin . In this case Pload = Pout 3 Pbattery : Power delivered by the batteries. 4 Ri : Internal resistance of the batteries. 5 Q: capacity of the batteries. It is usually given in [mA·h]. 6 Time of operability is: t[h] = Q[mAh] I[mA] 7 Ibat must not exceed maximum intensity given by the battery, Imax . Batteries have a fixed voltage and the intensity they delivery depends on the load they are feeding. 23 / 28
  • 24. Contents ADC Servomotors Battery Dimensioning References Generalities Considerations Execise 3 Generalities of batteries We usually need a voltage converters because our load needs a certain voltage to work. I. e., Arduino 5V entry level needs, surprising, 5V. If we input different voltage the Arduino won’t work, and if we go +7V we may burn the Arduino. Vin pin of the Arduino handles from 7 to 12 V, and uses a linear regulator to go to 5V to get the microcontroller working. 24 / 28
  • 25. Contents ADC Servomotors Battery Dimensioning References Generalities Considerations Execise 3 Battery schema Figure: Battery scheme with batteries in series configuration. 25 / 28
  • 26. Contents ADC Servomotors Battery Dimensioning References Generalities Considerations Execise 3 Battery Considerations Generally: Pload = f (operation) Vbat = f (t, T) Qbat = f (T) η = f (Vin) In series: Qtotal = Qsinglebattery and Vtotal = V1bat and considering n batteries of the same type Vtotal = n · V1bat. In paralel: Vtotal = Vsinglebattery and Qtotal = Q1bat and considering n batteries of the same type Qtotal = n · Q1bat. 26 / 28
  • 27. Contents ADC Servomotors Battery Dimensioning References Generalities Considerations Execise 3 Example Having: Pload = 1W = cte, Ri = 0, η = 0.4 = cte, n = 4, and Q = 2000mAh, Battery tipe AA in series (1.5V), get running time. Homework: do the same having a Ri from L91 datasheet at T = 0degC. 27 / 28
  • 28. Contents ADC Servomotors Battery Dimensioning References References Jeremy Blum Exploring Arduino Ed. Wiley Robert Boylestad et al Electronic devices and circuit theory Ed. PHI, 1982 Margolis, Michael Arduino cookbook Sebastopol, CA : O’Reilly, cop. 2012, 2nd ed. You can find this book online here, only for UPC community. 28 / 28