Accelerometer Data

Former Member
Former Member
The initial slideshow referenced that Connect IQ would have access to the acceleratometer data however I see no reference to it in the current SDK docs. Is it a feature that is coming or is it something that was abandoned?
  • I gave this a go just for fun.

    It looks like you can't make a Master ANT+ channel in ConnectIQ. Maybe Garmin could comment on this limitation. It doesn't come to my mind immediately why this wouldn't be allowed. I got the following error.

    Master channels on the ANT+ network are not allowed.

    So I thought I might be able to leave the watch as a slave but use the sendAcknowledge() to get the data going the other direction (from the watch to SimulANT)

    I started with the MO2Display App example. I added the following function into the MO2Sensor class. Of course, you'd need to pass in your data and stuff it into the available bytes like you want.

    function SendData() {
    var payload = new [8];
    payload[0] = 0x10; // Command data page
    payload[1] = 0x20; // Stuff your data here
    payload[2] = 0x21; // Stuff your data here
    payload[3] = 0x22; // Stuff your data here
    payload[4] = 0x23; // Stuff your data here
    payload[5] = 0x24; // Stuff your data here
    payload[6] = 0x25; // Stuff your data here
    payload[7] = num; // Stuff your data here
    num=num+1;


    var message = new Ant.Message();
    message.setPayload(payload);
    GenericChannel.sendAcknowledge(message);
    }


    Then just to make things update at the rate I wanted, I added a timer in the MO2DisplayApp like below. There might be a better way to do this.

    class MO2DisplayApp extends App.AppBase
    {
    var mSensor;
    var mTimer;

    function initialize() {
    mTimer = new Timer.Timer();
    }

    // onStart() is called on application start up
    function onStart()
    {
    //Create the sensor object and open it
    mSensor = new MO2Sensor();
    mSensor.open();
    mTimer.start(self.method(:onTimerCallback), 250, true);
    }
    .......
    function onTimerCallback() {
    Ui.requestUpdate();
    }



    Then I just added a call to the SendData function in the Data View. Again, this is where you'd want to pass your data.

    mSensor.SendData();

    Then I used SimulANT+ to capture the data.

    ....
    744830065 : Tx: [01][34][00][06][D0][47][1F][7D]
    744830080 : Rx (Ack): [10][20][21][22][23][24][25][4E]
    744830314 : Tx: [01][34][00][06][D0][47][1F][7D]
    744830330 : Rx (Ack): [10][20][21][22][23][24][25][4F]
    744830564 : Tx: [01][34][00][06][D0][47][1F][7D]
    744830580 : Rx (Ack): [10][20][21][22][23][24][25][50]
    744830814 : Tx: [01][34][00][06][D0][47][1F][7D]
    744830845 : Rx (Ack): [10][20][21][22][23][24][25][51]
    744831063 : Tx: [01][35][00][06][D0][47][1F][7D]
    744831079 : Rx (Ack): [10][20][21][22][23][24][25][52]
    744831313 : Tx: [01][35][00][06][D0][47][1F][7D]
    744831328 : Rx (Ack): [10][20][21][22][23][24][25][53]
    744831562 : Tx: [01][35][00][06][D0][47][1F][7D]
    744831594 : Rx (Ack): [10][20][21][22][23][24][25][54]
    744831812 : Tx: [01][35][00][06][D0][47][1F][7D]
    744831843 : Rx (Ack): [10][20][21][22][23][24][25][55]
    744832062 : Tx: [01][36][00][06][D0][47][1F][7D]
    744832093 : Rx (Ack): [10][20][21][22][23][24][25][56]
    744832311 : Tx: [01][36][00][06][D0][47][1F][7D]
    744832342 : Rx (Ack): [10][20][21][22][23][24][25][57]
    744832561 : Tx: [01][36][00][06][D0][47][1F][7D]
    744832592 : Rx (Ack): [10][20][21][22][23][24][25][58]
    744832810 : Tx: [01][36][00][06][D0][47][1F][7D]
    744832842 : Rx (Ack): [10][20][21][22][23][24][25][59]
    ....


    I didn't test whether the first byte had to be a 10 or if it could also be used for data. The way it is, it's getting 7 bytes across at 4 Hz.

    You can download SimulANT+ from here https://www.thisisant.com/news/simulant-next-generation-ant-simulation-tool-now-available/ I think you need to sign up to be an adopter which should be free.

    I set SimulANT+ up to simulate a Muscle Oxygen Sensor and then let it pair to the watch. The ANT Messages Tab streams the data and you can cut an paste it out. You will need to dump the Tx lines and your data is encoded in the Rx lines.

    Here's a screenshot of SimulANT+
  • I'm not clear why a master channel would not be allowed, so I've contacted one of our ANT+ guys to help explain. If he doesn't post directly here, I'll copy his response.
  • I gave this a go just for fun.

    So I thought I might be able to leave the watch as a slave but use the sendAcknowledge() to get the data going the other direction (from the watch to SimulANT)

    [...]

    I set SimulANT+ up to simulate a Muscle Oxygen Sensor and then let it pair to the watch. The ANT Messages Tab streams the data and you can cut an paste it out. You will need to dump the Tx lines and your data is encoded in the Rx lines.



    Thanks a lot, Roger. This looks like an interesting possibility. I am, however, dependent on doing some of the testing in the field with respect to development of algorithms. I guess that as long as Connect IQ can not set up a Master ANT+ channel, I am dependent on SimulANT+ in order to get data out (which I could then pick up with a mobile phone with ANT+ or another Garmin watch?). Or can e.g. an ANT+ signal from a HR belt be used as a master? (Probably not, sorry if the question is far off).
  • I got an answer back about the ability to open master channels:

    That’s a great question. Originally we added the restriction because we didn’t know if apps were being certified. This restriction blocks a dev from creating something like a fake HRM that goes against the ANT+ HRM profile. However, since they are now certified we should be able to remove this restriction.


    There hasn't been a decision about whether we'll make this available, but we'll discuss it and should know something soon. :)
  • Is there any information about accelerometer characteristics?
    Looking at AccelMag demo and the scope for all axis is -1000 to +1000 but looks like it is not linear.
    Or it should be linear and I need to calibrate Compass(Accelerometer)?
    What I need is
    accel 0 - 0 degrees
    accel 500 - 45 degrees
    accel 1000 - 90 degrees

    Now it is
    accel 500 - 60 degrees
    accel 730 - 45 degrees

    Or maybe I can not assume that accelerometer has specific characteristic because it differ device to device?
  • The acell data is in milligals or gals (I don't recall which one right now)
  • Former Member
    Former Member over 9 years ago
    Accel data is not in Gals, it is reported in milli-g-force.

    As indicated in the documentation
  • Thanks Brian, I don't know how I missed it.