Currently viewing the tag: "robot"

One difficulty with micromouse is finding tyres, usually they are not quite what you wanted in terms of size or composition. A lot of people use tyres from the mini and micro RC car racing world, but these tyres tend to be fairly wide in proportion to their diameter. The smallest ones from the micro racing world have a 3.5 mm width with a 10 mm diameter , perfect if I were designing a new micromouse but not for my current setup which are 5 mm wide with 18 mm diameter hub, designed to carry mini-z size tyres.

Accurately cutting these is a task harder than it first looks, so in order to maximise the complication in carrying out this task, I built this:

Looking a bit closer…

What we have is a drill mounted in a drill clamp with a M13 bolt in the chuck. Somewhere on the internet I sourced a short 20 mm long steel tube with 13 mm inside diameter, so the tube goes on the bolt and we have a sort of lathe arrangement. Using a new scalpel blade cutting the tyres is easy, just need to get a bit more accurate before I dig in to the ‘final’ tyres.

Tagged with:
 

Wow – its only been a couple of days since I posted the schematic and already a question. Basically its asking what voltage regulators am I using.

My input power comes from a 7.4V pack of lipo batteries, usually about 300mAh capacity, I need 5V for my motor encoders, and 3.3V for the rest of the circuit.

The current load is fairly high, it bursts up towards 1A when the sensors are going (roughly 1/10 duty something is on). So fairly high current requirements.  I also need something with a reasonable dropout , as I can run the batteries down to 6V – so a 1V dropout for the 5V line.

Putting my ‘It would be nice to get something for free’ hat on I turned to samples! I use TI for most of my sampling needs, and the REG104 series looked pretty good. Cheap linear low drop out regulators that can take some throwing around and come in fairly accessible packages.

http://focus.ti.com/docs/prod/folders/print/reg104-a.html

They don’t get too hot when running, and only require a few external parts. So meet all my requirements, so much so I always have a pile of then on standby for random project usage.

Tagged with:
 

One of the biggest problems I have had when developing my micromouse robots is creating sensors which work over the range of distances required and to a reasonable resolution. I have seen a couple of mice using red lasers so thought I would have a go.

I got a pile of 20mm long, about 5mm diameter red lasers from a random seller on ebay and plugged it into a microcontroller development board with a few additions; a potentiometer to adjust intensity and a red colour sensor (TSL250R). The colour sensor is a pretty basic affair – very similar to the IR photodiodes, just sensitive to visible red light. You can get this device in 3 different sensitivities, I got all three but only tried the highest sensitivity one.

Laser Sensor Prototype

Now the main motivation to use a laser is that the beam does not expand much over distance, so instead of having some messy interplay between the cone a normal LED creates and the reflected intensity of light, there is just reflected intensity. The dot it creates does change size over distance, so its about 2mm diameter at 10mm from the lens and maybe 4mm at 100mm. But it works! I got a few volts difference on the receiver output over a 160mm range.

BUT there is a problem, not a huge one mind; Under normal circumstances when an LED sensor is looking perpendicuar at a wall the receiver is nearly always covered in the reflected light. Problem with the small focused dot is that is does not form a cone which covers the sensor. Due to the configuration shown in the photo above you can see the reflected dot on the receiver, this saturates the sensor and makes the readings nearly useless. This is overcome by mounting the receiver vertical to the laser, but a wobbly wall or ultra reflective walls could still potentially cause a lot of problems.

The other problem is the lasers’ size – they are huge and fairly heavy. I am sure there are smaller ones somewhere, I’ve just not found them anywhere. But watch this space!

Tagged with:
 

As its exam time I have been carefully avoiding revision with a mix of counterstrike and micromouse work. New PCBs are 95% ready to be ordered and so my focus has turned to the controllers.

After implementing a fixed point maths system for the controller (10.5bits signed for those who care) and ziegler-nichols tuning the PI controller I had a one wheel mouse – putting a bit more effort in I got it to two wheels – yay.

