Embedded Day 2
Embedded Day 2
Embedded
Systems
PWM . Actuator, Transducer, ADC , Types
of Sensors, Data Mapping
1.INTRODUCTION TO PWM(PULSE
Contents 2.ACTUATORS
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);
}
}
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 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)
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.