Saturday, 21 April 2012

Putting It Together

I spent about 10 hours today polishing off the chassis and getting the circuitry into the actual robot itself. It was a long day so this'll probably be a fairly long post :)

Before actually getting circuitry in, I decided the first thing to do was polish off building the frame and find some way of making the wheels a little less wobbly. Due to my lack of correctly sized bolts, this has been trickier than it should have been, however I've come up with solutions for most of the issues - albeit not particularly elegant ones! So first up, is to reinforce the chassis with a bit of aluminium:

Mm Bot chassis with aluminium frame.

You can see the reinforcements going around the base of the chassis there. Cutting these with my Dremmel was great fun, although I recommend wearing goggles or squinting - aluminium dust in the eyes hurts. With these motors at full whack collisions won't be pretty, but once the reinforcements are glued down with some epoxy resin it should reinforce the frame enough to withstand the odd bump.

Next, I attach the back 'wheels'. These are 2 little roller balls - I needed bigger ones really but these will do for now. After a bit of creative gluing I put together a little wooden frame to screw them to, and then glue the whole thing to the underside of the chassis:

Rollerball rear wheels

The robot can now roll freely on the floor, so I try to get my new Saber Tooth motor controllers working. This didn't go particularly well. First up, I realise I've bought the Saber Tooth 2x5 RC version, which only accepts RC (radio control) style signals - timed pulses just like a servo uses. What I was after was the plain old Saber Tooth 2x5, which costs exactly the same and supports RC, simple serial and packetized serial communications. Oh well - I bite the bullet and decide to try and make do with this version for now:

Test circuit to try getting Saber Tooth working

 I have spare motors and a spare Arduino, so I start building a simple circuit to test the Saber Tooth. The motor controller has 3 inputs:
  • Forwards - give it a signal to say what speed to go at
  • Turn - give it a signal to say how much to be turning
  • Flip - flips all motor signals - handy if you're making a robot that can turn upside down!
I spend the first 20 minutes realising that a few companies decided to use brown wire for GND, instead of black wire like the whole of the rest of the world. Once I have this figure out, I connect everything together - will post a circuit diagram here if I get time, but it's not a massively interesting one.

After a lot of fiddling and trying both analogueWrite and the Arduino servo library, I end up just manually sending pulses of a fixed length to the controller. Finally the motors turn, but I still can't see a clear relationship between pulse length and speed. This is made worse by the fact that I'm still under-powering the motors, so even if I've got it right I might not see the results. Oh yeah - and my multimetre ran out of batteries so I couldn't test it :) Anyhoo, it works a bit, so I put it in the chassis and wire it to the Arduino Mega and the actual motors inside the robot. 

Now more goes wrong - hurray! First up, I need to download drivers for the Arduino Mega. Fair enough - only takes about 5 minutes to work that one out. I upload my code to the new chip and.... nothing happens. After about an hour I realize a connection to one motor was loose, and the other one just mysteriously doesn't work. Turns out that I'd used too long a bolt to attach it to the frame, which has pressed against and physically bent the steel gear box! 1 replacement motor later and I do the same thing again (as I didn't know that's what'd gone wrong). Another replacement motor and it kind of works but I'm still not entirely clear what signals I should be sending the motor controller..

After all that pain I decide there's just too many variables to make more progress using the Saber Tooth RC. I order the motor controller I wanted online, and make do with the very basic ones I built a little while ago (see Big Fat Motors post) as I know for a fact they work and....

Finally! Life! Mm Bot takes it's first very slow, under-powered and very wobbly steps:

Not exactly elegant, but who is at 5 minutes old? 

As a quick note, somewhere along the way earlier I tried to connect up the blue tooth as well, but dodgy connections were being a pain. I decided to totally unsolder the pins to it and solder wires directly to the connections, which was a good hours work. I reaped the benefit eventually and got the Arduino Mega communicating in the same way as my earlier Beginning Blue Tooth post. More on that next time though.

So, I head out for lunch at about 4pm (oops) and after a nice all day breakfast I head up to maplins and buy another big prototyping board and an 8*1.5V AA battery holder. This'll give me 12V of power to pump through the motors instead of the measly 3V in the video above!

Armed with my new parts, I start loading them into the robot:

Mm Bot with Arduino, motor controller and motors inside

The 2 battery packs (6V for Arduino and 12V for motors) are hidden in the rear. What you can see in the main compartment is the Arduino with lots of wires coming out ready to attach to the prototyping board. The Arduino Mega supports loads of connections, but for now I'm going to expose 11 digital IO pins and 2 of the serial connections, which should be more than enough to get going. Here's the next layer, with all the wires connected to the prototypng board, ready to fiddle with:

Mm Bot second layer, with connections to the prototyping board

Here you can see the Arduino outputs all connected to the board. Also on the right are some wires to connect to switches that will turn on/off power to the Arduino or Motors. Due to shortage of switches though it's just wires to join together for the moment :)

And that's where I got to so far. The robot actually moves at a crazy speed now and so was tricky to get a video of. However, tomorrow I'll hook up the blue tooth and get some more sensible code in there to drive the motors at low speed so should be able to get some decent shots of it on the move.


No comments:

Post a Comment