myR: How to control a DC motor

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).

DCmotor1

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.

DCmotor2

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.

DCmotor3

In the next post, I’l explain how to connect the outputs and how to control them by software.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s