Gyro sensor

moxhamj

New Member
<A href='http://www.dimensionengineering.com/DE-ACCM2G.htm' Target=_Blank>External Web Link</a> is an accellerometer for a very good price, in the x and y direction. This isn't a gyro though . I have a vague recollection this has been recently discussed and maybe a forum search might shed some light. They certainly exist at mass production prices because the model helicopter industry uses them.
 

jmumby

Senior Member
I bought one off spark fun electronics. It has an analogue so you may or may not think that is picaxe compatible. Not cheap in the scheme of things but I think it was about US$80 for a dual axis one.
 

xstamp

Senior Member
www.sparkfun.com sell a range of gyros, some mounted on small breakout boards. The latest addition is the MLX90609-N2 single axis for about &#163;20. Its output to the PICAXE can be analog or SPI.

 

Lliam20789

New Member
Ok I've searched the site and found some good info discussed a while back. I'd like to narrow the discussion.

The objective is to have a robot that knows where it is, X,Y coordinates without any beacons or floor mounted items.

Any idea's welcome, keeping in mind a budget of around $80AUD.
 

Brietech

Senior Member
What is that in $USD? Also, is this indoors or outdoors? Dead-reckoning might be difficult, but maybe GPS could do it.
 

Lliam20789

New Member
About $65 US.
I also had the thought of GPS but the robot is designed for mapping small offices, and GPS, as far as I know , isn't precise enough.

Thanks.
 

Brietech

Senior Member
http://www.sparkfun.com/commerce/product_info.php?products_id=242#

This is a proximity sensor for about $13USD, that has a range from 10-80cm. I'm thinking if you were clever, maybe 2 of those perpendicular to each other and like a compass sensor might do it.
 

moxhamj

New Member
That original reply I put up would do x and y. It all depends on the accuracy of the sensor, sampling speed and associated components. Accuracy will diminish over time but can be reset in other ways eg proximity sensors. To convert acceleration to speed then distance you need some year 10-11 maths/physics. How is your calculus?

Edited by - Dr_Acula on 02/05/2007 06:51:37
 

Lliam20789

New Member
we'll since I had to look it up I'm guessing not great. I'm fine with all maths i've done in school, but have never done that topic... how exactly does a accelerometer work?

am I correct that is measures speed, which can then be converted to distance. then with the two distances x,y values can be determined based on the origin?
 

Brietech

Senior Member
It measures &quot;acceleration,&quot; i.e. the rate of change of speed. To go from acceleration to speed, you have to integrate the acceleration over time: Velocity=Acceleration*time. To go from speed to distance, you have to integrate again, giving you: X_distance=.5*Acceleration*time^2.

For instance, if you are accelerating at 1 meter-per-second-per-second, for a period of 2 seconds, at the end of that you are traveling 2 meters-per-second. You have also traveled X=.5*1*2^2 = 2 meters.
 
I bought a few Memsic devices MXD2004A/B in LCC-8 SMD packages that were &quot;fun&quot; to mount. They cost me less than NZ$10 each for a stick of 10. I stuck them onto solid 8 pin dil sockets which I then potted in araldite. This made a handy easy to use plug in proto breadboard module. You can get them ratiometric PWM or potentiometric and with varying ranges of OP. The ones I got in were dual X / Y axis pulse ratio OP and were very easy to hook up to PICAXE by just using a pulsin command on each of the X/Y outputs. A few other nice features were the on board temperature OP and a handy voltage reference. Not always available on some third party modules...

If you write some data logger serial script you can plot the live data onto the F9 data logger screen in the programmer it is quite amazing watching the screen plot the static g forces from both axis as you &quot;fly&quot; your proto board. It would be quite easy to make an autopilot.

The thing that is really nice is their ability to measure STATIC g force. They come in sensitivity town to 1mg so you can measure cornering and braking g forces in automotive applications etc.

One student made a 3D glove to manipulate TETRIS blocks.

Here are some Resource material links;
<A href='http://picaxe08.orcon.net.nz/Photos/Transducers/Accel_Memsic_Full.JPG' Target=_Blank>External Web Link</a>
<A href='http://picaxe08.orcon.net.nz/Photos/Transducers/Accel_Memsic_Full_sch.jpg' Target=_Blank>External Web Link</a>

===========================================
Specy's... I love the g shock rating! must be some wash machine...


FEATURES Dual axis accelerometer fabricated on a monolithic CMOS IC
On-chip mixed mode signal processing
Better than 3 milli-g resolution
50,000 g shock survival rating
30 Hz bandwidth
2.70V to 5.25V single supply operation
Small (5mm x 5mm x 2mm) surface mount package
Continuous self test
Independently programmable axis (factory special)
APPLICATIONS
Automotive &#8211; Vehicle Security/Active Suspension/ABS
HED Angle Control/Tilt Sensing
Security &#8211; Gas Line/Elevator/Fatigue Sensing
Office Equipment &#8211; Computer Peripherals/PDA&#8217;s/Mouse
Smart Pens/Cell Phones
Gaming &#8211; Joystick/RF Interface/Menu Selection/Tilt Sensing
White Goods &#8211; Spin/Vibration Control


 

Lliam20789

New Member
Thankyou Andrew,

Just to get things clear.
You got ten of these 2 axis accelerometers for less then NZ$10 each?

how much would it be for say, 3?
were did you get them from, i searched and found data sheets but suppliers seem scarce.

Are these simple accelerometers?
I guess what I'm asking is will the give me x,y coordinates easily, maybe with an 08-M as a decoder?

Cheers.
 

toxicmouse

Senior Member
presumably your robot has wheels? perhaps you could get the distance the robot moves from the number of rotations of the wheels. maybe use the ultrasonic sensors to ensure it does not bump into anything. there may be a way to check its position at some points, or datums to ensure long term accuracy.
 

BeanieBots

Moderator
With your tight budget and lack of experience I would avoid the use of gyros and/or accelerometers and stick with toxicmouse's suggestion.
The maths required will be MUCH simpler and although slippage can be a problem the accumulation of error will be far less than using derivatives of what you really want to measure.
STRONLY suggest the use of datums as reference.

This is not the sort of project you can just throw together after reading a couple of suggestions and expect it to work. It will require a lot of time, patience and retries along the way.
 

Lliam20789

New Member
You have a good point BeanieBots but I am very interested in learning about more accurate positioning systems.

Being in a school, I have an electronics teacher that will defiantly be able to help with amplification, although hopefully not necessary. And also a very good Maths teacher who is experimenting with the new LEGO Mindstorms products.

The only way to learn is to try.
So hopefully I can find either a 2 axis accelerometer for less then $60 or something with the same effect...
 

BeanieBots

Moderator
If you have the resources, then go for it.
You cannot beat first hand experience for knowledge. Far better than being told or reading about it. More will be learned from failed attempts and why they failed than will ever be learned from making a spoon fed solution do what it could never fail to do.
I'm sure you know &quot;s=ut+1/2.at^2&quot;

My strongest advice is get yourself (or better still, make) a good stable platform for your robot. Once you have a solid chassis that can be controlled, you can then fit sensors and &quot;find out for yourself&quot; all the issues. Without a good platform, you won't know if was the sensors or the robot that let you down.
 

Lliam20789

New Member
This product looks the best option and cheapest price:

http://www.dimensionengineering.com/DE-ACCM2G.htm

The DE-ACCM2G is an off the shelf 2 axis 2g accelerometer solution with analog outputs. It features integrated op amp buffers for direct connection to a microcontroller's analog inputs, or for driving heavier loads.

Has anyone tested these with PICAXE?

What sort of level will I need for my walking speed robot? eg: 2g, 5g...
 

Lliam20789

New Member
I agree, and thankyou for the helpfully info!

Unfortunately I am not formula with that formula... what does it mean/find?

Also the question now is what is the best 2 axis accelerometer to get that can be easily interfaced with a PICAXE chip?
 

BeanieBots

Moderator
Ok, you need to get that formula firmly rooted into your everyday thinking together with calculus before you can use accelerometers.
It the basis of Newton's Law of Motion and you will need it time and time again whenever you want to do any calculations involving motion.
Have a chat with your maths teacher and ask him about differentiation and integration and how to apply it to that equation. (your physics teacher would be a good bet too).

Assuming you could get a good reliable signal from your accelerometer, how would then work out where you were?
(clue, use the equation)

s=ut+1/2.at^2
s=distance
u=initial velocity
a=acceleration
t=time

first order derivative (your maths teacher will explainn those terms) will give you velocity.
v=u+at

