View Single Post
  #52  
Old 12-05-2015, 04:18 PM
SteinHDan SteinHDan is offline
Green Horn
 
Join Date: Sep 2015
Location: Oslo, Norway
Posts: 188
SteinHDan is on a distinguished road
Default Re: 90 ton 1/14 metal excavator scratch build w/embedded PC

I could have used standard ESCs for the gear motors and controlled them using PWM output from the Raspberry like a normal RC receiver.
But for this project I want:
- Programmable current limiting (to avoid burning the motors)
- Current sense (to output a different engine sound if the load is high)
- Acceleration control

I've beem using the Pololu Qik controller for some previous projects. It's a very good controller, but expensive. But you can actually get a better solution to a fraction of the cost by just combining these two items:
- Monster Motor Shileld for Arduino
- Arduino Leonardo

So for this project, I'm going to try that approach.

I'll program the Arduino to be compatible with the Pololu controller commands. That way the controllers can be swapped if I want to do that later.

The Arduinos connect to the Raspberry via USB and will show up as serial ports on the Raspberry Pi (/dev/ttyUSB0, /dev/ttyUSB1, etc..). The Arduinos are also powered by this same USB cable, so no additional power cable is needed.

To write motor controller commands to the serial port, I'm using the Node.js Serialport module:
To install:
- npm install serialport

Typical code:

Code:
var SerialPort = require("serialport").SerialPort
var serialPort = new SerialPort("/dev/ttyUSB0", {
  baudrate: 9600
});
serialPort.on("open", function () {
  serialPort.write(controllerCommand);
});
Reply With Quote