PICAXE 20M2 + Magician Chassis = MaGicAxe Mobile Robot!
by Eric Ostendorff
This material supplements a construction article in ROBOT magazine, July/August 2012. It uses information from parts 1 and 2 in previous magazines about circuit building and programming. Builders should reference those articles in order to have more complete knowledge of the PICAXE 20M2 and its function before building the MaGicAxe robot.
Circuit board reminders: Per the 20M2 diagram shown, include both filter (100 uF) and bypass (0.1 uF) caps on the board adjacent to the 20M2â€™s power pins, Pin 1=Vcc, Pin 20=ground. At the programming jack, include two resistors (10K and 22K) per PICAXE Manual 1. The robot uses 4x NiMH AA batteries which are inaccessible between decks, so route power wires to the circuit board and switches to make direct battery connections available for a trickle charger. Connect 3-pin servo-style headers to all pins B.3-B.7, with direct battery and ground connections in order to connect a variety of sensors and accessories (photo). We are only using 10 of 16 I/O pins in part 3, but mount your board so that you can remove it and modify it later. Most any 38 kHz IR receiver modules will work on pins C.0 and C.4, typical module connections are shown.
Touch sensors: The 3 pennies I used are countersunk and flush mounted into a plastic plate adjacent to the circuit board. Each penny has a small wire soldered to it connecting it directly to PICAXE pins C.1, C.2 and C.3 as shown in the bottom view of the circuit board. Fingers must not come into direct contact with the pennies. Apply a thin piece of clear packaging tape on top of the pennies. Touch sensor values can change significantly when the programming cable is disconnected. It may take some experimentation to determine thresholds that function properly when no cable is attached.
LED Scanner: I used low-current (1 mA) 3mm LEDs from Junun throughout, so my seven scanner LED series resistors are 1K, visible in the bottom view of the circuit board. They are individually selected by PICAXE pins B.0-B.2 and driven through the 74HC138 decoder shown. The eighth output drives a piezo beeper with a built-in oscillator. It is only necessary to provide DC power to the beeper through the decoder to generate sound.
Software: All software will have to be calibrated for your particular robot, especially servo pulsouts and touch sensors. The code is commented for easy following. Where appropriate, I have commented out (shown in green with a leading apostrophe) various sertxd commands which are useful in debug and calibrating with a programming cable attached. By deleting the leading apostrophe, you can see the calibration values onscreen for adjustment and calibration, but they must be commented out for proper function.
squareLED: multitasking program drives the robot in a right square pattern while running the LED scanner
IRcontrol: reads IR remote keys 1-8 to select LED (1-7) or beeper (8). Actual values shown via onscreen terminal.
driveIR: multitasking program runs LED scanner while letting you drive the robot around using IR remote. Forward= Channel+ Backward= Channel- Stop=Menu Left= Volume- Right= Volume+ Decrease LED speed=4 Increase LED speed=6
LEDdialSPIN: uses the touchpads as a rotary dial to control the robotâ€™s rotation and LED display
touchcount: input a number in binary using the touchpads and display on the LEDs
bigtrak: use the touchpads to input a path for the robot to drive. Each press makes the robot drive or turn a certain distance. Forward, left and right directions are obvious. Stop=left+right Reverse=forward+right End path=forward+left Playback=all three
Continuous Rotation (CR) Servo Mod PDF