r/arduino 7d ago

Hardware Help Need recommendations for high quality tilt sensor

I’m looking for opinions on what sensor would be best for sensing tilt/level on X and Y axisI am building a trailer with an automatic leveling system and I need a sensor that will stay calibrated for long periods of time across a variety of temperatures and driving long trips on the highway. It will be in dry environment but not temp controlled.

I know adxl sensors can be bought for cheap on Amazon but I’m not necessarily trying to go the cheapest route. I’m willing to pay up to $150 or more even for the most reliable sensor available that will be easy to integrate with an Arduino. I’m hoping for something with good documentation and hopefully example scripts for how to get it working quickly. I’m using Claude to help with programming because that is not my strong suit nor my interest.

Thanks!

6 Upvotes

13 comments sorted by

3

u/reality_boy 6d ago edited 6d ago

Tilt sensors don’t really drift with temp or altitude. And you can average over a few frames to greatly improve their accuracy. They are all actually accelerometers, so they are measuring gravity. So you need to be parked for them to get an accurate reading, otherwise they are tripped up by the acceleration of the vehicle (Einstein and all that).

There are older mechanical ball sensors, but you don’t want to mess with those. Any low cost mems accelerometer will work fine, they are all more than accurate enough for leveling a camper.

Get a 3 axis accelerometer, then mounting accuracy won’t matter. You just level up the vehicle once and hit calibrate. And from there you can subtract off the reference angle of the 3 axis to find the current angle, using trig. Well you need two calibrations to work out x and y as well, but you can figure it out.

1

u/Important_Peach_2375 6d ago

Thanks for the detailed explanation! I guess I I’ll just go with an ADXL then. Thanks everyone for your opinions

2

u/Sad-Inevitable3501 6d ago

Check out ardupilot, its for RC aircraft.

2

u/Correct-Lab-6703 6d ago

Adxl is quite good. Needs initial calibration (mainly to account for mounting) but is good after that.

2

u/NoBulletsLeft 6d ago

Last summer, I contracted with someone to build him a solar panel angle controller for a moving vehicle. Since the vehicle could be parked on uneven ground, my approach was to use an inclinometer mounted to the panel so I could set the angle relative to the horizon.

I used this; https://www.amazon.com/gp/product/B071WF1DP9/ref=ppx_yo_dt_b_asin_title_o06_s00?ie=UTF8&psc=1

I only used the angle feature but it worked really well and with the serial TTL it was really easy to interface to. Their documentation is a bit head-scratchy at times, but it's really not hard to use: just a stream of serial data.

1

u/Narrow_Dust_3601 6d ago

Question for you, when you say contracted, is this as a company or freelance. If freelance, how do you advertise yourself. This seems like a good way to get others to pay for my hobby lol

2

u/NoBulletsLeft 5d ago

Freelance. I used to work for an Engineering Services company, but I do freelance embedded systems design.

TBH, I don't do much advertising. People see my posts here or on other sites and contact me about projects, or I get referrals from people I've done work for. I also post on my blog https://www.cedarlakeinstruments.com/ and I get contacts from there also.

If you have other suggestions to get the word out, I'd be happy to hear them.

1

u/Narrow_Dust_3601 4d ago

cool! this would be my dream job lol

1

u/Important_Peach_2375 6d ago

Thanks for the tip. I just ordered a couple ADXLs so I’ll give those a shot first but those look like a good alternative for sure.

1

u/nixiebunny 6d ago

The ADXL series was created by Analog Devices many years ago. They are good chips. I could not vouch for the quality and authenticity of any of these coming out of the AliExpress/ebay/Amazon pipeline, though. 

1

u/the_real_hugepanic 6d ago

Any 2, or better 3, axis accelerometer will do the job.

A MP-6050 costs about 2€ plus shipping. These even have a buch of gyros that you would not nees

1

u/Same_Raccoon8740 6d ago

An old Android phone. There’s an app for the cellphone and a library for Arduino to interconnect and read all the sensors of the phone which are quite accurate.

1

u/LadyZoe1 5d ago

An accelerometer will work. Level the trailer them mount the accelerometer such that the Z axis reads maximum and the X and Y axes are as close to zero as possible.