The latest gizmo that you can make using the cheap and easy Raspberry Pi is here courtesy of [Mark Williams]. He has hooked up an inertial measurement unit (IMU) to the Pi and built an inclinometer to use to measure the various angles of an off-road vehicle.
This particular guide goes through the setup of SDL to control the video output to a small screen. Then, a function is created to rotate the images based on input from the IMU so that the vehicle position can be shown graphically on the screen. Now, when your truck is about to roll over on a hill, you’ll get advance warning!
Of course, this whole project is predicated on installing the IMU and getting it up and running on the Raspberry Pi in the first place. [Mark] has you covered on a guide for setting that up as well. This delves into setting up the IMU over I2C to get it talking to the Raspberry Pi, and then converting the raw data from the IMU into data that is more usable. Be sure to check out [Mark]’s page for all of the code and details!
Is this able to compensate for the movement of the vehicle?
When your offroading in conditions where you need to consider inclination, your typically moving so slowly (1-3km/h) that you wont need to. This is for intermediate – high level stuff, not typically for a family on vacation.
Well, does it matter if the acceleration that tips your vehicle over stems from gravity or you taking that ‘right five’ with a few extra km/h :-) ?
Why using your own accelerometer? Most cars already have one. And it’s even automatically trimmed.
You just have to read the signal from the CAN bus.
I know you can get a Bluetooth ODB-II adaptor, and the software for a PC or smartphone to use the adaptor to read the CAN bus for speed, engine RPM, and other sensors. Is the accelerometer data as easy to find and read as the speed and RPM data?
For (older) vehicles which do not have a CAN bus, this project would work great.
Not unless the ECM is already letting them out. My Jeep did not have any of that data on the CANBUS and my BMW X3 does not either. I tried polling every single PID including undocumented ones and no information was close to accelerometer data on either of those vehicles.
If he’s anything like me, he just had an accelerometer and a Pi sitting around and tried to think of something to do with them…
Here here!!! Now, I need to figure out how to mount and power this to my hybrid mountain/road bike :)
In fairness Accelerometers are cheap as chips these days. Even if the car does have one it is going to save you $15-40? depending on the range of features you want with your accelerometer. Plus since it isn’t dependent on anything specific to the original hardware makeup of the car, the project is much better suited for other applications.
More to the point; Jeeps and trucks that people mod for extreme hill climbing and other off roasting duties are often too old to have had these installed in the factory. Many dontveven have ECUs.
Hah! Off roasting. Auto correct you cheeky devil.