I have a little pi based rover and I’m looking to add a “distance moved” sensor. I’m thinking I could do this with some kind of Accelerometer but I don’t know much about them. My rover already has a distance to object measurement built in. I’d like to include a “north south” and “east west” measurement relative to a starting point.
Also a third axis to measure rotation around the same plane. If I start off pointing north for example I should be able to keep track of my current location and orientation.
The angle or slope isn’t really important but it might be fun to play with later on and adding extra features.
I have done a bit of searching but most things I find measure distance to object. Any suggestions on what hardware could be used to do this?
Once I know what hardware to use I may have more luck finding an example project to use as inspiration.
One of the Core guys (Michael I think) had this little add on board with I think a Magnetometer which he had displaying like a magnetic compass. This was a demo video a short time back. You should find it if you can filter out all the Core videos. It is a PicoDev product SKU:CE07937 and might do your job.
Thanks for the reply Bob. I’ll check it out.
From another response the distance thing is looking more complicated than I first thought. At a minimum “you are now facing west” would be an interesting start.
Investigated the Magnetometers on a Zumo Cart and a Micro:Bit to get simple North, South, East, West direction. It was not very successful. The Zumo was affected by the placement of the chip on the board, never got reliable readings. Even the batteries affected the reading.
The Micro:Bit was a little better but still was not very reliable.
I would have liked something like the compass app on my phone, suspect the phone app uses more than just a Magnetometer.
The Zumo had a front infrared sensor looking down, supposed to follow a line. It did detect the line but the type of ink and width of the line was an issue.
Used encoders built into the motors that drove another cart. Proved to be the most successful way to determine distance travelled. Although both motors did not turn at the same rate, so the cart drifted to one side. Fixed it by using the encoder values to determine how far a motor had turned.
My conclusion was, determining the movement of a robot cart is much more complex than I thought.
Interesting story. Thanks for all the detail.
I ordered some bits that won’t break the bank.
Will take 4+ weeks to arrive so I won’t have any results for a while. I did get a accelerometer that will be a challenge to interpret I reckon. I also bought a compass and noted in the description it said can also be used to detect local magnetic fields
I think when performing an impossible task it’s important to give it to someone who doesn’t know it’s impossible:)
I’ll try and post some results here.
My initial goal is to build a web interface to control the car then publish that page on the net and see what happens. That bit is nearly finished.
I wonder if people will try and break it or hack the OS.
I’ll contain it to my office initially as it has a camera on the front. Hopefully people will just enjoy snooping around. It it goes well I’ll build a simulated Mars environment and set little tasks.
The funny part is it could be total anarchy as there is no login or sharing. Anyone can do anything all at the same time which will be an experiment in itself.
Links to a cart I built with web interface, camera, etc.
Kept the grandsons amused for a few hours, taking pics, driving it around.
Happy for you to use whatever may be of use and happy to provide more details, if needed.
Very interesting project. My “cart” came as a kit from Freenove. Just add your own Pi and batteries. My pi has been lying around for nearly 10 years so it was a bit of a challenge getting it to work with all the latest stuff.
I don’t have kids so I’ll have to get the general population to play with it.
I’m not sure the wife will handle the cam driving around on its own.
I’m toying with the idea of building a Mars scene on a large sheet of plywood.
Recharging is going to be an issue. I’m wondering if I can come up with a docking station where the rover can park and contacts can hit a standard charger.
All things to figure out.
Thanks for your interest!
While @Liam is on the money with his suggestions for sensing the distance moved, if you exhaust other options, Pimoroni’s Optical flow sensor may be a non-invasive way to get that data. It only tracks movement in x and y (like a mouse), but if you mounted it off-axis on the robot, it could sense rotation and forward/backward movement.
That’s cool, I’d thought about hacking up a mouse (not a ) to achieve that. Good to know there’s a purpose built part for it. Actually that’d be handy for one of those wall based ploters too.