Chandru42
Posts: 18
Joined: Fri Apr 13, 2018 7:23 am

Time measurement in relation to sensor reading

Fri May 11, 2018 9:15 am

Good day!!!!

i am a beginner to python Programming and i have been learning for the past 1 month.
  • I am working in a Automation project where i am using a position sensor to measure the displacement of a moving plate which moves upwards for a certain distance and come back to original position. Along with position measurement, i also have to find the time taken for the plate to move up and come down, all these takes place within 200 milliseconds.
  • Also i have to display a graph between displacement( in mm) and time( ms). i know that matplotlib will do the job by providing these inputs in dictionary/ arrays,/list. But i couldn't find how to get time information for each of the sensor reading ( minimum of 1 reading for every 2 milliseconds)
I have seen time and datetime module but couldn't find the thing which i need...

Can somebody throw some inputs on how to proceed and which library to go for ?
Last edited by Chandru42 on Fri May 11, 2018 11:54 am, edited 1 time in total.

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Time measurement in relation to sensor reading

Fri May 11, 2018 10:03 am

Depending on repeatability and resolution any Python library might work with time.time().

For another way see http://abyz.me.uk/rpi/pigpio/examples.h ... monitor_py

Return to “Python”