SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By dimor
#128290
well, i know there're plenty of threads about this subject, and i've read most of them, but mine is a bit different.

for several months i've been trying to build a device that can predict an elevator's floor level using an accelerometer (tried with an altimeter too). currently i'm using a development board from olimex (mod-mma7260) which features an at91sam7s64 microcontroller and freescale's mma7260 accelerometer.

when trying to calculate the distance the elevator is going i managed to get a decent distance value for 10 floors only (with a mistake of 50cm max). when trying it in a 50 floors tower, going on a 39-50 floors travel i got a 2.5m mistake.

so i tried a different method - i'm keeping profiles (samples) of each possible travel of the elevator, and when the elevator stops - i just find the profile that is the closest to the current one (square difference). it 100% works, at least in all of my tests. the thing with this method is that i cannot calculate the current floor while the elevator is moving. only when it stops.

the last thing i tried was to combine the both. while the elevator moves - i'm calculating the distance and finding the current floor using this value, and when the elevator stops, i calculate the floor using the second method, which i know that works better.

i need this project to work on a 50 floors tower. a travel from the lobby to the 50th floor takes about 40 seconds. what do you suggest? should i use a better sensor? i've been recommanded of the ADIS16209.

reading the specifications, how can i calculate what is the error i am supposed to get with the mma7260 and what will it be using the ADIS16209 sensor?

is it worth mentioning that my knowledge in electronics is tiny, almost zero. it's my first project involving electronics and sensors whatsoever, so please be gentle :)
By stevech
#128295
Is this for use by vision-impaired people?

The delta-v in tall buildings would get pretty ambiguous, esp. those that have some elevators as express that speed past the lower n floors and never stop on those. The Empire State's tourist elevators is an example!
By Mee_n_Mac
#128327
Is this for use in one particular elevator (that would allow a device to be calibrated to it) or is it for use on any elevator which might go at varying speeds to differing floors ? Is it fixed in the elevator or carried on (keying on the prior poster's question) ? When you tried it (and it failed) on "tall" tower, did you try to do some bias/offset calibration ahead of time ? I've not run the numbers but at first glance I wouldn't have thought the errors would accumulate that much (>1%) for a ~40 sec journey. How well did you 3'rd (combo) method work ? I suspect it worked well. So the only problem is long trips w/o stops along the way ?
By Mee_n_Mac
#128360
Let me post the obvious answer and then you can tell us why it doesn't work. :wink:

I infer from your mention of profiles that the device you're using can be "trained" on (at least) this particular elevator. If that's the only place it will be used, then why can't you just use the accelerometer to sense the start of a trip and just estimate distance from the time elapsed since trip start ? For "medium - long" trips I'd guess the elevator uses some max acceleration (perhaps 0.1 G) and deceleration and travels at a constant speed in between. With some data from such trips it shouldn't be too hard to tease out the accel/decel times (or equivalent floors of distance) and the speed (in floors/sec). Elapsed time then equates to change in floors. Using an acceleration based system will always require you to know the floor you start on.

The above won't work if you can get the data ahead of time or if the elevator accel/decel varies much with loading. Hence my earlier questions.
By jyoung
#128364
The problem I can see with trying to use an accelerometer with this is integration errors - your reading will become more and more inaccurate as the travel length gets longer.

Why not use a barometer instead? You can get some pretty accurate barometers, and if it's calibrated at ground level by hitting a button, it should work.
By Mee_n_Mac
#128372
jyoung wrote:The problem I can see with trying to use an accelerometer with this is integration errors - your reading will become more and more inaccurate as the travel length gets longer.

Why not use a barometer instead? You can get some pretty accurate barometers, and if it's calibrated at ground level by hitting a button, it should work.
I believe the OP said he tried a barometer and it didn't yeild the needed accuracy but you're correct the double integration, even if done properly, is going to be error prone, perhaps too much so. So let me do a back of the envelope sanity check on what's needed.

Let's call a story = 10 feet. To be able to say what floor your on is to have an error of less than 5' so that one can round (up or down) the estimate for distance traveled / 10' and be sure the result is the correct floor. Further let me (for the moment) apportion the error budget equally to 2 sources, bias/offset and scale factor error. Yes there are other sources of error but these are the big ones.

So what amount of bias is tolerable ? Well if it integrates to less than 2.5' then it's met it's error budget. How much false acceleration yeilds 2.5' ? If the longest trip time is 40 seconds then ...

2.5 = 0.5*bias*40^2 ; bias = 5/1600 ft/sec^2

... which gets me a max allowed (residual) bias of about 0.003 ft/sec^2 or about 100 uGs. The stated sensitivity of the mma7260 is ~800 mV/G (using the +/- 1.5 G range). If the 7260 output was scaled so the entire range (-1.5 to +1.5 G) was sampled by a 10 bit A/D, you'd (ideally) have ~3 mG/LSB. So right there you have a problem in that it's going to be a tad difficult to get a residual of < 100 uG with that LSB weighting. And then you have to maintain that residual with any temperature and voltage differences that may occur from the cal point and the end usage. Now you could be a little tricky knowing you really only need to measure a +/- 0.15 G range about 1 G since the elevator won't be allowed to accelerate or decelerate faster than that. So you could get a factor of 10 improvement in LSB weighting but that's still not enough to make life easy.

I'm thinking it's a no go right here.

As far as scale factor goes ... the error in the distance estimate will be proportional to the SF error. If you have to estimate 500' with only a 2.5' error then the SF needs to be known to better than 0.5%. That's perhaps do-able.

All in all I think the accelerometer is best used to start (and stop) the timing measurement and tell you which direction the car is going. After that it's all pre-calibrated times to distances.
#128399
stevech - it is meant to be used like a regular floors indicator, just like in most regular elevators.
Mee_n_Mac - well it should be on working on different types of elevators, those who change the speed when going to different floors too. the device is located on the top of the elevator (it could also be located inside the panel of the elevator, where the floor buttons are). about the third method - again, i works well on short journeys, but not for long ones (30+ seconds).

well first of all, i'm not obligated to use this specific accelerometer. i can use better, more accurate ones.
as i said, i was recommended to use analog devices ADIS16209.

http://www.analog.com/static/imported-f ... S16209.pdf

i can combine both methods with this accelerometer, it should be ok, shouldn't it? or do you have a better option?

thanks :)
By Mee_n_Mac
#128402
What did you do to remove any bias/offset present on the accelerometers output(s) ?

