py-ads1256 icon indicating copy to clipboard operation
py-ads1256 copied to clipboard

Writing to a file

Open senovr opened this issue 7 years ago • 2 comments

Hi, First of all -thank you for your efforts. I am pretty novice in the python world, thus this generic question: can you please add in your tutorial section which actually reads data (lets's say at 100 SPS) from one pin for 5 minutes or continiously untill gets a break command from user, and stored them to .txt or whatsoever file, that can be accessed later? thanks!

senovr avatar Mar 21 '17 00:03 senovr

Hi,

Thanks senovr.... the lib worked for you ?

I've just included at the repository a code of a voltage datalogger:

https://github.com/fabiovix/py-ads1256/blob/master/datalogger_example.py

It keeps reading the absolute and voltage values from the ads1256 and keeps saving it to a CSV file until a break command from user. This type of file is very useful to import on Microsoft Excel or Libreoffice Calc.

Remember to adjust the 'gain' and 'sps' variables in the start of the code.

I hope it can help you. Best regards.


Fábio Oliveira

2017-03-20 21:15 GMT-03:00 senovr [email protected]:

Hi, First of all -thank you for your efforts. I am pretty novice in the python world, thus this generic question: can you please add in your tutorial section which actually reads data (lets's say at 100 SPS) from one pin for 5 minutes or continiously untill gets a break command from user, and stored them to .txt or whatsoever file, that can be accessed later? thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fabiovix/py-ads1256/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/ALnN9x6b4_KjfIna8ibV0frAquYdP18_ks5rnxaMgaJpZM4MjLZI .

fabiovix avatar Mar 23 '17 04:03 fabiovix

Fabio, Sorry to be silent for a while. Yes, solution is work. But I faced another unexpected issue: while trying to get the data at 500 Hz rate, I set sleep time to 0.01 inside the while loop. When I checked timestamps inside the csv file, I found that the step between ticks ( data points) is not constant. For 500 Hz, it is supposed to be 0.02 sec increment. In fact, it is fluctuating a bit around this number - one tick it may be 0.0263, another tick 0.0021004, third tick 0.002345

Do you have any thoughst why it may happen? May share example of csv file if you need this.

senovr avatar Apr 27 '17 04:04 senovr