Hi, I want to build a tilt sensor which can measure the angle of an object relative to a plane underneath it.
First I was thinking of using an accelerometer, but the problem is that the plane is not necessarily horizontal and can move, so I don’t think that would work. So now my idea is to measure the distance between three points (arranged in a triangle) and the plane, and calculate the angle from this information. Then my first idea was to use optical range finders, but I don’t think I can get them accurate enough (the object will be only ~0.5 to 1.5 cm above the plane and the triangle of points will probably fit in a circle of about 6cm diameter), and they’d probably also be fairly expensive and big.
So my current idea is to use some kind of “analog buttons” to determine the distance. Basically, they would touch the plane, and depending on how far the buttons are pushed in, I could determine the distance. Essentially I’m thinking of some kind of potentiometers which you don’t turn to manipulate, but push. I’m completely new to this, so I have no idea if such a thing exists (although it seems useful and simple enough that it should).
Any advice on where to find such sensors? Or other ways in which I could realise the same task?
A 3-axis accelerometer is the easiest way to do this as long as the sensor is not moving/accelerating.
The Earth’s gravity is the reference for the accelerometer and then some trig will give the 3D tilt angle from the accelerometer’s 3 axis values. Look into code for a tilt compensated Compass for how to use an accelerometer to find the tilt angles.
If you really wish to go with the analog ‘button’ approach look into linear displacement sensors. With three distances the trig will be harder than with the accelerometer and the cost should be about 1000 times higher and the size about 100 time bigger than using an accelerometer.
mff209:
Hi, I want to build a tilt sensor which can measure the angle of an object relative to a plane underneath it.
First I was thinking of using an accelerometer, but the problem is that the plane is not necessarily horizontal and can move, so I don’t think that would work.
IOW you can't do 2 quick measurements, one of the plane and one of the object, and get the difference ? Why not use 2 accelerometers, one on the plane and one on the object ?
What level of accuracy are you looking for ?
FWIW there are linear motion pots, though a bit different from the plungers I think you’re thinking of.
Waltr, the problem with the accelerometer is that I don’t want to measure the tilt relative to the earth’s surface, but to another plane which is in general not horizontal. But Mee_n_Mac’s idea of using two accelerometers could work for my purpose, thanks a lot for that idea! Two 2-axis accelerometers should do the job if I’m only interested in the relative angle between the normals to the planes defined by there 2 axes, right? Accuracy-wise I think ±1 degree would be okay.
I guess the linear motion pots could also work if I combine them with springs. This one could be what I was initially looking for: http://www.potentiometers.com/pdf/BITC_404.pdf But it’s still quite big and I’m not sure how accurate I could get it. I think the two accelerometer idea is probably best.
Yes, two accelerometers would work and probably be more accurate than a mechanical solution as well as much easier to implement. Better than ±1 degree should be achievable.
I just did a quick search and it seems like analog accelerometers are considerably more expensive and harder to find than digital ones. Is that generally the case or was I just looking in the wrong places? It just seems like it would be easier to do with analog ones, but again, I don’t really have much experience so please convince me otherwise.
Yes, digital accelerometers are now more common. They also have many features built in where the analog accelerometers require additional circuits. The two to compare are the ADXL335 and the ADXL345.
The ADXL335 needs external caps to set the bandwidth to filter the output and due to its high output impedance really needs three op-amp buffers. Then the output needs to be digitized (Ardiuno’s ADC inputs) and scaled. If you need to change a parameter then you use a soldering iron and change parts.
The ADXL345 has build in selectable ranges, bandwidths (filters) and calibration. It is easy to interface using SPI or I2C to any processor. If you need to change parameter then you just write a command out to the chip. Some of the newer accelerometers have even better features and are cheaper than the ADXL345.
The first accelerometer I played with was the ADXL335 but now only use the digital ones for the above reasons.