I think to have a shot at this you'll need a better accelerometer and an A/D with more than 10 bits. Do you agree with my back of the envelope calcs above ?

BTW were the errors of 50 cm (for 10 floors) and 2.5 m (for 50 floors) repeatable ? If so and if the device is to be fixed in the elevator then perhaps it can be "trained". If your 5 m error is repeatable and given the difference btw the 10 and 50 floor errors, I'll opine most of your error is uncompensated bias. It may be below the LSB level but the accumulated result is not. You could further subtract another bias term calculated from the 50 floor error. It would be the amount that integrates to your 5 m error in your ~ 40 secs. You can figure it out just as I did above. You might (??) also need to shift the binary point in your calculations to get the resolution needed (assuming you're doing fixed point arithmetic).

EDIT : I see from your other post that you subtract an average or 10,000 samples to remove the bias. Have you ever compared multiple such measurenments to see how stable it is ?
By stevech
#128416
dimor wrote:stevech - it is meant to be used like a regular floors indicator, just like in most regular elevators.
Due to the physics, I don't think this can be made to work, since elevators have variable stop schedules. Accelerometer integrating errors can't be fixed. Atmospheric pressure delta inter-floor is in the noise.

Maybe a Kallman filter with a fiber gyro plus a super duper accellerometer. But we're talking about 1/2 the distance between floors, to make the probability-based math decision on whether this floor is auto parts or women's undergarments.
By dimor
#128452
NitroxDM wrote:
dimor wrote:it is meant to be used like a regular floors indicator, just like in most regular elevators.
It this going to be a portable device? Or something installed in the car?
installed in the car.


well, i can put the altimeter in the panel too so my latest though was using the first (profiles) method combined with the altimeter for calculating the change in floors while the elevator moves. i can measure the delta (in meters) between the floors using the altimeter at first, then when the elevator moves - calculate the current floor using the altimeter only. then when it stops i can use the first method and know for sure what is the floor. it might work...
By NitroxDM
#128454
I don't know what is involved when it comes to elevator inspections and safety. But could you mount a hall effect sensor on the outside of the car and magnets in the shaft at every floor?

Or RFID tags?

I know... not as cool as the accelerometer + altimeter solution.

Is there anything in the existing system you can tie into. How does the existing system know when to stop the car?
User avatar
By itikhonov
#128456
dimor wrote:installed in the car.
May be it's worth adding rfid on each floor so when doors open you can be sure which one they open at.

You will still need to use your "guessing" method with accelerometer to display floors in-between because probably there is no reception in this metallic horror box. But you don't need much precision there as showing wrong floor sometimes for a second before doors open won't hurt anyone. Then rfid will correct it.

Anyway you need some anchors on the floors you can't go away with just integrating.