Raspberry Pi Motor Controller




Overview

An AVR, typically an ATMega168P, is controlled from the Pi via the 3.3V UART, and provides the PWM signals to the Motor Driver.

Features

  • Controlled via the UART on the Pi GPIO Header.
  • Up to 2A bi-directional current per channel at up to 46V. (Limited by L298N)
  • Only the Motor Supply Voltage is required in addition to Voltages from the Pi GPIO Header
  • Motor Driver Channels are switched off when speed value is set to ‘000’

Raspberry Pi Motor Controller

Control

The Motor Controller initialises to ‘0’ speed on both channels.

A fixed-length 10 character array is then used to instruct the controller.

LxxxXRxxxX

  • xxx – Speed from ‘000’ to ‘255’
  • X – Direction, ‘F’ or ‘B’

The controller will then repeat back the character array, reconstructed from the internal parsed values. Any corruption or undesired effects should therefore be visible.

This should be sent at 9600 baud. Case is important, no null terminator should be used.

Note: No error-handling is currently used, any other input will cause undefined behaviour and may require an AVR reset to recover the state.

Raspberry Pi Motor Controller Schematic

Development

The code is written using the Arduino libraries, and so should be compiled with the Arduino IDE.

To program the AVR, an ICSP should be used. This will work in-circuit as long although no power should be applied to the rest of the circuit.

 

Foir more detail: Raspberry Pi Motor Controller


© 2015 Powered By Engineering Projects Team, Raspberry Pi Projects

Scroll to top