New Stuff for July

clock July 16, 2010 08:39 by author kimm |

Motor Drivers now come in “Extra Biggie Size”

 

Introducing the Sabertooth 2x25 .  Driving two DC motors with 25A continuous rating the Sabertooth 2x25 is the driver for big robots having proven itself up to the task in many battle bots. Sabertooth 2x25 Dual Motor Driver

Like its little siblings the 2x10 and 2x5, it features thermal protection and soft current limiting making it very hard to kill. This versatile driver communicates via serial, packetized serial, radio control PWM signals and analog voltage

Inventor’s Kit

We now stock the Arduino Inventor’s Kit from SparkFun. This includes a whole bunch of bits and pieces plus a 36 page book to enable you to build some cool projects. An excellent place to start if you want to learn about microcontrollers and electronics.



Obstacle avoidance with a PICAXE 08M - Part 1

clock June 27, 2010 12:18 by author kimm |

[Edit: Part 2 is here with the circuit and components used]

PICAXE 08M chips are small & cheap but they don’t have a lot of program space,  only 256 bytes. That means about 220 lines of code at the very most. But that’s the fun bit, squeezing more into less.

Not included in that tiny 256 bytes is the Picaxe firmware already on the chip which includes all kinds of commands for controlling servos, serial, I2C & infrared communication, playing sounds and more so really it is the little chip that can. Still, 256 bytes isn’t much.

 

Picaxe 08M RobotThis little robot avoids stuff using a Picaxe 08M & Sharp Infrared sensor. On the top there is one Picaxe 08M (centre front) and behind that a SN754410 motor driver flanked on either side by a few components such as capacitors, transistors and LED’s for the required blinky light fun. A Picaxe programmer is  built in using the stereo socket and a switch for on/off control.

 

Poking out the front is a Sharp  4-30cm infrared sensor  and mounted underneath are two Solarbotics GM10 geared pager motors. Four AAA batteries are jammed in there with two on top and two underneath.

The whole lot is soldered and hot glued to the veroboard base. Here’s the underside with my dodgy soldering. I expect it will catch fire eventually ;)

Picaxe08M Robot underside

Operation is pretty simple. Pin 1 on the Picaxe 08M reads the analog voltage of from the Sharp GP2D120 infrared sensor and the code then decides to drive forward or avert danger as required – beware of socks and shoes. Picaxe output pins 4 and 0 control the direction of the motors with 2 PNP transistors acting as invertors so that the 2 pins provide logic to 4 pins on the SN754410 motor driver chip. Pin 2 provides the same PWM (Pulse Width Modulation) signal to both sides of the motor driver so the power to each wheel is the same.

The code is a simple state machine, implemented as a switch statement:

'Differential drive robot
' by Kim McCoy
'
' Drives around not running in to too many things.
'
'Configuration:
'
' Brains
'	PICAXE 08M
'
' Drive
'	SN754410 Dual H-Bridge Motor Driver Chip (Texas Instruments)
'	  similar to L293D
'	2 x Solarbotics GM10 motors and wheels
'
' Sensors
'	1 x Sharp GP2D120XJ00F (4-30cm) infrared ranger

'Variable symbols
symbol state = b4
symbol irFront = b2
symbol lastIrFront = b3
symbol stallCount = w0

'Robot states
symbol STATE_IDLE = 0
symbol STATE_FORWARD = 1
symbol STATE_SPINLEFT = 2
symbol STATE_SPINRIGHT = 3
symbol STATE_REVERSE = 4

'Setup & initialization

'motor A,B direction control pins
output 4, 0 
high 4
low 0

' set pwm duty to stop
pwmout 2,49,0 

let state = STATE_IDLE
pause 3000 'wait to get clear before letting loose

main:
	'Get front IR sensor value
	readadc 1, irFront
	
	'Detect if the robot is stuck on a sock or something
	'and take evasive action to wriggle free	
	'Time to detect a stall is emperical only, picked
	'a number that doesn't cause false positives too often.
	let stallCount  = stallCount + 1
	if stallCount > 1000 then
		gosub goBack
		pause 2000
		gosub spinLeft
		pause 1000
		gosub spinRight
		pause 1000
		let stallCount = 0
	end if
	
	if irFront >= 140 then
		'Reverse out if too close to something
		gosub goBack
	else
		select case state
			case STATE_IDLE
				'go forward
				gosub goForward
				
			case STATE_FORWARD
				if irFront > 50 and irFront < 140  then
					'Something is in front. Take evasive action
					'by spinning left
					let lastIrFront = irFront + 20
					gosub spinLeft
				end if
			
			case STATE_SPINLEFT
				if irFront > 50 and irFront < 140 then
					if lastIrFront < irFront then
						'Got closer to obstacle - try the other way instead.
						let lastIrFront = irFront + 20
						gosub spinRight
					end if			
				else
					'All clear
					gosub goForward
				end if
			
			case STATE_SPINRIGHT
				if irFront > 50 and irFront < 140 then
					if lastIrFront < irFront then
						'Got closer to obstacle - try the other way instead.	
						let lastIrFront = irFront + 20			
						gosub spinLeft
					end if			
				else
					'All clear
					gosub goForward
				end if
				
			case STATE_REVERSE
				'Back out until well clear
				if irFront < 100 then
					gosub goForward
				end if
		end select
	end if

	
goto main ' loop back to start

'Drive Forward
goForward:
	'Reset the stall count - has attempted to move forward again
	let stallCount = 0
	
	pwmout 2,49,300 ' set pwm duty
	high 4
	low 0	
	state = STATE_FORWARD
