Android Apps!

8 September, 2011

Today I have published my second Android application, Gas It Right Pro. It’s a paid version of an ad supported app, Gas It Right, but with lots more features. Please take a look and support my new hobby!

The idea of Gas It Right is to help you choose the correct amount of fuel/gas into a hire car that was delivered without a full tank (eg 3/4 full). This happens to me all the time and I invariably overfill “to be safe”. I wrote this to save money. Please do the same and download it now!

Gas it Right Pro (Android v2.2+)

Gas it Right (original, Android v1.6+)

Gas it Right Pro Screenshot

Home page of Gas it Right Pro

Cooperative Swarm of Robots

18 August, 2011

This is an amazing achievement!

New laser cutting service

2 February, 2010

It’s been nearly a year since I had real trouble trying to machine my own parts and failing miserably!

Since then I have been working tirelessly with others to set up a hobbyist friendly laser cutting service in for those in the UK.

I present you with ShapeMonkey!
ShapeMonkey Laser Cutting Service

Currently this offers a simple upload, pay, and receive service for acrylic and balsa wood. More materials and products will be offered in time. This is the kind of service I was looking for back then. Hopefully others reading this blog will find the service useful.

Please give as much feedback as you can. For example: What materials should be next?

Laser cutting in the UK

10 September, 2009

Sometimes I wish I lived in the states because there is a service for everything and everyone. In particular I’m thinking about how easy laser cutting (and other forms of machining) is for tinkerers like me and my readers.
Has anyone had any experience of laser cutting services in the UK? Please post in the comments if you had a good/bad experience, or if you’re seeking a service.

I can’t machine for toffee

24 February, 2009

I had a go at doing some mechanical work at the weekend. I tried to machine the acrylic I bought and create some kind of joint using a stepper motor. I have to say that I failed rather miserably!

I tried scoring and snapping the stuff only to find that a cut length of anything longer than about 10cm was impossible! A hacksaw proved much better but I really don’t have the benches, vice, etc to make a decent job of it. I’m now thinking about getting something made up. The problem with that is that I’m finding it difficult to start designing when faced with a blank screen on a CAD package. It is holding the robot arm project up though.


In other news…

I purchased some bits off ebay. Firstly I bought some Picaxe compatible kits to help me prototype. Some of these are Picaxe-08 kits so I shall be making some compact stepper motor controls shortly. They were from rkeducation (they also have a web site).

Secondly, inspired by a kite aerial photography (and some RC) videos I decided to buy some radio gear. I now have a 6 channel transmitter and receiver which work well with the servos I have. I see a few more projects coming up…

Recommended Robotic Books

29 January, 2009

Here’s a few of my favourite books I refer to on a regular basis. If you do intend to buy one of them please consider using the links provided to support my robot expenses!

My Robot Books

Programming and customising the PICAXE Microcontroller, David Lincoln, David Lincoln (More Info)

This is a fantastic book! Really accessible, plenty of examples, and loads of help with coding. I’m technical but not a hard-core programmer so this book works well as both a teaching aid and also a reference book. It also covers all the PICAXE chips (8 to 40-pin), how to connect them up, program them, and use their special functions. This is well worth the (relatively small amount of) cash. I have found a couple of times now (and BasicX24: I’m looking at you!) that you buy some hardware but the documentation (or software or programming hardware) is really poor or expensive. Not the case here – If you’re planning on developing for PICAXE chips then More info

Mobile Robotics: Inspiration to Implementation, Anita Flynn et al. (More Info)

This was a favourite book of mine for a long time and is considered to be one of the definitive ‘bibles’ for robotics hobbyists. It’s getting a little dated with regard to the microprocessor of choice (an 68HC…) – at least with the amazing crop of hobbyist chips available these days (Picaxe, Stamp, Arduino, PICmicros, Amtel AVR, OOPic, etc). That was what put me off attacking the electronics side of the main project discussed inside. Saying that the book is great in two respects: 1) It’s inspirational and well written, and 2) It discusses many of the details of building a mobile robot in depth. These include motor choice, battery choice, and sensors. The book is crying out for a new addition but I think it’s still worth a look if you’re getting into the field as a hobby, particularly at the current price.

Robot Builder’s Bonanza (ed 1, 2, and 3!), Gordon McComb et al. (More info)

I’ve incredibly got two editions of this book and there exists a 3rd edition already. Whilst I can’t comment on the latest I’d like to say a few words on the series which will hopefully inform anyone considering a purchase.
It sells itself as a practical how-to guide and I have to say that in some respects it’s smack on but in others it’s lacking somewhat. As with Mobile Robotics it discusses sensors, batteries, and motors. The 2nd edition even discusses choice of microprocessor and includes the Stamp, the BasicX, and the OOPic. I’m sure the 3rd edition will include some of the more recent trends such as the Arduino too. My main criticism of the book is the mechanical how-tos which take up a lot of the space. These attempt to show you how to build robot arms, etc., and how to deal with gears, chains, and sprockets. They ALL use aluminium section and frankly look ropey. I’m sure that they do what they’re supposed to but I consider these sections the least useful. It does tell you how to work with different materials (plastics, wood, etc) but I would loved to see some plastic section builds of the kind I see so many of on the web.
To be fair though it does have some well thought out sections and it’s a good general reference on electronics, interfacing with microcontrollers and PCs, and plenty of programming examples. Although I have been a little critical I still think it’s a good purchase (particularly because of the price – in fact I think I’ll buy edition 3 now! Done!…).

