Presentation is loading. Please wait.

Presentation is loading. Please wait.

Pulse Width Modulation (PWM) Motor Feedback - Shaft Encoder

Similar presentations


Presentation on theme: "Pulse Width Modulation (PWM) Motor Feedback - Shaft Encoder"— Presentation transcript:

1 Pulse Width Modulation (PWM) Motor Feedback - Shaft Encoder
Introduction to Smart Systems Pulse Width Modulation (PWM) Motor Feedback - Shaft Encoder 1

2 (Introduction to) Pulse Width Modulation
PWM means controlling the relative widths of the positive and negative parts of an output waveform, whilst keeping the pulse frequency constant. PWM thus controls the amount of energy in the waveform (used to regulate the speed of a motor, the brightness of a light etc.). The proportion of time the signal is on is called the ‘duty cycle’: A duty cycle of 100% means that maximum energy is provided, and a duty cycle of 0% means that minimum energy is provided to the controlled device. A square wave has a 50% duty cycle. Duty Cycle 25% 50% 75% 2 Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

3 Pulse Width Modulation on ATmega1281 using Timer/Counter 0
The Timer/Counters on the ATmega1281 are capable of producing PWM output pulses. Timer/Counter 0 is used for illustration. Direct output of pulse waveform onto the OC0A pin (bit 7 of Port B) ‘Output Compare’ Interrupt can be generated at the switchover point in the pulse ‘Overflow’ Interrupt can be generated at start of new pulse 3 Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

4 Pulse Width Modulation – LED brightness control
A simple example application of PWM is controlling the brightness of LEDs – the higher the duty cycle, the brighter the LEDs are. An example ‘PWM light dimmer’ project has been placed on the course website. The application uses Timer/Counter0 in ‘Fast PWM’ mode. The on-board switches are used control the brightness of the LEDs by re-programming the timer registers so that different waveforms are produced. Example LED brightness levels. Photos are blurred because these had to be taken in low light levels (long exposures) with a handheld camera Duty cycle values % % % % % 4 Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

5 Rotation Feedback systems - Shaft Encoders (1)
A device to detect the position or angular rotation of a shaft Typically used in Motor feedback systems (speed control), and devices where angular position needs to be detected (a good example is a computer mouse). Magnetic: a magnet is placed on the edge of a wheel attached to the shaft. A magnetic switch is placed near the wheel so that the switch activates each time the magnet passes by. Pulses (output signal to microcontroller) Magnet Magnetic proximity switch (the detector) 5 Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

6 Rotation Feedback systems - Shaft Encoders (2)
Detect Forward / Backward Movement Left / Right Mouse Ball sits under this cover and rotates the shafts Optical: A light beam passes through, or is reflected off of, a disk attached to the rotating shaft. The number of received light pulses indicate the angular rotation. A ‘Quadrature’ technique is used in the mechanical ball mice, so that the direction can be determined, as well as speed (see next slide). 6 Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

7 Rotation Feedback systems - Shaft Encoders (3)
Quadrature: Two pulses are produced on separate output wires. The outputs are offset by 90 degrees, thus not only enabling the measurement of speed or distance (by counting the pulses) but also determining the direction (by the relative timing of the two pulses). A ‘reference’ output is also added on some devices; this gives an output pulse once per turn at a precise position and is used when there is the need of an absolute reference, such as positioning systems (consider a security camera). Can be mechanical or optical. Example application: attached to motors in robots and machinery where a combination of speed / rotation angle and direction are all needed. The output coding pattern (see above) is called Gray code and enables the direction to be determined – based on which signal ‘leads’. The actual pattern of pulses is shown below (which way is the shaft rotating?) Quadrature encoders are used in ball mice to track whether the mouse is moving to the right/left or forward/backward. 7 Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich Diagrams from Wikipedia


Download ppt "Pulse Width Modulation (PWM) Motor Feedback - Shaft Encoder"

Similar presentations


Ads by Google