How to use variable as Object Key?

How can I use a proximity sensor with an Arduino to plot the change in the depth of an object in front of the sensor, over a period of time?

  • I have an object, let's say a block of wood. The block is kept in front of the sensor, and is moved to and fro along that direction itself. I wish to plot the distance it's moving w.r.t the time. How can I go about this? Would there be any better options to do this? Would the speed with which, or rather the frequency of the motion cause any issues in respect to the sensor sensitivity and/or the arduino?

  • Answer:

    To plot the values coming in from the serial line you can use the software "Processing". Its an open source software which you can download freely(The arduino IDE is based on this program). In the examples of arduino select communication>>graph. This has the sample processing code. Modify it for the your sensor input, upload it on the arduino and then then run the Processing code in Processing IDE and you will have a graph of the values plotted vs real time. The speed of your object may matter if you are using an ultrasonic sensor (PING))) ) and you have some delays in between the readings but that would be at very high speeds. If you don't understand the code for it feel free to contact me. Hope this helps!

Zubin Priyansh at Quora Visit the source

Was this solution helpful to you?

Other answers

What you want is to get a graph of velocity of the wooden block. I would suggest you to go with Ultrasonic Sensor because proximity sensor can only detect the presence whereas ultrasonic sensor gives you the distance The algorithm should be something like this. 0. Initialize two variables one for previous value of distance and another for present value of the distance. 1. Move the value of present into previous and then, 2. Use an ultrasonic sensor to continuously get the distance  at a time interval       (time) and store it in present value. 3. Now the [present-previous][/time]=velocity; 4. Send this data serially to the computer 5. Write a program using Python,VB or Processing or PHP(only if your OS is         Linux) to read the value from the COM port. 6. Use GUI methods in these languages to plot a graph.

Sairam Reddy Bhavanam

Hi, you can use a Ultra Sonic Sensor and an Arduino to measure the distance with respect time. Now to plot this Arduino alone is not sufficient you can use a software called Procesing. Using this you can read the values through UART and plot them on your computer or Transmit them via Bluetooth and view them on your android app (Yes processing can create android apps also)The speed of the object will not effect the US sensor. If you wanna know more on my ides, you can watch my project herehttp://www.instructables.com/id/SONAR-System-Using-Arduino-and-Android/http://www.instructables.com/id/Speedometer-Using-Arduino-and-Processing/Feel free to ask me if you have any clarificationsHappy learning !!

Aswinth Raj

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.