Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can I get Accelerometer data from my fitbit charge3?

ANSWERED

Fitbit SDK does not support fitbit charge 3, so I cannot build any application for the Charge 3 using the SDK. If I really want to collect accelerometer data on fitbit, so what can I do?

Can I get Accelerometer data from my fitbit charge3?

Best Answer
0 Votes
31 REPLIES 31
Hello Gondwana,

We have here a versa3 for measuring accelerometer data via the Fitbit watch. We are be able to measure with the Versa3 heartrate and barometer. The values are display on the display of the versa3.
We would like to measure also with the versa3 the accelerometer x,y,z and timestamp.
We used the code according to the following link https://dev.fitbit.com/build/reference/device-api/accelerometer/
This did give no accelerometer data in return. We used this first on the simulator, then on a real versa3.
We also tried the following links to get out accelerometer data but none of them came with data in return. It's still partly in the script, but commented out in index.js
https://github.com/andresquintanilla/fitbit-activity-recorder
https://github.com/JJaewon7210/Fitbit-data-collect/tree/main
[cid:image002.png@01D9A059.82CB5F00]
I would like to get similar results on the screen as shown above.
The output result of Heartrate, accelerometer, gyroscope and barometer should be sent out to a storage. This is something we have to work on how to sent it to a googledrive.
But first we need to get out the accelerometer data. The only thing we get is heartrate and barometer. The image shows also gyroscope output, but according the used script to check for gyroscope data, it states that a gyroscope is not available on the versa3 This is strange, because it is part of versa3.
We included also during the test consol.logs. Here we found out that the script is not entering the accelerometer object. We have no idea why.
We tried also some other scripts to get out accelerometer reading. None of them returning values. For example
https://github.com/andresquintanilla/fitbit-activity-recorder
https://github.com/JJaewon7210/Fitbit-data-collect/tree/main
But in all cases we get not accelerometer and gyroscope data available.
Please help us to get data on the display of accelerometer and or gyroscope.
I hope that you can give me the answer on how to read on display accelerometer data of a versa3





Sincerely,
M. Weusthof
Best Answer
0 Votes

Could you please post the relevant bits of your code? Without seeing the Javascript you're using, I can't tell what's wrong. Post the simplest example you're trying that should use the accelerometer.

Peter McLennan
Gondwana Software
Best Answer
0 Votes
My mail replay post from yesterday failed.
I'll try at the end of the dsyto repost again. The reason for the fail is not clear to me. Again this evening I'll try again. But then a limited edition amount off script.

Sincerely,

Ing. M.H.H.Weusthof
Best Answer

I sent you my code. This is only related to the accelerometer and versa3:

 

 
import document from "document";
import { Accelerometer } from "accelerometer";
import { HeartRateSensor } from "heart-rate";
import { Barometer } from "barometer";
import { display } from 'display';
if (typeof Accelerometer !== "undefined") {
  const accelerometer = new Accelerometer({ frequency: 4 });
  console.log('Accelerometer 1');
  accelerometer.start();
  console.log('Accelerometer started');
  accelerometer.addEventListener("reading", () => {
    const { x, y, z } = accelerometer;
    console.log("App:", JSON.stringify({ x, y, z }));
  });
  console.log('Accelerometer 3');
  accelerometer.start();
  console.log('Accelerometer 4');

 const accel = new Accelerometer({ frequency: 4 });

accel.onreading = () => {
  const content = {
    x: accel.x,
    y: accel.y,
    z: accel.z
  };

  console.log("App:", JSON.stringify(content));
};
accel.start();
  }
Best Answer
0 Votes

Your code works for me (more or less):

 

[8:55:45 pm]       App: App Started
[8:55:45 pm]       App: Accelerometer 1                                                               (app/index.js:8,3)
[8:55:45 pm]       App: Accelerometer started                                                        (app/index.js:10,3)
[8:55:45 pm]       App: Accelerometer 3                                                              (app/index.js:15,3)
[8:55:45 pm]       App: Accelerometer 4                                                              (app/index.js:17,3)
[8:55:46 pm]       App: App2:                                                                        (app/index.js:28,5)
[8:55:46 pm]       App: {"x":0.55...

 

It's remotely possible that you were overloading the debug bridge by logging stuff too fast; I dropped the frequency to 1 just to be safe (although 4 seemed to work).

You probably don't want to create multiple Accelerator objects in general, but this seems to work anyway.

Of course, you won't get any readings on sim.

Best Answer
0 Votes

Could you inform me about the type of versa3. I get only accelerometer 1,3 and 4. It is not getting in the function and stating.

Could you also inform me how you got these messages read out from the versa. I installed the app for measurement accelerometer, but I cannot see the console messages. Otherwise how did yo manage to read out the data from the versa as shown above

Thanks in advance

 

Best Answer
0 Votes

Could you help stepwise how I can get/read out the output as you have shown above. I get the feeling that this console output reading could help me a lot. At the moment I see only the display, with no result. So please give me pointwise the information on how to read the console.log when installed on versa3

 

Best Answer
0 Votes

I assume you're using CLI to build your app. Connect to a real watch (not sim), then install to it. console.log output will appear (unless there's too much of it or something disconnects).

If you saw accelerometer 1, 3 and 4, you must be doing this already.

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Sorry for disturbing you again but still I've got problems.

About your remark of the accelerometer 1, 3, and 4. I received these 3 remarks when used with the fitbit simulator.

Now I try to connect the devoled app via Visual Studio Code to sent it to the Versa3. I've set the versa3 on the phone to bridge, and try to set the versa3 also in brigde mode. However, the versa3 is not be able to get into bridge mode. I try also via npx fitbit to connect to the versa3, but the versa3 cannot be found. I've reinstalled the versa3 3 times to factory. setting. but the bridge mode cannot be set. Also I've updated the versa3 to the latest verion.

I think that if I can make this connection from visual studio code to versa3 a lot of things are solved for me. At least I should be able to get consol.log data out then and improve simple the app for measering. Could you give me help how to connect the visual studio code to the versa in that way that I can download the app and check it functionality.

Best Answer
0 Votes

Have you done the 'Using a Fitbit OS Device' steps here?

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Peter, I have checked the above steps mentioned. Only thing is that I cannot confirm the platform terms. However, I opened the fitbit on my phone and set it to developer mode. I did also put the versa3 in developer mode. The versa3 is connected is shown, also the Developer bridge is on. (message "waiting for Studio", which I dont have. However, after bi it states that there a no devices. 

weusthofm_0-1687330337695.png

Running the simulator works, but according the shell i don't have devices. The command host does not work to see all devices. So please advice me to get connected to the versa3. The connection bridge on de versa get turned off after a while. 

Best Answer
0 Votes

I meanged to get a connection. I switch from wifi id and now it responses. Thanks sofar

 

Best Answer