BBC Microbit Servo Motor Drive User Manual
H-bridge Logic
P13 | P14 | LA | LB | Features |
---|---|---|---|---|
0 | 0 | Z | Z | Stop/fast domain |
0 | 1 | L | H | Reverse |
1 | 0 | H | L | Positive |
1 | 1 | L | L | Instigating / shunning |
Inputs and Motor Control
The input pins can be used to control the speed of the motor using Pulse Width Modulation (PWM). When a motor is controlled to rotate, if the drive current is suddenly interrupted, the internal current of the motor cannot terminate immediately due to its inductance property. The freewheeling circuit must be supplied with current to manage this. The H-bridge circuit offers two modes of operation to solve this freewheeling problem: fast decay mode and slow decay mode.
Fast Decay Mode
In fast decay mode, the H-bridge is disabled, and current flows through the body diode. The motor coil is effectively shorted. This mode is achieved when one of the two input pins receives a PWM signal, and the other receives a low-level signal.
- Condition: P13 = PWM, P14 = 0
- Interpreted Effect: Forward PWM, fast decay.
- Condition: P13 = 0, P14 = PWM
- Interpreted Effect: Reverse PWM, fast decay.
Slow Decay Mode
In slow decay mode, one of the two input pins receives a PWM signal, and the other receives a high-level signal.
- Condition: P13 = PWM, P14 = 1
- Interpreted Effect: Forward PWM, slow decay.
- Condition: P13 = 1, P14 = PWM
- Interpreted Effect: Reverse PWM, slow decay.
Sample Program and Connections
The following describes a sample program setup and its expected behavior:
- Connections:
- P1 and P8 are connected to the steering gear (servo motors).
- The L and R motor interfaces are connected to DC geared motors.
- The DC interface is connected to a DC power supply or battery (voltage range: 6V to 11.4V).
- The switch is toggled to the ON position.
- Expected Actions:
- The four RGB lights display colors red, yellow, green, and blue from left to right.
- The buzzer continuously emits seven syllables: DO, RE, MI, FA, SO, LA, TI.
- The DC motors rotate forward for a specified duration (implied by "IS"), then stop, and then reverse.
- The two servos connected to P1 and P8 rotate from 0° to 180° and then return to 0°.