picAxe 8 bit Motor Controller: Look Inside ... 106 Views Author's name: WeRbots Author's ratings = 0 The low-cost picAxe Motor Controller allows you to build a universal motor control for Robots. Just mount the IR detector right on the board. Then you can mount the whole thing on an R/C car or junker robot and wham! You are in business! You need an 8m picAxe chip in the controller. Most are advertised with an 8m chip, although I have found them with only a picAxe 8 pin chip. There is no interrupt in the 8 pin chip, so you will need the 8m to make this design work. Why do this? You can have a controller that you can move around. It is cheap and easy to create the universal board by mounting the IR detector directly on the PC board. Give some examples of alternatives - Like using the TA8080. Get Software... Author's Assigned Keywords: Robot Motor Control Robots Why Pay the Money? Why not buy your own programmer and a pic Chip directly? Its gonna cost ya. Commercial units cost a bundle, the c-compiler alone is a couple hundred. Why does an 85 cent chip cost almost 4 bucks? Because you are paying for two things, a profit (means they buy wholesale volumes and mark it up to retail). Plus, theres a lot of R and D money (true), but eventually theyll get cheaper. Its like buying an old 555 timer. They cost pennies now, but cost a lot more before everyone started building one. We are in a limited demand field (Robotics) so it will take a while for the volume to build up like microprocessors used in common computers. I use one of these in sort of a pre-built unit with an IR detector strapped on, this way I can add it to any old RC chassis. This is perfect for "benders", people (like me) who scrounge semi operational bots and RC toys. It they have a battery controlling motors, I grab them. Then I simply connect the motors to this combo motor drive and IR, and voila! Instant robot, or r/c vehicle autonomy... The extras on the board These extras make the board easier to use universally. They are the switch I soldered to a 3 pin connector so you can switch between programming and operation. Really handy when you have to tweak the program to accomodate some new wild chassis you find. Schematic Diagram The PC Board uses an L293 H-Bridge attached to four io pins on the picAxe 8 or 8m chips. Mine came with a picAxe 8, I prefer to use the 8m because I use the interrupt to get the driver to react in some way to an interrupt source. The source, Sharp GP2D12 IR Object detector. I could use bump switches then the interrupt routine could check whether the IR detector, or a "feeler" switch (right or left) was bumped. But this particular board makes it handy when Im "bending" another r/c model, or just about any other semi-experimental application. Software This is all pretty simple, just pounding pins to drive the bot forward. Then you adjust according to behavior. The rumble bot, when I first fired it up, moved with pretty small steps. So I tweaked the delay times in the software, basically changing the length of time the motors stay on relative to the types of motors in the rumble bot. When the rumble bot was tamed, I moved the whole assembly over to the Tumbler robot, but things got crazy. So again, I tweaked the delay times and made them a lot shorter. I like the way tumbler bot scoots around objects, so Ill probably mount a controller, probably using a picAxe m14 and start with the same basic program in this listing. ========================================================================= `------------------------------------------------------- ` ` picAxe Motor Control ` Created by: Jim Huffman ` Rev 0.1 October 18, 2007 ` Rev 0.2 October 20, 2007 JH ` Rev 0.3 look around functions begun Oct22, 2007 ` Rev 0.4 Changed Motor Drive approach Nov 04, 2007 ` `------------------------------------------------------- ` ` Initialize System Wide Values ` ` Directives ` Select and initialize chipset #picaxe 08m ` ` System resources symbol fwdM1 = 0 `(pin 7)(Careful, Used in Programming) symbol revM1 = 1 `(pin 6) symbol revM2 = 2 `(pin 5) symbol IRsense = 3 `(pin 4)(input only on 8 pin) symbol fwdM2 = 4 `(pin 3) ` (pin 1 Vdd, pin 8 = Vss, pin 2 = Serial In) ` ` Motor Control constants ` assumptions: ` open means no output ` trying not to use external chips, only 3904s (4 outs) ` using a single sensor with dual IR emitters ` motors are M1 and M2 (cheapies from Avoider Robot) ` powered by 3x 1.2v liIon (use button batteries?) ` ` vars symbol storResult = w2 ` place to put ADC10 results symbol storResShrt= b4 ` place to put adc results ` ` `-------------------------------------------------------- ` Code Blocks: ` let dirs = %00010111 ` short wait before main routine begins setint %00001000, %00001000 ` ` main demo routine `It goes like this ` gosub (fwd,rev,leftspin,rightspin) ` pause - long as you want it to do the appropriate subroutine ` gosub stopAll - You have to stop it from driving, don`t forget this ` That`s how you make the world go round ` init: `gosub fwd `basically, you make it go, then you pause for running time `obviously, an interrupt loop makes it quit driving anytime gosub stopAll `don`t forget to stop the action you put in motion pause 3000 `think and abandon all hope loop main: gosub fwd pause 30 goto main interrupt: `if pin3=1 then interrupt gosub stopAll pause 50 `think a second little machine :-) gosub iSpy setint %00001000, %00001000 return ` Look to see if a spot is clear, then head in that direction iSpy: gosub rev pause 150 gosub stopAll gosub leftSpin pause 80 gosub stopAll if pin3 = 1 then `still in trouble that way gosub leftSpin ` call yourself until you`re out of trouble pause 70 gosub stopAll pause 150 if pin3 = 1 then `still in trouble that way gosub rev pause 100 gosub stopAll gosub leftSpin ` call yourself until you`re out of trouble pause 100 gosub stopAll pause 100 return endif endif return ` found a hole - start driving again `----------------------------------- ` Drive Routines ` fwd: high fwdM1, fwdM2 pause 5 return rev: high revM1, revM2 pause 5 return stopAll: low fwdM1, fwdM2, revM1, revM2 pause 20 return leftSpin: high fwdM1 high revM2 pause 5 return rightSpin: high revM1 high fwdM2 pause 5 return picAxe Development URLs Cheap, quick picAxe (US) supplier: <a href="http://www.phanderson.com/picaxe/">PH Anderson</a> The Original picAxe chip was created and developed here: <a href="http://www.rev-ed.co.uk/picaxe/>Rev-Ed</a> Object Detection using 38 kHz Pulsed Infrared - PICAXE-18X: <a href="http://www.phanderson.com/picaxe/ir_1.html">picAxe and IR Tricks</a> General picAxe apps: <a href="">PH Anderson again!</a> Use of a PICAXE-08M as an Accessory to a Basic Stamp, PICAXE-18 or Similar: <a href="http://www.phanderson.com/picaxe/pwm_stamp.html">picAxe apps</a> PICAXE Infra-Red Interfacing: <a href="http://www.hippy.freeserve.co.uk/picaxeir.htm">Hippy - great source picAxe trips and learning</a> |
Top Ten Most Viewed Projects: Build the L298 H-Bridge Motor Control Views: 9287 picAxe 14m Motor Driver Board: Make Your Own Views: 9076 Build Your Own Track Drive Robot Views: 6956 CwhatIcanDo Website Views: 6707 BEAM BOT: HexBug Exposed! Views: 6404 Converting a Flashlight to LED Views: 6328 Build a Robot In 5 Minutes Views: 6131 Building an RFL Inspired Upright Robot Base Views: 5334 Junk Box Reviewer Itching To Start Building A DIY Do It Yourself Project? Got Some Parts of Your Own in your JunkBox? Find projects by Surfing' the Parts List! |
©Copyright 2008 - , cwhatidid.com, all rights reserved.

