Thursday 2 January 2014

PKP (automating a paintball gun)

On the more physical side of development on PK, I worked on how I was going to mount my Spyder Victor to PK, and how to trigger it from a microcontroller. Here is a rough mockup of what my mount will probably look like:
The grips on the gun will be unscrewed, and it will be sandwiched between 2 metal plates like so:
Behind the grip both plates will have a hole big enough for a piece of 1/2" PVC to fit thru, and that will be connected to 2 elbows which will in turn be connected to the base of the bot. In front of the air line, another hole will be cut into both plates which is big enough to fit a 1/2" tee, the tee will have pipe coming down out of it, and will be connected to another tee facing up and mounted on the center strut of PK. This will create a tripod that should hold the gun securely. On the topic of triggering it remotely, I think I have decided to use a servo mounted thru a hole in one of those plates with the servo arm resting on the trigger like so:

The servo has enough torque (barely) to pull the trigger when it is cocked, so that should work fine. On the off chance it doesn't, I have stronger (but slower) servos that could be mounted in it's place.

In this picture you can see how the metal plates will be mounted to the gun:
Of course it will be extended further than the plastic is right now, and it will be secured to the front with a pipe clamp instead of a zip tie, but that is how it should turn out. Notice the gun will be completely removable, and will remain unmodified so I can still use it when my robot isn't.

A picture of the entire gun: (yes, my barrel is 1/2" PVC, cheaper than a real barrel, and more accurite than the stock barrel)
Anyway, that's the progress so far.

PKP (Or Trials and Tribulations on Building a Homemade Motor Controller)

I decided I had done enough mechanical work on Project Killzone for the moment, and should give the electronic side some love too, so I started working on my motor controller. The motor controller I am using was built for another (failed) outdoor bot named GPS Here is the link to his project page on LMR, for those interested. You can find a couple more details and pictures on the build process on by following that link. As I mentioned in my earlier posts, I couldn't get the speed control to work on one of the channels when I tried using it PK originally, so I just cut out the speed control part of the circuit, and used only the direction control portion to drive the motors for testing. So, to start, I had one relay block, a driver for the relay block, and the goal of a motor controller that has variable speed and direction control inputs that respond to servo signals (1-2 ms, with 1.5 being centre or stop).

Here is a schematic of the relay+driver portion of the controller: (drawn by hand and scanned, forgive the quality)

And here is a schematic of the speed control portion: (this one was found on the Internet)


This circuit sits where it says "speed control circuit" on the first schematic, except the top leg of the MOSFET connects directly to the wires going to the relay, instead of going thru the "motor" connector and to 12v. Also note that when I built this, I used 2N3904 transistors for the relay section, some random NPN transistors that were sitting in my parts bin for the MOSFET drivers (ran out of 2N3904s) and some generic N-channel MOSFETS that came out of 18v cordless drills. Here is a link to the relays I purchased from ebay (5 relays for $13 shipped) (If that link is down, just type 60a 12v relay into ebay, and scroll down)

I already had the relay drivers set up and working nicely, so the next step was to figure out if my MOSFETs were fried, some quick circuit building and I had this:
I found out that 2 of the 4 MOSFETs I had from the drills were fried. Unfortunately, they were different types (2 different brands of drill) one heftier than the other one. I didn't have much of a choice, so I pressed on. I mentioned that in another post that I would try making this into a smart controller with the addition of a picaxe to receive signals from the master, and do the dirty work of driving the MOSFETs and relays. Well, I tried, but picaxes, while great chips, were not designed with math in mind, and my programming skills are not up to figuring out how to do what I wanted with the picaxe's limited math ability. So I switched to an Arduino, in this case, a Dagu Micro Magician. The Micro Magician is waaaayyyy overkill for this application, and I am basically wasting it, but right now I only have 2 Arduinos, and I didn't want to give up my UNO for this.

Some pictures taken while I was prototyping:
 Close up of the Micro Magician (the RC rx was just used as a handy source of servo output signals):
 Close up of the breadboard-ed MOSFET driver circuit:
When one is prototyping, one's workspace tends to get a little messy:

Once I had determined I had two good MOSFETs, and everything was working well, I moved the breadboard circuit onto some protoboard:
And wired up the entire thing:
Well, if that isn't the strangest shaped motor controller you have ever seen, I'd like to see a stranger one :)

Here are some close ups of each subsystem in the controller, first of the relay block:
The brown wire at the top is + power, and the 4 free spade terminals are the two motor connections.

MOSFETs:
Notice how they are different? I bolted the lower-amp one to the heat sink of the dead higher amp one because it was a lot higher quality.

Buffer boards:
The tape covered one is for the relays (also has the old MOSFET driver circuit, but I just cut the wires and left it alone, the relay driver part still works great) and I just zip-tied the new MOSFET driver board beside it.

And finally, the brains:
Such a waste to use such a powerful board for such a menial task. Due to the characteristics of the Micro Magician, the motor driver accepts 3.6-9v over the power wires, and I also soldered some in-line 4.7K resistors on the input wires, so it will accept 5v control signals (the Micro Magician is a 3.3v device)

Here is a video edited together from footage taken while prototyping, first connected to LEDs instead of the relays, and using lamps as loads on the MOSFETs, then with the LEDs replaced by the relays, and finally all soldered together with multimeters instead of motors. (Note that the voltage is higher when the stick is going one way than the other in the movie, this is due to the signals generated by the transmitter not being equal in both directions)
So once the motor controller was done, I slapped it onto PK (who also got a more improved brain bucket that will stay until I mount the paintball gun (It will get in the way of the mount, and hopefully by then I will figure out a seperate container for the motor controller)) and added my UNO, an rx, a LIPO for logic power, and a custom power distrubution harness complete with relay for switching power to the motor driver and a switch for the UNO, wired it up, and tried it out.
(note that I don't have the UNO wired to the motor controller or rx in this picture, and the rx you see was removed and replaced by a different one.)

A front view picture:
 And back in it's corner:
Here is a video of everything wired, and being controled by a transmitter:
Unfortunately, as that video was being taken, the magic smoke was being let out of the MOSFET from the less powerful drill, so I don't have a video of it driving with the variable speed controller hooked up, because I haven't actually driven it. Anyway, I have bought some (8) 30 amp N-channel MOSFETs from sparkfun.com (Here is the link to the MOSFETS I will be using) and when they come, I will be using at least 2 of those in parallel for each channel, and probably screwing them to an old computer heatsink with a fan mounted over it.

Ahhh, the fun of building your own motor controller for big motors :) That's all for now folks.