Tuning it was a bit of a chore – so automation is king and I was able to produce this graph (yes, no axis labels, minus 2 marks for me, x is the time, y (going back into the scene) is as the gain increases and z (going up) is the velocity for said gain:

Unfiltered Results

The idea is to find the point where oscillations occur, the above plot was far too noisy so a 16 point moving average was applied:

Readable results

I got a value of about 1.2, but it is questionable, will compare against some simulated controllers to see if it seems a likely value – it does however work well enough to control the motors!

Now the results:

Data output

It is nice having onboard bluetooth for this sort of debugging, anyhow, things look nice – the integral term does push things out of whack when going from zero or getting down to zero – but possibly an artefact of the controller being ill tuned – there is still a large overshoot to a step input which is not what you would expect from a z-n tuned controller…

Video, go to http://www.youtube.com/watch?v=AYmkJvthVJw and click on view in HD at the bottom! or watch it in small size bellow:

Next time it will be slower and have a straight line controller built in, after that its onto cornering!

Tagged with:
 

Buttons are cool, so are menu’s. So with the help of a button, a few leds and a dspic I have a menu system (also note that this is blocking, the idea is that its used to start / stop the robot, so the robot does not move while the menu is active), first lets look at the switch circuit and then at the dspic set up (c30 compiler, using a dspic33fj128gp804):

Schematic for a switch for a dspic

Schematic for a switch for a dspic

/* Setup the IO Pin Assignment */
__builtin_write_OSCCONL(OSCCON & ~(1<<6));

	RPINR7bits.IC1R = 5;	// Switch Input Capture

__builtin_write_OSCCONL(OSCCON | (1<<6));

/* Switch Input Capture Setup */
IC1CONbits.ICM = 0x02;	// Capture on falling edge
_IC1IF = 0;
_IC1IE = 1;

/* CPU Time Clock */
T1CONbits.TCKPS = 0x02;	// 40.5504Mhz / 64
TMR1 = 0x00;
PR1 = 634*4;			// Int at 1.000631313ms*4
_T1IF = 0;
_T1IE = 1;
T1CONbits.TON = 1;

The code is fairly simple: first attach the switch input to the input capture (ic1) peripheral, set up ic1 to trigger an interrupt on the falling edge and then there is the set up for my main timer loop, this occurs at ~250Hz, and yes I am using a weird value crystal.

Next lets look at the global variables (well global to the scope of the interrupts)


// Switch input vars
int sw_counter = 0;
int sw_on = 0;

// Menu vars
int menu_counter = 0;
int menu_on = 0;
int menu_value = 0;

Next the interrupt for the input capture routine

void __attribute__((__interrupt__)) _NOPSV _IC1Interrupt(void)
{
	_IC1IF = 0; 		// Clear the interrupt
	_IC1IE = 0;			// Disable the interrupt
	_RED = 1;   		// Show the user the button pressed
	sw_on = 1; 		// Enable the debounce counter

	// If the menu is on already, increment the menu value
	// Otherwise turn the menu on and set the menu value to 
	//default
	if (menu_on)
	{
		menu_val ++;
		menu_counter = 0;
	}
	else
	{
		menu_on = 1;
		menu_val = 0;
	}
}

And then the interrupt for the timer:

void __attribute__((__interrupt__)) _NOPSV _T1Interrupt(void)
{
	// Handle switch
	if (sw_on)				// If a switch 'event' is ongoing
	{
		sw_counter ++;
		if (sw_counter > 50)  	// 50x 1/250 = 200ms debounce
		{
			sw_on = 0;		// Switch no longer on
			sw_counter = 0;	// Counter to zero
			_IC1IF = 0;		// Clear the bounces
			_IC1IE = 1;		// Enable more switches
			_RED = 0;		// Led off
		}
	}

	// Menu
	if (menu_on)			// If menu is on
	{
		menu_counter ++;	// Increment counter

		// Leave menu active for 1s after last click
		if (menu_counter > 250)
		{
			menu_on = 0;	// Menu off
			menu_counter = 0; // Reset

			// Menu complete - do stuff
			switch (menu_val)
			{
				case 0:
					_RED = 0;
					Nop();	// Required if RED and GREEN
							// On same port
					_GREEN = 1;
					break;
				case 1:
					_RED = 1;
					Nop();	// Required if RED and GREEN
							// On same port
					_GREEN = 0;
					break;
				default:
					break;
			}
		}
	}
}

And thats it, google _NOPSV to find the macro for that (sometimes required to compile using c30). Also _RED and _GREEN are port bits, so something like #define _RED _RB1 to make _RED = 1 turn Port B pin 1 on. All quite useful, maybe...

Tagged with:
 

Today was a very unproductive one. Slept in, managed to do nothing till 2, then spend hours trying to work out why something had broken on my mouse – it was me, it was running 4 times slower because I put the line of code to tell it to run 4 times faster in the wrong place, that followed by a c# bottleneck – c#.net cannot handle 1mbit rs232 too well, its running fine at about 20% capacity, but between there and 50% capacity something goes very wrong. That lead to hours of no progress. And finally I though I may have broken one of my motors, the expensive ones, but it was fine, a bad connector, or maybe a break in the cable (think it was the former as after a lot of wiggling I cant detect a break). It must work – look at the graph bellow :D result.

A very messy desk

A very messy desk

Graph if step input to motor

Graph if step input to motor

The ‘rough’ steady state speed of this input is about 2m/s, mwhahaha, lets hope there is some torque at 0.3m/s otherwise testing will be interesting….

Tagged with:
 

Heh, aside from lots of lectures and not so much coursework nothing to exciting has happened since the last blog entry. Apart from maybe this:

Micromouse

Micromouse

Do now need a name for it tho – Any ideas the random few who might happen across this page?

Tagged with:
 

A bit (lot) late, but I just noticed a video posted on youtube with a 1/2 size micromouse – Its tiny!

Anyhow, I have been working on my mouse as it is also my 4th (and final) year project for my MEng Cybernetics degree. Been working on the motor housing and choosing the components for the hardware, to make sure it all fits I built everything up in Solidworks and got some prototypes made!

Head over to www.shapeways.com to see about their rapid prototyping server – its really fast, easy to use and mighty cheap.

Here are a couple of photos of the prototypes, first one is a ‘simplified’ complete model and the second is the actual motor mount.

Rapid Prototype of Micromouse

Motor Mount Version 1

Unfortunately I had to change motor, so I have redesigned everything… But there was a special offer on at shapeways, so I was able to order more prototypes. This time I have also ordered parts which will be used on the final mouse including skids and sensor mounts.

I have started to develop the quadrature decoders for my mouse, a simple circuit and is mainly programming so its something I can do to break up exam revision.

Here is a picture of the setup:

The main board is an Explorer 16 with a 32 bit PIC microcontroller in there. I have the prototype board connected to the expansion socket and I am then connecting this to the breadboard. On here is a 16F88 and some i2c eeprom. In the back you can see the icd2 programmer.

I have written the software for the 16F88 to act as a i2c slave, and the pic32 talks to it fine and displays the response on the LCD (although took a while to get it all working). The code to decode the quadrature signals from the motors is in there but there is a small bug in the 16F88′s code which triggers a read at the wrong time. The idea is the main microcontroller sets a pin high to make a copy of the current reading and reset the counter, this helps with working out the age of the reading. If I work out what going wrong then it should not be too long before I can plug a motor in and see how it performs…

I also have my LiPo batteries, and gears and wheels for the drive. I am waiting on a pillar drill stand then I can finish making a prototype of the gearbox, and finally see if the motors I have are up to the job!

Tagged with:
 

Another year, another MINOS (UK Micromouse conference). This year I only went for the first day, the talks and testing, but was still a great experience. I got quite a few of my questions answered and am now ready to start working on my mouse proper.

The day started off well, no waiting at stations for trains and the weather was kind so I got to Egham about an hour before kick off. The first talk was on Inertial Navigation with Accelerometers from Dave Otten; is a very interesting concept as if the system works you can check to see if the wheels are slipping (something hard to detect, but can have bad consequences if it happens too often). We then had a great talk on using Machine Vision on a micromouse from Richard Nock , a bit over my head but it was early in the day and I had not looked into using sensor arrays for measuring the heights of walls.

Following was an informative talk on Pete Harrison’s mice, unfortunately as I was not around on the Sunday so did not see them run. David Hannaford gave a presentation on intelligent mice, reminds me of some lectures we have had on AI over the past 3 years at Reading.

Michael Beatus gave a presentation on his mouse to date, again not sure how well it actually did as I was not around to see it. Rob Probin then gave an excellent talk on using a camera to find the maze walls, I did something similar for a different application about a year ago and dismissed it as being too much processing for a mouse to do, but Rob seems to be making some progress, will wait an see!

Finally Tony Wilcox gave a presentation on using VHDL to build ‘circuitry’ such as quadrature decoders for mice. Interesting avenue to go down, but I think I am biting off too much with a 32 bit PIC in my design!

I also gave a small presentation on the MOD Grand Challenge, which was followed by a video from Derek Hall of his trip to India (for a micromouse competition).

Was a lot of ‘fun’, and I look forward to going to next years conference with a mouse to present! Anyhow I have already started buying new components, some Lithium Ion batteries are on their way…

Tagged with: