0% found this document useful (0 votes)
13 views

Embedded Day 2

The document discusses embedded systems topics including PWM, actuators, analog to digital conversion, and data mapping. It defines PWM as switching a signal between on and off states at defined time intervals to create a pulsing effect. Actuators are devices that convert energy into motion, with examples including servo motors. Analog to digital conversion is explained as the process of converting continuous analog sensor signals to discrete digital values that can be processed by computers. Data mapping is presented as a method to scale analog sensor readings to a desired output range. Code examples are provided to demonstrate PWM control of an LED and mapping potentiometer readings to servo position.

Uploaded by

199SARAS MISHRA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Embedded Day 2

The document discusses embedded systems topics including PWM, actuators, analog to digital conversion, and data mapping. It defines PWM as switching a signal between on and off states at defined time intervals to create a pulsing effect. Actuators are devices that convert energy into motion, with examples including servo motors. Analog to digital conversion is explained as the process of converting continuous analog sensor signals to discrete digital values that can be processed by computers. Data mapping is presented as a method to scale analog sensor readings to a desired output range. Code examples are provided to demonstrate PWM control of an LED and mapping potentiometer readings to servo position.

Uploaded by

199SARAS MISHRA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

DAY-2

KIIT Robotic Society

Embedded
Systems
PWM . Actuator, Transducer, ADC , Types
of Sensors, Data Mapping
1.INTRODUCTION TO PWM(PULSE

Table of WIDTH MODULATION)

Contents 2.ACTUATORS

Points for discussion


3. ANALOG TO DIGITAL
CONVERSION(ADC) and DATA
MAPPING

4.TRANSDUCERS AND TYPES OF


SENSORS
What is Pulse Width
Modulation(PWM)?
What we saw was continuously switching
between on and off. Now if we add a
definite time interval for which the light
is on and off which can be same or
different and repeat it infinitely, we get a
pulsing effect whose on/off time (aka
width) has been varied or modulated.
Duty cycle
The duty cycle describes the
amount of time the signal is
in a high (on) state as a
percentage of the total time
it takes to complete one
cycle.
PWM can be (a) centre aligned PWM
(b) left aligned PWM
classified as..... (c) right aigned PWM

Center-aligned PWM:
Symmetric PWM
Center-aligned PWMs are most often used in
AC motor control to maintain phase alignment
Left-aligned PWM
Asymmetric PWM
Left-aligned PWMs are used for most general-
purpose PWM uses
Right-aligned PWM
Asymmetric PWM
Right-aligned PWMs are typically only used in
special cases that require alignment opposite of
left-aligned PWMs
Let's visualize them... LEFT ALIGNED

CENTRE ALIGNED

RIGNT ALIGNED
Let's make something
with what we learnt
Lets begin
//Initializing LED Pin
int led_pin = 9;
void setup() {
//Declaring LED pin as output
pinMode(led_pin, OUTPUT);
}
void loop() {
//Fading the LED
for(int i=0; i<255; i++){
analogWrite(led_pin, i);
delay(10);
}
for(int i=255; i>0; i--){
analogWrite(led_pin, i);
delay(5);
}
}

LED blinking using potentiometer


Servo speed controlling using
potentiometer
Actuators can be divided
into... USE SOME FORM OF ELECTRIC USE A VARIETY OF LIQUIDS
OPERATED BY COMPRESSED
ENERGY TO OPERATE AS A SOURCE OF ENERGY
AIR
So, An actuator is a So you might want to see an actuator readily available
and used by embedded hobbyists and miniature
device that makes robots.

something move or PRESENTING A SERVO........

operate. It receives
a source of energy
and uses it to move
something.
Inside a hobby servo there
Let's peek what's inside are four main components,

a DC motor,
a gearbox,
a potentiometer and
a control circuit.

The DC motor is high speed


and low torque but the
gearbox reduces the speed
to around 60 RPM and at the
same time increases the
torque.
continued...

The potentiometer is attached on the final gear or the output shaft, so as the motor rotates the
potentiometer rotates as well, thus producing a voltage that is related to the absolute angle of
the output shaft. In the control circuit, this potentiometer voltage is compared to the voltage
coming from the signal line.
Generally pulses with 1ms duration correspond to 0 degrees position, 1.5ms duration to 90
degrees and 2ms to 180 degrees. Though the minimum and maximum duration of the pulses
can sometimes vary with different brands and they can be 0.5ms for 0 degrees and 2.5ms for
180 degrees position.
Do you have any
questions regarding
Pwm and
actuators?
Send it to us! We hope you learned something new.
Let's be Familiar
With Analog to
digital
converter(ADC)

Analog-to-digital conversion is an electronic process in which a


continuously variable (analog) signal like temperature, pressure,
voltage, current, distance, or light intensity, is translated to its digital
representation without altering its essential content. This digital
representation can then be processed, manipulated, computed,
transmitted or stored.
Why do we need
ADC ?
Since computers only process digital information,
they require digital input. Therefore, if an analog
input is sent to a computer, an analog-to-digital
converter (ADC) is required in order to get more
accurate data from the analog sensors in more
advanced projects. there are different ADC available
in the market 10bits 12bits 14,16,24 and the accuracy
is directly proportion to the resolution. The Arduino
Uno has a built in 10 bit ADC

Number of discrete analog level =


2 ^ resolution of ADC
How ADCs
Work?
Microcontroller can’t
read values unless it’s
digital data. This is
because microcontrollers ADCs follow a sequence when converting
can only see “levels” of analog signals to digital. They first sample the
the voltage, which signal, then quantify it to determine the
resolution of the signal, and finally set binary
depends on the
values and send it to the system to read the
resolution of the ADC and digital signal. Two important aspects of the
the system voltage. ADC are its sampling rate and resolution.
Reading Analog Voltage
Using ADC Values
Data Mapping
int duty = 0;
int dutyMax = 100;

void setup() {
pinMode(2, OUTPUT);
pinMode(A0, INPUT);
}

void loop() {
int pot = analogRead(A0);
duty = map(pot, 0, 1023, 0, dutyMax);

digitalWrite(2, HIGH);
delay(duty);
digitalWrite(2, LOW);
delay(dutyMax - duty);
}
Do you have any
questions
regarding ADC and
Data mapping?
Send it to us! We hope you learned something new.

You might also like