01-23-2020 14:23
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-23-2020 14:23
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi,
I am working on a project where I need to get raw heart rate data (frequency ~ 10 Hz) and put it into a CSV file based off a certain time period that I want (my project needs lots of data). I have already made a real time app on the watch itself using fitbit studio that shows my real time sensor data (HR, body presence, pressure, accelerometer)
1. How can I display that real time data on my computer and put it into a CSV file?
2. Which programming languages would be very helpful to do this?
3. How can I access a higher HR frequency from the Fitbit? So far I am getting 0.2 Hz (1 reading every 5 seconds through a web API).
Personally I could not find any code online that shows how to display real time sensor data on my computer so if there is any code out there that someone made please provide me the link.
01-24-2020 13:38
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-24-2020 13:38
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Create a Web API using NodeJs, then use fetch() in the companion API to post data to it.
//companion
fetch('https://webserver/your-server', {
method: 'post',
body: JSON.stringify(yourData)
}).then(function(response) {
return response.json();
})
Then maybe something like this for the server https://www.codementor.io/@olatundegaruba/nodejs-restful-apis-in-10-minutes-q0sgsfhbd

01-24-2020 13:55
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-24-2020 13:55
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Will this help me extract raw HR data from my fitbit watch and convert all that raw data to a csv file? From my understanding I need to use the Sensor API not the Web API. I basically want to log all my sensor data from the watch and get a csv file from it so something similar to these apps
https://watchaware.com/watch-apps/1050491381
https://play.google.com/store/apps/details?id=com.alfav.applications.accelerometerlog&hl=en_US.

01-24-2020 13:59
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-24-2020 13:59
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
You mentioned you already have the Fitbit app collecting heart rate data. You can send that to the companion using the Messaging API (https://dev.fitbit.com/build/guides/communications/messaging/)
Then from the companion to YOUR own Web API, where you can generate a CSV file.
01-24-2020 14:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-24-2020 14:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Use messaging or file transfer to get data from sensor API from watch to companion.
Use javascript in companion to send the data to a server using fetch or websocket.
Create server application in whatever language is relevant. Server must receive data from companion and make it available as CSV. Server could run on companion device or internet.
Access server to obtain CSV.
Data could be formatted as CSV on companion or server.
Have a think about what 10Hz HR data would look like, since most hearts normally beat at about 1Hz. 🙂
Gondwana Software

01-24-2020 14:17
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-24-2020 14:17
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thank you for the reply, I will try that out! The 10 Hz you brought up is a very good point. I just gave that as an example if I wanted to change that to about 2 Hz possibly or maybe 0.5 Hz.

01-24-2020 14:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-24-2020 14:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
In thinking about it, Jon's answer (Web API) was probably best. I was thrown by the mention of real-time data, but I gather you only want detailed data rather than immediate data. You don't need your own app on the watch or companion to get Web API data.
There are already several web sites that can reformat Web API data as CSV. Here's one.
You can get data at 1 to 3 second intervals when the watch is in Exercise mode.
Gondwana Software

01-24-2020 14:24
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-24-2020 14:24
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thank you! However, I am only going to need it for resting data as I do not want the user to be using the exercise mode.

