1

I need to detect in which direction the item is moving. I want to know if the item is moving up or down.

Is this possible with this platform and by using a specific shield?

I had in my mind the ultrasonic sensor, with which I would measure how far the item is from a certain point, and with this suggest what type of movement is happening because of the distance changes. I think this might be tricky, and wanted to see if there are better alternatives.

UPDATE: I updated the question, corrected directions - it's not forward/backward but up/down.

Adrian
  • 1,499
  • 3
  • 19
  • 26
  • 1
    My first thought would be to use an accelerometer. However the sticking point with this approach is that you'd only get acceleration data from it - you'd have to then integrate this to determine the direction of movement. (calculate the area under a curve - one with time on the X axis and acceleration on the Y axis. You'd need 3 of these curves) It would however work in deep-space or anywhere else there's no immediately available point of reference to bounce a sound/light/radio wave off. 3-axis accelerometers are dirt cheap - a couple of bucks on flea-bay. – enhzflep Mar 27 '16 at 10:12
  • 1
    The MPU6050 is a cheap and easy to implement accelerometer. There are many tutorials and exampes like https://www.youtube.com/watch?v=89-UkKhdIOE in the internet. Also you can find a great libary to use the chip – Fruchtzwerg Mar 27 '16 at 10:21
  • Thank you guys for you answers, they were certainly helpful :) – Adrian Mar 28 '16 at 07:48
  • 1
    @Adrian please be more specific; the accelerometer solutions, in my mind, should be your last hope, since they are very difficult to implement properly (as enhzflep pointed out, you have to integrate that data, which gives you a lot of errors). That's the most general solution, though. If you can be more specific, maybe better (more precise, cheaper, easier to implement) solutions can emerge. For instance the ultrasonic measurement is really cheap and easy, but is suitable only for big objects at 30cm-5m. If you have a rotating actuator (motor + endless screw) a rotative encoder is best.... – frarugi87 Mar 29 '16 at 08:27
  • 1
    I would use GPS for this. Simple and non expensive. Though you cannot tell "backwards or forwards" as you don't know what is backwards and forwards. – Casey ScriptFu Pharr Mar 30 '16 at 20:05
  • Wow I'm really surprised about the amount of replies guys, thanks :) At this point, I realized that it's pretty much important in which direction the item will be moving. Actually, it won't be moving forwards and backwards, but up and down. And it's gonna be like 1m or 1.5m, so I guess this is good when talking about ultrasonic sensor as a solution for this? So if I were to use ultrasonic sensor, I would just need to assure that the sensor is always pointing to the same point (eg. that it's facing down) ? – Adrian Mar 31 '16 at 12:28
  • Oh and @Casey, if the item was going up/down, I guess GPS wouldn't be the solution for this problem right ? Sorry for not being specific about the direction of movement :/ – Adrian Mar 31 '16 at 12:29

1 Answers1

1

In general, to know direction of movement you need use gyro measurements results, usually represented as quaternions. To obtain distance you need integrate acceletation data. But notice that this method is not very tolerate. You may use 6 axis mems sensors, which measure acceleration and rotation speed. There are arduino shields based on Invensense's ICs mpu6050 and mpu9250. Try libraries such as i2cdevlib. Also maybe useful to implement native Invensense's firmware, it is ported to ARM and microchip platforms, and should be easy to move the codes to arduino platform. Another useful link is freeImu.

  • Thank you too for you answer, it was also very helpful! BTW when you said 'tolerate', you meant to say 'precise' right ? – Adrian Mar 28 '16 at 07:50
  • 1
    yes, sure, the best tolerance i received in gyro angle measurement was about 3-4%. Also it is time dependent. After about 5 minutes of measuring i have to do sensors calibration along with g vector. – Vladimir Tsykunov Mar 28 '16 at 08:37
  • Thank you for your comment, I guess these sensor are still not to precise these days ? Or am I wrong ? Sorry, I'm just diving into this world :) – Adrian Mar 31 '16 at 12:31
  • 1
    The sensors not bad, the issue here is that when calculating position we need integrate sensor's data. And even small sensor's untolerance is also summarizing. you may also look at [micorchip+bosh sensors](http://www.microchip.com/design-centers/embedded-controllers-and-super-i-o/products/home) they maybe also not bad. Have on board lots of calculations reducing your code. – Vladimir Tsykunov Mar 31 '16 at 13:30
  • Hey @VladimirTsykunov, I think I'm gonna try the micro chip you suggested to me (SSC7102/ SSC7150). Can you please tell me, if you have a clue at the moment, and if it doesn't take a lot of your time, can this be connected with Arduino Yun Mini ? I know I'm asking a broad question, I will do my reseach, but just wanted to hear some thoughts from an experience person like yourself :) Thank you! – Adrian Apr 12 '16 at 11:55
  • Yes, it can be connected to Yun Mini over I2C. To receive raw data you will need at least write codes for i2c communications. Arduino has lots of examples of I2C, so it shouldn't be difficult. – Vladimir Tsykunov Apr 12 '16 at 12:11
  • You gave me a lot of useful information, now it's on me :) thanks a lot man! :) – Adrian Apr 12 '16 at 15:11