Arduino Practica 5 ESCOM

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

INSTITUTO PLITCNICO

NACIONAL
ESCUELA SUPERIOR DE
CMPUTO
LABORATORY OF
INSTRUMENTATION
Professor: Alcantara Mendez
Alberto Jesus
Report Practice 6
Students:
Antoln Cruz Ricardo
Cisneros Castellanos Victor ngel
Salinas Osorio1 Luis Antonio

Group: 3CV2
Contents
1 Objective
3
2 Introductions
3
3 Code of Program
5
4
Tables
approximations

of

successive
7

5 Images
9
6 Conclusions
10

1 Objective
Do learn the use of the analog to digital converter
implementing the Arduino one that runs a 10-bit converter.

Material

Arduino uno
Usb printer cable
7 Segment Display Cathode
Resistance 220 Ohms
10k ohms potentiometer
Sensor LM35

2 Introductions
DAC: In electronics, a digital-to-analog converter (DAC or D-toA) is a device that converts a digital (usually binary) code to
an analog signal (current, voltage, or electric charge). An
3

analog-to-digital converter (ADC) performs the reverse


operation. Signals are easily stored and transmitted in digital
form, but a DAC is needed for the signal to be recognized by
human senses or other non-digital systems.
A common use of digital-to-analog converters is generation of
audio signals from digital information in music players. Digital
video signals are converted to analog in televisions and
mobile phones to display colors and shades. Digital-to-analog
conversion can degrade a signal, so conversion details are
normally chosen so that the errors are negligible.
Due to cost and the need for matched components, DACs are
almost exclusively manufactured on integrated circuits (ICs).
There are many DAC architectures which have different
advantages and disadvantages. The suitability of a particular
DAC for an application is determined by a variety of
measurements including speed and resolution.
LM35
The LM35 is a temperature sensor calibrated to an accuracy of
1 C. Its measurement range from -55 C to 150 C. The
output is linear and each degree Celsius equals 10mV,
therefore:
150 C = 1500mV
-40 C =-400mV

Practical operation
Piecewise constant output of a conventional practical DAC.
Instead of impulses, usually the sequence of numbers updates
the analog voltage at uniform sampling intervals.
These numbers are written to the DAC, typically with a clock
signal that causes each number to be latched in sequence, at
which time the DAC output voltage changes rapidly from the
previous value to the value represented by the currently
latched number. The effect of this is that the output voltage is
held in time at the current value until the next input number is
latched resulting in a piecewise constant or 'staircase' shaped
output. This is equivalent to a zero-order hold operation and
has an effect on the frequency response of the reconstructed
signal.
The fact that DACs output a sequence of piecewise constant
values (known as zero-order hold in sample data textbooks) or
rectangular pulses causes multiple harmonics above the
Nyquist frequency. Usually, these are removed with a low pass
5

filter acting as a reconstruction filter in applications that


require it.
With help of our DAC and ARDUINO put together a circuit that
we could take the temperature at different times, so as we
were mistrando these through the serial monitor.

All this was achieved by adjusting the voltages of both the


LM35 in programming also able to calculate the relevant
voltages for voltage transormacion to Degrees Celsius and
these degrees Fahrenheit.

3 Code of program
Pin assignment of Arduino

int D = 4;

int DP = 8;

int C = 3;

int G = 7;

int B = 2;

int F = 6;

int A = 1;

int E = 5;

