Saturday, May 29, 2010

Off and Running


The machine has gone mobile!

The previous potentiometers were a bit touchy, so I added two 1.2k ohm resistors on the steering control ground and 5v line so there's fuller range around the center. I tried the same with the speed control but that cut the speed down way too much, so that one is back to using the full range.

I added a DPDT switch to act as a neutral setting ... when thrown one way, the lines to the motor controller come from the center pickup on the potentiometers. When the switch is thrown to the other side, the motor controllers get a 2.5v signal (centering steering and throttle) derived from two equal resistors between the ground and 5v power. This sets the control input to the center, and the motors stop.

The form factor for controls is a big part of how usable they are, and my homebrew system is rough but functional. I mounted the steering control on the end of a steel can (I believe it was re-fried beans that were used for nachos) with the throttle coming out the right side and the neutral switch on the front.

I used some square 3/4" oak as levers, drilling a hole for the control, cutting a slot in one side, and drilling another small hole so a bolt and wing nut can squeeze the wood tight on the shaft. The 1/4" drill made the hole slightly loose, so I shimmed it with a bit of metal from a cat food can (thanks Robert Pirsig) and everything tightens nice and snug.

Tuesday, May 18, 2010

Ready To Roll

It's almost ready to roll! Here's yet another picture of the motor controller, this time with a four conductor ribbon cable attached to the control inputs. I also marked the power cable from the battery so there's less chance of hooking it up and mixing the polarity.

The other end of the ribbon cable is a quick assembly of two 5K potentiometers. The Sabertooth controller has two inputs that can be configured in many ways, but I've picked the basic analog mode. In this mode the controller reads voltage levels and determines what to do.

It can work two ways: individual motor control, or mixed. With individual motor control, each controller runs one motor. For the two sides, 2.5 volts has no motion, while higher and lower voltages move the motor forward or reverse. The two motors run completely independently.

In mixing mode, one control is steering while the other is forward or reverse. The Sabertooth figures out what you're trying to do and controls both motors accordingly.

I confirmed the controller worked as expected with the robot up on blocks, then dropped it to the ground and bolted on a plywood platform.

Of course, I had to take it for a ride! It was hard to control, and even keeping at a slow speed I bumped a few things in the garage. The independant motor controls were not intuitive, especially when they were two random controls held in my hand.

The controls were very sensitive, but I managed to make trips forward 15 feet, back up and turn around a few times. I switched over to "mixed" mode and it became much easier ... more car-like with steering and power.

This thing will do some serious damage if it runs loose ... it's heavy and feels like it could go pretty fast.

Eventually I'm going to hook up an Arduino controller, but first I'm going to work on a better set of controls and take it on a trip outside.

Monday, May 10, 2010

Wheels and Motor Controller Attached

Once the motor controllers were given one last test, I screwed on the protective black covers and mounted the motors. I ran the new encoder signal cables through rubber grommets and holes through the side of the main bucket. The signal cables were left coiled up for hookup to a microcontroller later.

I had to shim one motor a bit to get the wheel in vertical alignment -- it was leaning in a bit while the other is straight. A few washers on the inboard bolts helped make it match the left side. Hopefully this will help it track straighter.

I cut some sheet aluminum to fit over the battery charger area and bolted it down using an existing hole in the bracket.

The motor controller is a Sabertooth 2x25 that's mounted on top of this plate with a few small bolts. I think it has enough contact with metal to keep it cool.

I want to protect this area more as additional parts are built on top, but for now this should be good to test the motors.

The front terminal strip on the motor controller has six connections. The middle two are for the battery power, which comes via a cable scavenged from the wheelchair base.

This previously plugged into the wheelchair motor controller, which I couldn't easily interface to and found a new home on eBay. I don't have the matching connector, but I think I can make something that will work. I could just cut the cable, but like the idea of having something easier to disconnect.

Two spade connectors from the hardware store fit in the connector snugly, so I built a short pigtail set of wires that are secured to the controllers terminal screws on one end and plug into the batter cable on the other.


This is now hanging out in the open, so I'll have to figure out a way to mount the connection solidly and make certain it can't be pulled out by all the vibration when this thing is bouncing around.

I grafted a similar pair of connectors onto the wire coming from the battery charger.

The charger has a 3rd wire (in addition to the +27v power and ground) that I'm not sure of what it does. Originally this plugged into the wheelchair motor controller, not directly to the batteries.

