BuzzBot – PicAxe Frustrations


I have to make some decisions on what direction I need to go with my buzzbot project, basically I have been frustrated with some short comings of the PICAXE microcontroller.  The main being lack of any onboard timers and having only one common interrupt available.  Also I think that I’m trying to fit too much onto one of these babies. 

Don’t get me wrong I love these little guys, they are fantastic if all I need is polled I/O, which for the majority of the time is what I’m after, however everytime I want to do something time critical I hit a dead end. 

Main issues so far:

PID Motor / Differential steering Control – No timer interrupts and PICAXE not being fast enough to update PID Calculation base on each wheel velocity.  I have no real way of getting around this so I think my options are to move to an actual PIC (as opposed to PICAXE) and program the PID Differential Steering in C / Assembler.

PWM Motor Control – Limited to 2 pwm output pins on the picaxe28, (btw this in itself is not an issue, just trying to get it working on the existing H-Bridge which has 4 wires – and I didn’t really want to use any external logic), I have tried coding a PWM using picbasic, but does not have the resolution, so I may have to add some external “glue” hardware to allow my h-bridge to be driven from onboad pwm and forward/reverse direction.  I’m also cosidering replacing the existing H-Bridge that was part of the R/C buggy with a L293 Dual H-Bridge chip, this in itself will solve my issues with PWM motor control, but still need to resolve the PID issue for my differential steering. 

IR Detectors – I have moved the IR Detector Circuit offchip while playing with PWM / PID control.  This I have implemented using a picaxe08M, also having some issues here, although I think I can get around these.  The 08M only has one PWM onboard, and I’m using this to modulate one of the IR TX LEDS.  I would love to have 2 PWM onchip as the PWM/IRTX/IRRX Combo works really well in detecting objects,  I have moved to a proper IR Receiver rather than just an IR Opto Switch.  I had issues with sensitivity, and using a proper IR modulated Receiver has cut these out.  I guess it was  ambient IR causing the problems.  The only problm I have now is as there is only one PWM I need to modulate another IR TX (The right) at approx 40Khz.  I have tried it in code but no go as the picaxe is not fast enough, So I have been playing around with the “infraout” commands of the 08M,  this in conjunction with the PWM seems to be causing alot of noise on the RX, if I disable the infraout then all works aok, so some more things to look at, it may be that the same onboard timer is being used as with the PWM, or the infraout is spot on 38Khz, as I have found by detuning the PWM down I decreased my falses.  Anyway will look into this a bit more.

BuzzBot – Initial Testing

I started testing last night after finishing initial motor and wheel sensor hookups to my development board.  Couple of minor issues so far. 


I’m using a pic based board from Modtronics. These are great and reasonably priced, along with the prototyping daughterboard.  However I have since found that the onboard RS232 is not on the same pin as the PICAXE28X, so I had to wire in an additional programming circuit, no biggy.  The other issues so far were the wheel sensors.  From my initial design I had used 10K resistors to bias the output of the opto-transistor, this was not tested and when testing the logic probe was picking things up ok, but not the PICAXE, after much stuffing around and not being able to find my multimeter (it was still packed away from shifting house) I ended up prototyping the same circuit, still had some issues, so I went  hunting for my multimeter and of course it was on the bottom box lol.  Luckily thanks to my trusty multimeter I found that the sensor was just dropping down to 3.8v when interrupted, anyway the solution to the problem was a larger resistor, a 22K on the output, this tested AOK, now getting ttl levels when switched, I also noted that the distance of the sensor to the reflective object (paper in this case) was fairly critical.  I modded the breadboard and then found one side was working fine, the other was not being seen.  Checked and found that the sensor was slightly further away than the one that was working.  So out with the hot glue gun and moved the sensor.  Both side are now giving me a reading on the PICAXE.

Motor Tests 

Next I adapted some motor control routines on Hippys PICAXE site to test my motor circuit.  First I tested without my motor control board plugged in, didnt’ want any smoke to escape, and all logic tested aok, then came big crunch of running motors live.  I can gladly say that all tests worked A1 with no issues.  Motor was tested though a range of 3 speeds in FWD, REV, Turn right FWD , Turn Left FWD, Turn Right Rev, Turn Left Rev, Spin Left and finally Spin Right.  While Testing the FWD and REV, I checked the Pulses from the wheel encoders to see how much the same each drive was over 100 counts from the wheel encoders and it looks like the Right side is slightly stronger than the left, no real surprise here as no two motor/gearbox combinations are the same.  I had thought about this a few days ago and knew that with any differential drive system I will encounter this type of problem.

Motor Control Algorithm 

