datetime rpi analog notes


I want to sample in the raspberry pi, since I am reading the analog values, the detail is that I need a time function which allows me to have the time in a vector of what I am sampling.

there are a function to do this

closed as unclear what you’re asking by goldilocks Jul 4 at 14:18

Please clarify your specific problem or add additional details to highlight exactly what you need. As it’s currently written, it’s hard to tell exactly what you’re asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    I’m sorry, but as written it is impossible to tell what you are asking. It would help if you clarify whether you are already reading the data on the Pi, and if so, what the purpose of the “clock” would be. Do you mean you want the pi to read a sample at timed intervals? – goldilocks Jul 4 at 14:18
  • yes, i want to save the value that i read in a vector y and the time when i sampled this value in vector t. After that i want to plot this relation – Jesus Miguel Herrera Jul 4 at 14:23
  • 1
    Sounds like a general programming question that is dependent on what programming language you are using. In any case, such questions belong on our larger parent site, Stack Overflow. – goldilocks Jul 4 at 14:28
  • @Jesus Miguel Herrera, your question using maths terms “time function” and “vector” is a bit newbie scary. Let me try to translate your question in everyday newbie language as follows: “I wish to use Rpi to measure the output of say, a temperature sensor, measuring room temperature every hour of the day. I wish to store and print the measurements as below: “12:00 – 25C, 13:00 – 26C, …” I know the senor outputs analog values, and I know Rpi, not like Arduino, doesn’t have ADC pins. So I need an ADC to help Rpi. Everybody seems like MCP3008. Is it good for newbies? – tlfong01 Jul 5 at 3:21
  • @tlfong01 hi, i am using an arduino like serial port to read analog values, my problem is that i want to plot a relation time/volt, but i don’t know how create the time vector while i read the analog value – Jesus Miguel Herrera Jul 5 at 12:48
  • Ah I see. So if you are using a serial port, say Rpi UART to read the sensor output, what you get is already digital values converted from analog output of sensor. So if I guess correctly, what you want to know is how can Rpi read the real time clock. There are two ways: (1) you can get the realtime clock from the Internet, if you are online, (2) If you are not connected to Internet, you can use a hardware real time clock module, such as DS3231. Perhaps I can tell you more details tomorrow or day after tomorrow. – tlfong01 Jul 5 at 13:44
  • You might also like to read my answer to the following question and see if that is helpful to you. “What is the most apt way to setup a RTC?” ( raspberrypi.stackexchange.com/questions/99490/… ) If you can read the time, then you can build in python a list of pairs (tuples) , each of which consists of (a) network time and (b) the digital sensor value you read from the serial port. – tlfong01 Jul 5 at 13:49
  • @tlfong01 thank i will read, i would like work with realtime clock from internet, because in my country is hard find an hardware – Jesus Miguel Herrera Jul 5 at 14:32
  • @Jesus Miguel Herrera, it is good to start with the python “datetime” module. DS3231 RealTimeClock has a steep learning curve and I usually don’t recommend to newbies. You may also like to search this forum for “network time” for more info. I forgot where is my another answer with a demo program. Anyway, the following PenZu entry should also be helpful to you: ( penzu.com/p/8e883ae5 ) BTW, My PenZu stuff is saved under Chinese Windows 10. Do let me know if you cannot read it. Happy Python Programming! 🙂 – tlfong01 Jul 6 at 2:59  

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: