I purchased an old Ignite RC tank from the thrift store for $4.
I took it apart and discovers they were using a simple array of transistors to make an hbridge circuit to control a motor for each track on the tank.
I powered up the board and started testing points until I found the logic pins for each motor. After mapping out the logic pins I can now solder my wires to bypass the RC receiver and run each of these leads to my Tessel 2 digital pins.
I'm using a voltage level shifter to go from 3.3v on the Tessel 2 to the level shifter which will bump it up to same level as the battery for the motor. Digital pins 0 and 1 are for motor 1 and digital pins 2 and 3 are for motor 2.
I chose a 7.4 Volt Lipo battery to power the motors and I'm using an old USB battery to power the Tessel 2.
Here is a shot of it all connected.
I'm using the Tessel 2 to run a simple web sever to serve up my controls page where I use websockets to communicate the button click/touch events back to the Tessel 2. I then access the controller page from my phone/tablet using a modern browser.
Here is some of the code where I define the motor pins and the logic for driving the tank in each direction.
// motor pins
const pin0 = tessel.port.B.pin[0]
const pin1 = tessel.port.B.pin[1]
const pin2 = tessel.port.B.pin[2]
const pin3 = tessel.port.B.pin[3]
// set pins low
pin0.output(0)
pin1.output(0)
pin2.output(0)
pin3.output(0)
// left motor
function leftMotor(v1, v2) {
pin0.output(v1)
pin1.output(v2)
}
// right motor
function rightMotor(v1, v2) {
pin2.output(v1)
pin3.output(v2)
}
// move forward
function forward() {
console.log('forward!')
leftMotor(1, 0)
rightMotor(1, 0)
}
// move reverse
function reverse() {
console.log('reverse!')
leftMotor(0, 1)
rightMotor(0, 1)
}
// rotate left
function rotateLeft() {
console.log('left!')
leftMotor(0, 1)
rightMotor(1, 0)
}
// rotate right
function rotateRight() {
console.log('right!')
leftMotor(1, 0)
rightMotor(0, 1)
}
// stop
function brake() {
console.log('brake!')
leftMotor(0, 0)
rightMotor(0, 0)
}
Here is a compilation of the entire process. Hope you enjoy.
Comments