CSV Upload from the last read data | Raspberry Pi | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
CSV Upload from the last read data
No permission to create posts
October 17, 2018
11:19 am
Avatar
Shahwani
New Member
Members
Forum Posts: 1
Member Since:
October 17, 2018
sp_UserOfflineSmall Offline

Hello there! I need a little help in terms of logic and programming.

I have a CSV file stored on my raspberry pi 2 B+ having an Ethernet connection to ThingSpeak channel. I have written a python code, running which I am able to upload the data (a record every 15 seconds). This record contains both string and integer values. THIS IS ALL WORKING FINE. Now let's say I have around 500 rows of data and I uploaded around 200 of them in the last sitting. How can I continue/resume from row # 201 just by running the same python code again (without making any amendments). Since I want to keep it real-time, I want to run the same python code every time and the data should be APPENDED to the ThingSpeak channel starting from the last UNREAD record.

Thanks in advance!

October 17, 2018
8:29 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 754
Member Since:
March 7, 2017
sp_UserOnlineSmall Online

All ThingSpeak data is time series data, so you should have no problem keeping your points in order.

What process did you use to upload the first 200 points?

If you used the MATLAB thingSpeakWrite command, you would have provided timestamps. If you want the new data to be in chronological order, just provide timestamps that are in the desired order.
If you did not provide timestamps, ThingSpeak will order the points in the order that you send them.

If you used the REST API, for example, and updated one point at a time, they would have a timestamp that corresponds exactly with the time you sent them.

March 25, 2019
9:08 pm
Avatar
Bert
New Member
Members
Forum Posts: 1
Member Since:
March 25, 2019
sp_UserOfflineSmall Offline

Hi
Im new to ThingSpeak and raspberry pi . I have the raspberry pi logging data into two csv files . and do my graphs local and all is working fine.I now want to send those two CSV file to ThingSpeak . Im using Python on the Pi .Please help or point me into the right direction

March 26, 2019
2:57 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 754
Member Since:
March 7, 2017
sp_UserOnlineSmall Online

The easiest way will most likely be using the bulk write API.

See https://www.mathworks.com/help/thingspeak/bulkwritecsvdata.html

You will have to write python code to convert your csv file to the appropriate format.
There are definitely HTTP libraries available for posting from Rpi. For example urllib and urllib2. (Google POST Rpi HTTP)

Since you are already reformatiing the data, you may also want to consider JSON format:
https://www.mathworks.com/help/thingspeak/bulkwritejsondata.html

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online: cstapels
27 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

Fathima22, jefflam1994, harrydawson, markpaul7931, sgarsvk2rdx, Win Win

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457