Update: The third edition has arrived! The first thing that struck me is just how big it is compared to the other editions. In fact I think each edition is about 1.5x bigger than its predecessor! There’s some interesting bits on toy hacking, some more recent electronics bits (like the use of accelerometers), etc. Edition 2 talked about a range of microcontrollers – this edition scales back to talk about the Basic Stamp (2) only. I can see why they chose to, they can go into more detail and not worry about being experts in everything, but it’s a bit of a shame. Worth the purchase though…

Bipolar stepper motor control with Picaxe and L293D chips

28 January, 2009

I’ve now got a schematic and program for running a bipolar stepper motor via a serial interface (just as for the unipolar case). This is important for the robot arm cause because two of the three steppers will be of the bipolar kind.
Where driving the unipolar stepper required only current ‘pushing’ (ie all in the same direction through a common ground), a bipolar motor requires current to flow in both directions. The following image shows the difference.


In theory the control of this is very easy with two half H-bridges (essentially four transistors) controlled by several Picaxe output lines). The basic concept is shown below.



The L293D chip has the requisite transistors and a nice interface (with lots of extra features that my DIY skills couldn’t match). I’ve also used it in the mobile robot experiment to control the direction of 2 motors.

As with anything like this though, one needs to think through the sequence and outline a table of output values corresponding to the steps, as below.

Direction Coil 1 Coil 2
N + 0
NE + +
E 0 +
SE +
S 0
W 0
NW +

At first I was using 6 output lines (!) – 4 for each of the transistor inputs and 2 for enabling or disabling the L293D’s 2 ‘half h-bridges’. In this configuration it could be reduced to 4 by using an external NOT gate (because 2 of the controls are always the opposite of another 2). Such a scheme would look like this:

Direction EN1-2 1A 2A EN3-4 3A 4A
N 1 1 0 0 0 0
NE 1 1 0 1 1 0
E 0 0 0 1 1 0
SE 1 0 1 1 1 0
S 1 0 1 0 0 0
SW 1 0 1 1 0 1
W 0 0 0 1 0 1
NW 1 1 0 1 0 1

But while trouble shooting this (I had swapped LSBs with MSBs so it probably did work after all!) I came across a site tying the enable lines Hi and using 4 control lines. At the poles one of the loops must have zero current flowing through it. In the above scheme this is done by setting the enable line Low and ignoring the A values. In the 4 line scheme this can be achieved by sending the same control output to both ends of the loop (ie the potential difference across the coil is 0). Then the table looks like this (including half stepping):

Direction 1A 2A 3A 4A
N 1 0 0 0
NE 1 0 1 0
E 0 0 1 0
SE 0 1 1 0
S 0 1 0 0
SW 0 1 0 1
W 0 0 0 1
NW 1 0 0 1

That makes the schematic as follows:


…and the program as follows. Note that this program is designed to wait until it detects a serial input on input 0 (pin 17) in the form of three bytes: The first is a qualifier – 85 uniquely identifies this stepper motor – the second is the number of steps – 0-255, and the third is the speed – 0-127 is backwards, 128-255 is forwards.

'Serial driven stepper motor by DMT195

symbol posrotor=b0
symbol numturns=b2
symbol speeddir=b7
symbol direc=b8
symbol pulsegap=b3
symbol counter=b4
symbol modrotor=b1
symbol outbyte=b5

posrotor = 1 'set starting position

start:    'main sequence - wait for command then move the motor
 numturns=0   'sets a default number of turns
 high 7    'reset ready flag
 serin 0,T2400,(85),numturns,speeddir 'get serial data
 gosub getspeed   'get the direction and speed
 gosub move       'perform number of steps
goto start

 if speeddir>128 then  'find direction and store in direc (1 is +ve, 0 is -ve)
 'gets the speed 0-127 negative, 128-255 positive (higher =faster)

 for counter=1 to numturns
  pause pulsegap      'wait before moving again (set by speed)
 if direc=1 then
  posrotor=posrotor+1 'increase/decrease the step by one
   gosub moverotor  'set the rotor position for this step
 next counter

 modrotor=posrotor//8    'find out where the rotor arm should be (1 of 8 positions)
 lookup modrotor, (0x08,0x0A,0x02,0x06,0x04,0x05,0x01,0x09), outbuyte
 '(%00001000,%00001010,%00000010,%00000110,%00000100,%00000101,%00000001,%00001001) is (0x08,0x0A,0x02,0x06,0x04,0x05,0x01,0x09) in hex
 'looks up the step from the sequence and applies it to the output pins

Please leave comments if you’ve found this useful or if you think I’ve made a mistake.

I have something to say about accessing all these devices through a single serial port too but that will have to wait for one or two more tests…

Update: Of course this can be done with a PICAXE 08(M)  with the 4 outputs and 1 serial input to spare. The pinouts would have to change as would the respective program. If there’s enough demand for me to document this I will. Let me know in the comments. Consider using this little board from Technobots.

Update 2: I’ve reduced the code length by using a lookup table instead of the select/case structure. I’ve also use hex to reduce the size of that line (but included the binary values in a comment below for those that are interested).