So let’s start by moving the rover!
In my case I have 2 DC gear-motors with this specifications:
- Gearbox: 4.8~7.2V
- No load current:190mA(max.250mA)
- Stall current: ~1A
- No load speed: 90±10rpm
- Torque: 800gf.cm
The control of this type of motor is really simple: when power on, it moves, when disconnected it stay still. Simple!
So what we can do is tuning the motor speed by power on and off the motor itself using pulses of different width: we will use the PWM (pulse width modulation).
So consider to send a pulse every 20ms (subcycle=20ms) and the pulse width is 16ms, than the motor stays on for the 80% of the time, while if the pulse width is 10ms it stays on for 50% of the time.
The motor can drain up to 250mA .It is too much for our raspberry output, so we need a bridge in between than can guaranty this current.
That’ s why in the Bill Of Material I have the L298N bridge.
This board receive the input from rpi and send an output of the same width , with a signal level (voltage and current) depending on the power in you connect ( the used battery pack).
In particular , the bridge I’m using can drive up to 2 motors.
Below the schema for the power connection. Note that the bridge can also provide a 5 V output than can be used to power the raspberry.
In the next post, I’l explain how to connect the outputs and how to control them by software.