It passed the basic smoke test when I plugged it in, then the current soon dropped to a trickle, which seems good since the batteries are fully charged.

I'll wire the charger directly to the batteries, before the kill switch. That way I can cut the power feed to the motor controller, then plug in the charger and feed the batteries while the rest of the circuit is isolated.

I measured the current feed from the batteries back into the charger and it was less than one milliamp, so it should be OK to leave it in the circuit during normal usage.

The next step will be wiring the motors to the controller.

Thursday, May 6, 2010

Motor Encoder Circuit


The circuit I ended up using for the motor rotary encoder is pretty simple. It's nothing original, I learned how basic IR LEDs and detectors can be wired up from the Society of Robots tutorials. Also see the one on sensor building.


I used the following parts from Mouser:

720-IRL81A : 880nm IR emitter
512-QSE113E3R0 : 0.25ma, 5v IR detector

The resistor values I used were determined by experimenting with a breadboard. I managed to fry one emitter in the process, but the results should work OK. I'm sure you could substitute similar values for almost all the components, perhaps saving a little bit of power.

My second sensor came out a lot nicer than the first, primarily because I just used Manhattan style construction from the start and had a reasonable idea on how to lay out the circuit pads after doing it once already.

Unfortunately my photo is horrible, but here is the second board getting it's smoke test in a prototype system. The IR LED is visible in the upper left, picked up by the camera sensor but normally invisible to the eye. The red LED on the right is driven by the end of a few feet of cable, which will eventually be monitored by the Arduino.

It worked fine so I bolted it down on the rear of the second motor and after fiddling with clearance a bit I button it up.

The motors were then re-mounted on the frame and tires installed. Next comes a bunch of mechanical work to mount the motor controller, fix the linkages on the motors that disengage the gear box, and secure the motor and battery wires.

Tuesday, May 4, 2010

Primal Rotary Encoder

I've built the first, very ugly rotary encoder on the left motor. It consists of a sheet of copper PC board with a basic circuit of a infrared LED, an infrared detector, and a transistor. Three resistors are included, each one feeding from the +5 volt power line to the device.



I attached a modified cat food can on the end of the motor shaft. It attaches nicely where the previous brake material was and is held in place with that mounting hardware. I trimmed down the sides and punched 16 holes around the sides. I'll spray it black before the final assembly.

Here's how it works : the motor spins the cat food can with holes. On one side, the infrared LED shines, and inside the infrared detector sees this flashing on and off as the holes spin in between. The output from IR detector is fed into the base of the 2N2222A transistor. This acts as a switch, conducting and changing the voltage across the collector and emitter. This voltage is fed up the cable to the Arduino microcontroller, where it will be counted and thus tell how much the wheel is moving.


The IR LED shines from the outside into the center and hits the detector.

The circuit construction is hideously rough, and I should have a much nicer looking second one when I make it. I first tried a NJ Island pad cutter but didn't lay things out very well, so reverted to Manhattan style islands clipped from bits of PC board. It's rough, and I still need to glue down some parts.

The circuit board is resting on a felt furniture pad - a small chunk of adhesive backed felt that's used under table legs and such to protect your floor. It's sandwiched between the board and motor case by machine screws in the holes that previously mounted the brake.

A three wire cable will hook this up to an Arduino ... one wire for +5 volts power, one for the signal coming back from the detector and 2N2222A transistor, plus the ground shield.

(The copper wire coil on the left is completely useless and is not wired into anything. I added it as artistic eye candy.)

As rough as this looks, it works and should be rugged once I reinforce it with some epoxy.

I'll get a parts list, schematic and hopefully a nicer looking second encoder for the next time ...

Saturday, May 1, 2010

Batteries Mounted

Making some progress ... I build a wooden frame so the batteries fit snug in the base. This is a H-shaped oak frame made from 3/4" wood.

It fits in the bottom box, which is an amazingly strong metal plate. It's probably 1/8" thick steel, so it's totally solid even with the weight of the two batteries. Mine are actually a bit smaller than the production batteries.

There's a simple board that spans the top of the batteries and a threaded rod between the two. A wing-nut holds it all tightly together so there's no wiggle room when it's all clamped down.

The batteries are now mounted, but I'll probably have to haul them out one last time when I put the motors and main wheels back in.

I also have the circuit breaker and auto headlight
"kill switch" mounted right below the charger power connection, so the basic circuit is coming together.

I'm working on the motor rotary encoders next.