return

'Reverse out
goBack:
	low 4
	high 0
	pwmout 2,49,80 ' set pwm duty
	state = STATE_REVERSE
return

'Spin right
spinRight:	
	high 4
	high 0
	pwmout 2,49,50 ' set pwm duty
	state = STATE_SPINRIGHT
return

'Spin left
spinLeft:
	low 4
	low 0
	pwmout 2,49,50 ' set pwm duty
	state = STATE_SPINLEFT
return

 

A code walkthrough…

 

image

Looks like I’ve 16 bytes to spare. What a waste!

At the start of the main loop ‘:main’ we read the value from the Sharp GP2D120 analog sensor. This returns a value between 3.3V and 0V depending on how far the distance in front is. Picaxe readadc function converts the analog voltage to a value between 0-255 for a range of 0-5V. Since the Sharp sensor only goes to 3.3V the maximum value possible is about  168.

Ignoring the next bit about stalling, the code then enters a big switch statement that determines what to do next. If the distance in front drops below 140 the robot will spin left first. If it detects that spinning left gets it in more trouble it will spin right. So if the distance in front is decreasing while spinning then trouble looms – spin the other way. It continues to spin left or right until it finds a clear path forward.

Sometimes the robot gets too close, too fast!In this case it hits the breaks and goes into reverse ‘STATE_REVERSE’ at the bottom of the switch statement. It will then back out, go forward and probably start to turn left or right.

Back to stalling: After a while of driving around reality bytes. The robot gets stuck on a power cord, sock or jammed in a spot. Fortunately we’ve been incrementing a variable ‘stallCount’ for every loop. Eventually when this hits 1000 the robot starts the anti-stall measures, attempting to go back, left and right to wriggle free. Every time the robot goes forward the ‘stallCount’ is reset to 0 so as long as the robot moves around normally the anti-stall code is never called.

How is it built?

The circuit includes the use of a motor driver, PICAXE chip, inverter circuits and a built in PICAXE programmer. I’ll put the details up in a later post once I’ve drawn the schematic.



International shipping now available

clock June 20, 2010 16:30 by author kimm |

 

[Update 12-12-2014 – Now shipping to New Zealand again :) ]

[Update 25-03-2013 - We no longer are doing international shipping due to the time cost of customs and courier & air mail hassles. A big sorry to all the great customers we had in New Zealand - we miss you :( ]

International shipping is now finally available. After lots of requests I’ve waded through the quagmire of international shipping and gone a little crazy in the process.

 

There are currently two options:

  1. Air Mail – very cheap, reasonably quick (that’s the ‘Air’ bit) but not insured.
  2. Express Courier International – very quick, signed, tracked & fully insured. Costs a bit though :(


New Stuff For June

clock June 18, 2010 10:22 by author kimm |

We’ve got some new great new parts in this week.

Mini Maestros

Mini Maestro 18-channel USB servo controller (assembled version)First up are Pololu’s next venture into servo controllers. The 12 and 18 channel Mini Maestro Servo controllers let you control a *lot* of servos with high 0.25μs resolution and with speed and acceleration control.

The real neat thing about these servo controllers is they can be used as general purpose IO boards that can connect all kinds of sensors and other devices to a computer via USB or a microcontroller via TTL. Plus they support scripting, so the little boards can run autonomously!

We will get the 24 channel version in soon. Still called a Mini Maestro though, makes me wonder what a Major Maestro would be.

66 Channel GPS with Ceramic Antenna

Our first GPS sensor is the 66 channel LS20031 GPS receiver from Locosys. This has a built in ceramic antenna and tracks up to 66 satellites at a time.

LS20031 GPS receiver module top view with quarter for size reference

The big problems with GPS devices is they use a fair amount of power and take ages to acquire a good fix to enough satellites. The LS20031 has a battery on board that enables it to save its state between uses so that can hot start in less than 2 seconds.

Thermopile Temperature Sensor

MLX90614 temperature sensor with quarter for size referenceWith a range of –40 to 85° C this little sensor is an excellent non contact heat sensor. It can be used to detect movement of hot bodies like people, flames or for building a robot that follows you around.



Is Microsoft stepping up a gear with free stuff?

clock May 28, 2010 11:25 by author kimm |

For some time now Microsoft has been dabbling in Robotics with their Robotics Studio offering. It’s an interesting toolkit that includes a 3D simulation environment, a visual language designer and a runtime that works on a little Pocket PC or can be used in a giant system like MySpace for massive scaling.

Editor and several pre-programmed robot models

At an estimated 60,000 active users it looks like the uptake isn’t very high for a MS offering. It’s a big planet with a lot more people than that into robotics! On top of that they charge money for it – the nerve ;) To be fair though the team that put the system together is really tiny and they operate outside of the giant developer division with it’s marketing and support machine.

And now its free! They’re giving it away.

Perhaps surprisingly the biggest winners in the short term might not be in robotics. Other areas like Silverlight development on the upcoming Windows Phone 7 are where the CCR Toolkit (Concurrency and Coordination Runtime) at the heart of the robotics platform is ideally suited to solve the asynchronous programming quagmire that mobile development creates.

But I wonder how they will work with the open source community that is so important to robotics? In the past I’d think not at all, but things seem to be changing. Robotics studio uses SOAP standards for communication and the .Net micro framework is now open source. This follows on from the successful Asp.Net MVC web development framework opening the door with head honcho Scott Gu and his band of merry men pushing the cause. Maybe they are starting to get it.

MS are now making a serious move into robotics. Is this a good thing?