Thursday, August 15, 2019

Trackbot (part 1: assembing parts, hatching a plan)

I had some parts laying around and I figured i could probably turn all this into something fun for me to make, and fun for my boy to play with. 
  1. The tracks etc from the Lego Technic excavator (42006)
  2. A couple of Lego Technic motors and some cogs to gear them down a bit
  3. A few Lego power cables including a couple of the ones for lights (8870)
  4. An arduino Uno clone (Freetronics eleven)
  5. Two BBC microbit microcontrollers
  6. An L298N motor driver board (these things are neat!)
  7. A 6s NiMh battery pack (9.6v) with Tamiya RC connector
  8. A potentiometer, various jumper wires, a random DC motor etc 
  9. And Ben's oscilloscope which needs using before i have to give it back.

I didn't have a perfectly crafted plan, but it was something like this:
  1. Remember how to drive a DC motor using the L298N with PWM
  2. Work out how the wiring works for Lego motors and how to connect them to the L298N without cutting their cables (because they're expensive).
  3. Work out how to control an arduino remotely.
  4. Shove it all on the tracks and make an remote controlled .. thing.
After sorting out power to the Arduino (using the 5v output from the L298N), the first thing was to hook up the random dc motor to the driver board (tutorial elsewhere) and use the potentiometer to control the PWM input.  Next was to hook in the Lego motors, which required understanding how they were cabled:

Cut these *before* you find out how much they cost.
To connect the Lego motor to the L298N i created some cables as above by cutting the 8870 cables and soldering jumpers into c1 and c2 (you don't need GND or 9v).  The standard motors can now plug into the Lego end and c1 and c2 go to the screw terminals on the L298N. 

Quite nerdy spaghetti.

The code* worked ok, so I then moved on to the tracks themselves. I already had this layout from when I'd been mucking around with the tracks as a Lego project.  There's one engine per track, and for forward travel obviously they'll be rotating in opposite directions.  I just needed to install the battery somewhere and luckily it just fit right in there..
The tracks; one motor for each track and battery pack


And again from awhile ago, I'd gear the motors down so they can run at full speed and provide slow powerful motive force, all the torque etc:

Two stage reduction gears.
Finally i kinda just stuck it all together and it worked, but there was zero consideration given to the packaging, so I couldn't actually drive it anywhere, and there was no control beyond the potentiometer (driving both tracks, one way only).

So next was do work out how to do the remote control, and that was a bit more interesting..

No comments: