Let's Make Robots!

Got an accelerometer

Well got a Mesmic 2125 for Leo, actually at Radio Shack no less. I hooked it up to his MCU and was looking at the output stream. It's going to be interesting trying to integrate the accelerometer output into his code to make drive in a straight line. I'm going to have to make a sampling routine, because he'd act schizophrenic if he acted on each byte of data. Hitting a bump can change his pitch and roll drastically.  

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Maybe you could implement a running average of the accelerometer data.

Say, only pass the average of the last 10 values of accelerometer data to the MCU. That might damp the output a little.

I've been only reading the accelerometer every 100ms +/-5ms when the bot is moving.  When it stops, it takes a reading and uses that to get a new baseline. I need to find a source for bipolar Hall effect sensors, so I can encode the front idlers. 

I found a bipolar hall effect sensor, it's the 1302. Probably going to go with those. I can get quadrature encoding with 1 sensor and two magnets.  I'd put two magnets on each front idler, one reversed.  That way I have a Positive, Dead space, Negative, Dead space to sense. Would also give me rotation as well.  IF everything works as planned, which nothing does, especially with bots LOL


Not quite quadrature. Quadrature has 2 sensors, each 90 degrees off from each other, and only 2 possible detections. So while one is in the middle of detecting either an open of close, the other is just on the edge between the 2. If one detector goes from on to off before the other, the rotation is one direction, if the other is first, then counter that direction. Your current set up has no way of determining whether it is turning clockwise or counter clockwise since both look the same, even with 3 possible states.

Indeed, the [North]-[Neutral]-[South]-[Neutral] sequence appears the same to the sensors from both directions.
If viable you could use a [North]-[South]-[Neutral] arrangement. That would mean that a detected transition of [North] -> [South], [South] -> [Neutral] or [Neutral] -> [North] would indicate one direction, while the other 3 transitional states would indicate the opposite direction.
The main issue I can forsee with the above is that a [North] and [South] pole near each other would naturally create an effective [Neutral] zone inbetween them, leading to false hits... maybe you should skip the Hall effect sensors and stick to optical encoders?

If I was doing this project for profit, I'd say sure and go optical encoding. It's proven and lots has been written about it for years.  You don't see much about magnetic encoding.  Analog Hall effect sensors are found in a lot of cars, they measure the spin rate of the gear in the tachometer in the transmission of the car.

 With my bot being tracked, I really don't need to know if he's rolling backward. He can't, I can't even twist the wheels by hand. I was mainly musing aloud so to speak.

I'm not overly worried about the sensor data being exact.  With the accelerometer, the sharp modules, hall effect sensors and a sonic ranger, I am sure there will enough data to keep the bot from bumping into things and may get him where he is supposed to be going.

 This is for fun, remember! 

Well in that case a Hall effect sensor is fine, I guess the quadrature label threw me off.

In that case is there much point reversing one of the magnets? Seems like using a [North]-[Neutral] or [South]-[Neutral] repeating pattern would simplify things.

If you won't be going backward you don't need quadrature. Quadrature solves the problem of not knowing which direction the wheels are going. If you will only go forward and turn then you don't really need quadrature.