void setup() {

Serial.begin(9600);

digitalWrite(B, HIGH);

Pin assignment of display's

digitalWrite(A, LOW);

pinMode(G, OUTPUT);

pinMode(F, OUTPUT);

Assignament of number 2

pinMode(E, OUTPUT);

void DOS(){

pinMode(D, OUTPUT);

digitalWrite(G, HIGH);

pinMode(C, OUTPUT);

digitalWrite(F, LOW);

pinMode(B, OUTPUT);

digitalWrite(E, HIGH);

pinMode(A, OUTPUT);

digitalWrite(D, HIGH);

digitalWrite(C, LOW);

Assignament of number 0

digitalWrite(B, HIGH);

void CERO(){

digitalWrite(A, HIGH);

digitalWrite(G, LOW);

digitalWrite(F, HIGH);

Assignament of number 3

digitalWrite(E, HIGH);

void TRES(){

digitalWrite(D, HIGH);

digitalWrite(G, HIGH);

digitalWrite(C, HIGH);

digitalWrite(F, LOW);

digitalWrite(B, HIGH);

digitalWrite(E, LOW);

digitalWrite(A, HIGH);

digitalWrite(D, HIGH);

digitalWrite(C, HIGH);

Assignament of number 1

digitalWrite(B, HIGH);

void UNO(){

digitalWrite(A, HIGH);

digitalWrite(G, LOW);

digitalWrite(F, LOW);

Assignament of number 4

digitalWrite(E, LOW);

void CUATRO(){

digitalWrite(D, LOW);

digitalWrite(G, HIGH);

digitalWrite(C, HIGH);

digitalWrite(F, HIGH);

digitalWrite(E, LOW);

Serial.println(val);

digitalWrite(D, LOW);

if(val >= 0 && val<=250)

digitalWrite(C, HIGH);

digitalWrite(B, HIGH);

CERO();

}
else if(val >= 250 &&
val<=409)

digitalWrite(A, LOW);

UNO();

}
else if(val >= 409 &&
val<=614)

Assignament of number 5
void CINCO(){

digitalWrite(G, HIGH);

DOS();

}
else if (val >=614 &&
val<=820)

digitalWrite(F, HIGH);

digitalWrite(E, LOW);

TRES();

}
else if (val >=820 &&
val<=1022)

digitalWrite(D, HIGH);
digitalWrite(C, HIGH);

digitalWrite(B, LOW);

digitalWrite(A, HIGH);

CUATRO();
else if (val == 1023)
CINCO();

Code for show the numbers

void loop() {
int val=analogRead(A0);

4
Tables
approximations

of

successive

Voltage 1 volt
BMS

Binary

0
1
2
3
4
5
6
7
8
9
10

0000000000
1000000000
0100000000
0010000000
0011000000
0011100000
0011010000
0011001000
0011001100
0011001110
0011001101

[Dx/(2n1)*]Vref
(0/1023)*5
(512/1023)*5
(256/1023)*5
(128/1023)*5
(192/1023)*5
(224/1023)*5
(208/1023)*5
(200/1023)*5
(204/1023)*5
(206/1023)*5
205(/1023)*5

Vin
0
2.5
1.25
0.625
0.938
1.094
1.01
0.97
0.997
1.006
1.001

<1
>1
>1
<1
<1
>1
>1
<1
<1
>1
>1

Voltage 2 volts
BMS

Binary

0
1
2
3
4
5
6
7
8
9
10

0000000000
1000000000
0100000000
0110000000
0111000000
0110100000
0110010000
0110011000
010011100
0110011010
0110011001

[Dx/(2n1)*]Vref
(0/1023)*5
(512/1023)*5
(256/1023)*5
(384/1023)*5
(448/1023)*5
(416/1023)*5
(400/1023)*5
(408/1023)*5
(412/1023)*5
(410/1023)*5
(409/1023)*5

Vin
0
2.5
1.2
1.63
2.18
2.033
1.955
1.994
2.013
2.003
1.999

<2
>2
<2
<2
>2
>2
<2
<2
>2
>2
<2

Voltage 3 volts
BMS

Binary

0
1

0000000000
1000000000

[Dx/(2n1)*]Vref
(0/1023)*5
(512/1023)*5

Vin
0
2.5

<3
<3

2
3
4
5
6
7
8
9
10

1100000000
1010000000
1001000000
1001100000
1001110000
1001101000
1001100100
1001100110
1001100101

(768/1023)*5
(640/1023)*5
(576/1023)*5
(608/1023)*5
(624/1023)*5
(616/1023)*5
(612/1023)*5
(614/1023)*5
(613/1023)*5

3.75
3.12
2.81
2.971
3.049
3.010
2.991
3.0009
2.9960

>3
>3
<3
<3
>3
>3
<3
=3
<3

Voltage 4 volts
BMS

Binary

0
1
2
3
4
5
6
7
8
9
10

0000000000
1000000000
1100000000
1110000000
1101000000
1100100000
1100110000
1100111000
1100110100
1100110010
1100110011

[Dx/(2n1)*]Vref
(0/1023)*5
(512/1023)*5
(768/1023)*5
(896/1023)*5
(832/1023)*5
(800/1023)*5
(816/1023)*5
(824/1023)*5
(820/1023)*5
(818/1023)*5
(819/1023)*5

Vin
0
2.5
3.75
4.37
4.066
3.910
3.988
4.027
4.007
3.998
4.002

<4
<4
<4
>4
>4
<4
<4
>4
>4
<4
>4

Voltage 5 volts
BMS

Binary

0
1
2
3
4
5
6

0000000000
1000000000
1100000000
1110000000
1111000000
1111100000
111111000

1111111000

1111111100

111111110

10

111111111

[Dx/(2n1)*]Vref
(0/1023)*5
(512/1023)*5
(768/1023)*5
(896/1023)*5
(960/1023)*5
(992/1023)*5
(1008/1023)*
5
(1016/1023)*
5
(1020/1023)*
5
(1022/1023)*
5
(1023/1023)*

Vin
0
2.25
3.75
4.37
4.69
4.84
4.92

<5
<5
<5
<5
<5
<5
<5

4.96

<5

4.98

<5

4.95

<5

5.00

=5

5 Images

Arduino uno

Connection diagram

6 Conclusions
Antoln Cruz Ricardo
We could end this practice tables using previously calculated
on the LM35 but still had to re-check the voltages in which this
works to well to achieve more accurate performance
Cisneros Castellanos Victor ngel
Using the arduino was much easier to determine the change
in temperature that the LM35 was suffering as we showed him
directly in the serial monitor, even so the protoboard was the
vital help to solve the problematic.
Salinas Osorio Luis Antonio
The estimate changes that generates voltage according
assume LM35 voltage change is only a small function of what
the Arduino can perform with different sensors, because it is
only a matter of learning the ranges in which they work while
the program is arduino responsible for decoding captured
everything and to show the user in a more accurate and
correct what usually happens in the experimental or real.

You might also like