This then leads me onto my motor control algorithm.  Over the last few days I have been researching PID Controller and their application to motor control for robots, as I want Buzzbot to drive in a straight line, also been looking at fuzzy logic, but I think will give that a miss at the moment.  I have been thinking of using and adaptation of the PI Proportional controller from the book “Robots – Inspiration to Implementation”  however so far I’m not 100% happy with the PWM and the way it is from the code I adapted, while it is very simple and works,  I would really like to use the onboard PWMout routines, but as I mentioned in an earlier entry it is only limited to two PWM and to two physical pins on the PICAXE – Bummer!!!!   I also thought I can use the old PWM command.  This command requires it to be refreshed, much like what is happening in  my test code, except with a agreater resolution, unlike the PWMOUT that runs in the background, perfect I thought!, but when I went to test it I found it’s only available on the 08 series…double Bummer!!!!!  So now may have to look at teh PulseOut command.

While the existing configuration does give me three speeds, the lowest is time critical and I notice that when I add a debug routine the slowest speed does start pulsing, also I don’t think it will give me the fine control needed on each of the wheel speed controllers.  I’m going to have to think about this a bit deeper.


All in all everything is working as expected, with a couple of minor hicups along the way.  Biggest issue will be PWM resolution and time of my routines.  I think I’ll need to come up with another way of doing what I want simply and without too much additional hardware if I want a closed loop control system.  While I ponder on this I’ll test the IR Sensor circuits.  These I’ll prototype first before I hardwire in.  Once I finish these I can then start working on behaviour.  I would like to look at using some sort of subsumption model, but will look at it deeper as I get closer.

buzzbot -  Motor Testingbuzzbot -  Motor TestingBuzzBot - Modtronics PIC Board

Buzzbot – Circuit Design

Last night I did some brain storming asto what the I/O requirements will be.  During this requirements phase I came across a bit of a delima with the PWM requirements for the motor controller.  The motor controller requires two outputs per motor, so this rules out using the onboard PWMout command of the PICAXE, as there are only two dedicated PWM pins on the chip that I’m using.  Although I could do it with some additional glue logic in hardware, I don’t really want to do that (as I’m lazy), so now I will be doing it all within the software, this should free up the servo command within the PICAXE, so I can now use this to drive the servo for the sonar unit.

I’m going to be using the PICAXE 28X. With my I/O current configuration of the 22 available I/O on chip, I have 2 Inputs/Outputs and 4 Analogue Inputs Available for future expansion (or and additional 4 inputs if I don’t want to use the analogue inputs).  It will be interesting to see if the processor will be fast enough process everything in a timely manner, especially with the motor control and encoders.  Well I guess I’m about to find out.

I’m now going to actually get my hands dirty with the PICAXE as I still haven’t plugged the development board into my PC yet 🙂

BuzzBot – I/O Requirements

Buzzbot – PICAXE Circuit

CNC – MK1 Modelling Begins

After lots of research I’ve started to put some ideas to paper for the MK1 CNC Machine.  

Yes I know I could probably jump right in and start putting together bit and pieces, but I really want to learn to use some 3-D Modelling CAD Packages for future Robotics projects and since I will eventually need to model components so they can be exported to the CNC machine for milling, I thought it might be a good exercise by modelling the MK1 itself.

So here is the start of the X-Axis Linear Bearings

CNC - MK1 X-Axis Bearings

CNC Bug Bites

Over the past number of years, along with my interest in robotics and software development,  I have also had a keen interest in machining and metal work, I suppose ever since I build my first Stuart Turner stationary engine when I was 15 on my fathers Lathe,  BTW my father is also a very keen model engineer/machinist.  So wanting to merge my interests along came CNC.

I don’t own a lather / milling machine, actually I don’t even have a workshop myself (about to change with my new house being built), although I do have access to them when ever I want its still not the same as ducking out to the shed to whip up a part, in general I find making small components and PCBS a bit of a pain, mainly though lack of tools and proper work area.  So Getting back into the robotics/electronics scene after a long break has also re-kindled my interest in the CNC Area, especially for small robotic parts (plastic and aluminium) and one off PCBs (routing and drilling). 

So in my quest for knowledge, I spent the last few nights browsing what’s out there, and was very surprised to see the huge amount of work that people have done.  I must admit it had been a couple of years since I’ve last looked, and there there are some truly amazing machines out there (check out   Anyway I think I want to start off small first with a low cost pcb router/drilling using a 3-axis with a dremal.  Plenty of photos out there with low cost designs and common parts have inspired me to take some steps and begin some design work, so stay tuned.


Buzzbot – Motor Controller Tests

Ok encoders are in, although not wired up.  So I quickly re-assembled the wheels and motor controller board for a quick test.  Glad to say that everything tested aok.  Put my logic pulser on the inputs and sure enough forward and reverse is easily attained on both motors, although due to the low frequency pulses of my logic pulser the motor speed did hunt a little.  Now reassembling with cabling to go to my pic development board.