So what sort of values? (more equations)
F=ma (another one to learn till it's second nature)
F=force, m=mass, a=acceleration.

Gravity (g) is about 9.81m/s/s
Hold up your robot to get a 'feel' for the force required to stop it from falling against the force of gravity.
This is the 'force' of gravity.

Now, let it drop and see how quickly it gains speed. This is a 1g acceleration.
Thus, if your robot were to pull away with that acceleration, your sensor would read 1g.
In other words, you will need a very sensitive sensor to measure the acceleration that will take it up to walking speed over more than a few seconds.
Anyway, as discussed earlier, don't take my word for it. TRY IT OUT FOR YOURSELF. The learning experience will etch it into your mind much deeper than just talking or reading about it.

Seriously, you are going to need and understand those equations if you ever want to do more than just copy an existing design.
 

moxhamj

New Member
Callibration is done by taking the sensor and measuring the outputs with the sensor perfectly level. Then tip it on its side and it will measure G 9.81m/s/s. That will be a reference. A robot might accelerate at 1/10 of this.

You need to sample the acceleration value frequently and at least many times a second. Also, the movement needs to be very smooth - any bumps or jerks are going to upset the readings unless you are sampling very fast and can take them into account.

Say the robot starts at rest and starts moving and you sample a reading 1/20 of a second later and read a value that you know is 1 m/s/s, ie about 1/10 of G.

As BeanieBots says, v=u+at, so velocity at this point will be 0+1x0.05=0.05 m/s. Distance = velocity x time, so the distance travelled = 0.05 x 0.05 = 0.0025 metres.

Now lets say we wind up the power to the motors. The 'a' value rises. We measure again 1/20 of a second later and get a reading of 2 m/s/s. v=u+at and u is the initial speed. v=0.05+2*0.05=0.15 m/s. The distance we travel in this time sample is 0.15*0.05=0.0075m. Add this to the distance from the first sample to find the distance from the starting point.

If we decide to coast at a constant speed v=u+at, a will be zero so v=u, ie the speed doesn't change. The distance values keep adding up at a constant rate.

If we slow down then a will be negative, ie v=u-at, and the speed will decrese. If we are slowing down because we are driving the motors backwards, eventually the speed will go under zero, and then the distance values are subtracted rather than added, ie we are now moving back towards the starting point.

You will have to do the calculations in both the x and y direction, and then use pythagoras to work out the direct distance. Also the calculations are not going to work if there are any slopes. There is a lot of floating point maths involved, and on a picaxe cunning tricks are needed like multiplying by 100, doing the maths and dividing by 100, and making sure there are no overflows.

It is also really easy to make silly mistakes with this sort of maths and end up with values 10x or 100x what they should be. Apologies in advance if I've made one of these errors.

The big unknown is how quickly will errors accumulate and it probably will only be a few seconds. But with other sensors it is possible to correct these errors - eg magnetometers, angular gyros, GPS and sonar. It is possible to do all this in real time and in 3 dimensions - check out <A href='http://autopilot.sourceforge.net/faq.html' Target=_Blank>External Web Link</a>. But probably years of work!

Edited by - Dr_Acula on 03/05/2007 01:29:08
 

moxhamj

New Member
I'd get the +/-2G one from dimension engineering for $22.95 and have a play with it. It looks easy to interface with a picaxe.
 
I found the devices by going direct to the Memsic site. I have been back recently to try to get a few more with greater sensitivity but no luck.

The same device mounted on a sub-8 pin DIL package is a LOT easier to use unless you have access to some good SMD kit.

For large scale direction and location I have decoded an old garmin gps. Serin with some ID character recognition worked well for this. But it is not a lot of use unless the device is moving.

 
This might be more helpful. These devices are more sensitive at +/- 1g with mg resolution. As you can see they are very easy to hook up...
<A href='http://picaxe08.orcon.net.nz/Photos/Transducers/Accel_Parallax.JPG' Target=_Blank>External Web Link</a>
<A href='http://picaxe08.orcon.net.nz/Photos/Transducers/Accel_Parallax_Sch.jpg' Target=_Blank>External Web Link</a>
Read each PWM gignal output using the pulsin command.
 

moxhamj

New Member
Re &quot;hmm looks easy&quot; - yes, interfacing will be. Regarding cost, it probably comes down to shipping costs. Re &quot;is it easy to find distance&quot;, the short answer is no. It is actually very hard, as shown by the maths above.

GPS doesn't work very well inside and not to centimetre resolution. You can triangulate off light beams and the like. But fundamentally, how do you know you are on one side of a room and not the other? We take this task for granted because our brains build complex internal models based on what we see, but close your eyes, imagine that the only sensors you have are an infrared sensor that detects objects at 10cm and a bump sensor. Now try walking around. This is the world a poor robot lives in.

But consider a fly moving around a room and dodging things. It does not know which room it is in nor its exact position in the world. What it does is reacts to objects around it, and a robot can emulate this by having sensors around it and reacting to objects but still not needing to know where it is.

There is a solution that involves building internal maps based on encounters with objects, but it would be beyond a picaxe.

Earlier in the post you said &quot;The objective is to have a robot that knows where it is, X,Y coordinates without any beacons or floor mounted items.&quot; That is a real challenge as I think it excludes GPS. If this were a project I had to solve, I would sense rotation in the robots wheels, keep the wheels fairly big, and limit all movement to two simple types - forward, and rotate on a point. I might add a digital compass to make sure the rotations are perfect.

I think the errors in this system would accumulate more slowly than errors based on accelerometers.

Is this a class assignment or something you are building as a hobby?
 
The accelerometer is not really for navigation. The GPS is an outside choice for a moving bot over 100's of meters.

Here is an idea using ultrasonics from a Hi Tech student project back in 2005.

Three beacons were made up; each with an 08M with a radio Rx and an ultrasound Tx unit driven from pin2 using pwmout. The beacon would &quot;ping&quot; a burst of ultrasound when called via an RF code.

Each beacon had a unique serin ID header so only responded when called by the bot.

The bot timed the &quot;speed of sound&quot; path and did some number crunching and triangulated it's position.

<A href='http://picaxe08.orcon.net.nz/Photos/Projects/Pic_1732.jpg' Target=_Blank>External Web Link</a>
 

Lliam20789

New Member
I do hope to have the robot building a map on a computer vie Xbee link, from which data will be sent back to the picaxe telling it if it needs to turn etc.

I guess the best way to look at the project is by imagining the Picaxe powered robot is a blindfolded person in a maze. They can only follow walls.
The computer is an external person that has a top view of the parts of the maze that have been explored.
The person in the maze tells the person outside how far they walk, in which direction and if there are any intersections, walls, dead ends, etc.
From this the person with the top view is able to draw a map and tell the person inside the maze which parts of the maze need exploring and which way to go at intersections.

Dr_Acula:
I was under the impression that electronic compasses were very prone to false readings around metal objects.
This was actually my first thought too.

Basically in electronic we study Robotics or Computer servicing from year 9. The class is an elective. In year 9 I was able to complete the course guide for both years 9-10. Mastering almost every command except for those that involved external memory.
In year 11 I mastered IR and Radio communication and also designed and built a robotic arm with 5 servo motors and a Picaxe 28X which me and another guy managed to program to type the entire alphabet on a computer keyboard.
By the end of that year I had completed all year 11-12 work and were acutely well ahead of the students doing unit 4 robotics at BRIT. This year, year 12, my partner in the arm project is doing an electrician pre-aprentichip course and I am basically just doing what I want since I have already passed the practical side. I gave myself the task of building the robot and my teacher gave me a $500 dollar budget. I hope to have enough left to experiment with basic machine vision later on this year.

Thats the story behind the project...

Do you know of a good compass?
Thanks.
 

BeanieBots

Moderator
I don't want to put you off playing with the sensors that have been described because it will be a good excercise finding out why in practice they won't solve your problem despite the theory suggesting that they will.
It's probably time to have a look at how the 'professionals' do maze solving. There are many sites and groups out there and a google will reveal a lot.
The international winners have all used wheel encoders. Many have a seperate 'idle' wheels for the encoders to avoid slippage problems.
Using the PICAXE to control and feedback information is a great idea and probably the only way a PICAXE would be up to the job. However, if you ever want to compete, most events prohibit the use of &quot;external influence&quot;, ie, no processing external to the robot and no radio links.

By all means play with a compass module, but I'd hate for you spend the money and then find it was of no use for your specific application. You have described that you are only really exploring rather than specifically trying to build a maze solver so maybe you should get some accelerometers and a compass module to discover for yourslef just how good/bad they really are. Take on board everything that has been discussed so that your expectations are realistic.
 
Top