Working with the Electronics

I decided to use a stepper motor to control the wheels of the rover. A stepper motor unlike a regular DC motor can be told to move in specific increments and stop at various angles. I thought that this would be useful so that the operator could tell the rover to move its wheels forward a certain number of steps and then stop.

DSC_0132editI researched and purchased a driver board and motor that I had found instructions for the usage of together.

The motor had two screw fixings on it so that it would also be easy to mount upon the body of the rover too.

I soldered pins onto the driver board and connected it up to the Pi, power supply and motor, and it showed me via an LED that it was receiving power.

I then sent ‘on’ and ‘off’ signals to the appropriate GPIO pin on the raspberry pi, but this failed to activate the motor at all.

Meanwhile I decided to see if I could work the servo that would tilt the camera. Whereas the motor requires a separate driver board, the pi can directly drive servos from its GPIO pins.

My research found that the different lengths of pulses sent to the GPIO tell the server what position to move to:

By default, the Pi sends a pulse that lasts 20ms, so using Python, a code needed to be written that changed the pulse length, and that means setting the pin to use PWM (Pulse Width Modulation). Doing this, you can change the duty cycle (or the length of each pulse) to what it needs to be to direct the servo to move to a specific angle.

This gives me several options in letting the user control the camera tilt:

  1. Give them 3 positions to be able to move to – up, down and central
  2. Calculate some in between values and let them select from a wider range of angles
  3. Create a script that when they choose any angle themselves, it calculates the correct duty cycle and activates it.

Here is a video of a script that moves the servo to each of the 3 extremes of positions. (Note that the servo only actually moves to 160 degrees)


Leave a Reply


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

Twitter picture


Facebook photo


Google+ photo


Connecting to %s