Friday, March 13, 2015


I was curious about all the recent hype about apple and CGMS data.  I noticed a while back that healthkit had hooks for Glucose, although it disappeared from the api for a period of time.

Finally, the 8.2 release has it.  Here's this morning:

So, first impression, the graph is basically, useless.  Upper line is 300, middle line is 110?
I thought I could zoom in on the points by double tapping, nope.  And the time scale is fixed, 12-12.

A potential positive here, all I needed was an app writing glucose values to healthkit.  Theoretically, any other app should be able to subscribe to that data with the Users permission.  That could be major, real time access to your data from any approved iOS application.

So we might see a proliferation of iOS apps that handle CGMS data in some capacity, certainly something better than what's above.

On another note, the new model died after 2 months.  First of my devices to malfunction.  Probably due to the wire wrap wire, jumpers that I used.  Redesigned the board, with only two jumpers, and relocated the connection points to where they are easier to access.  Routed the slot for the crystal, "carefully" this time, and relocated some of the traces so I wouldn't be cutting them...
Top trace isn't so pretty, I had to touch that up with a sharpie before etching.

On the XCode side, upgraded to whatever version supports 8.2.  Found that breaks the ability of my iOS app to reconnect BLE from the background.  I spent allot of time getting that to work.  Luckily, recompiling my app as 8.1 appears to solve that issue(for now), until I figure out how the code is supposed to work.  

Finally, it's easy enough to write data to healthkit, if you start with the Heart Rate example.  The tricky part is getting the units correct.  The closest unit of measurement you can choose is g/L.  If you're using mg/dl, you'll need to divide that value by 100 before writing to healthkit.  


  1. Hey, Don. Saw your blog the other night while searching for a potential path to make my own CGM Watch, but I'm not completely competent with the electrical engineering side of the project. Would something like the XBAND work similarly to what you're creating?

  2. Yes, it looks like another BLE Peripheral device. Also looks like another Redbear product. The RFDuino is also pretty small, spend the $10 on that. The next step for me would be a combination Central/Peripheral device, then you could be separated from a phone, except for calibration.

  3. Hello Dan. my name is Mihai Popa and I need some information about your project. You can read the Dexcom transmitter with CC2500? If so, what is the modulation type? I have Dexcom G4 monitoring system and I want to built another receiver. Can you share with us the code for your device?
    Thank you for your support!

  4. OK. See github, that should get you started. For converting ISIG values into Glucose see xDrip / Stephen Black. Details on modulation etc, see

  5. Hey don!
    Does healthkit have a web api as well, or is it all only accessible from the ios device itself?

  6. No, healthkit is more of a local data store with a front end app.

  7. This comment has been removed by the author.

  8. Hello Don, Can you put on GitHub the block schematic and software for each module? Is need to re-flash the RFDuino and MAR105P? Thank you for your support!

    1. See today's update. Schematic is going up now, only software is on the RFDuino.

  9. Thank you! I see the update and I download the archive. But how connect to the application? It is a specific one? It's working on the Android too? What is the purpose for that black connector? it is for re-flash/up-load the software the RFDuino? Thank you!

  10. This device will receive a packet from a CC2500 and provide that data when "queried" via BLE. It is available to any BLE central device as a peripheral. I use this with a custom iPhone app, pieces of which you see on Github. I don't do any work with Android.
    The black connector is a pin header socket, it provides battery + and - as well as rx,tx and rst. Everything necessary to program the rfduino and charge the battery.

  11. Hello Don,
    I know that maybe is obsolete but where you introduce the Dexcom Transmiter ID? In Healthkit software (in RFDUINO software) or in watch/phone app?
    Thank you.

  12. Healthkit only stored glucose values on the iPhone. In my RFDuino version, the xmtr id is compiled into the code. Currently, I don't bother with checking the xmtr id. Even if you were close to another dexcom user, the odds of picking up their packets are fairly small. There's only a ~2 second interval every 5 minutes where you would be susceptible, and they would need to be on the same period as you also.

  13. Thank you, Don, for answer. Please, can you explain how to identify or transform the actual 5 characters Dexcom transmitter ID (for example, 6ABCD) if 4 hex xmtr number? Thank you.

  14. I used the hex from the sensor data packet, then put that in my code. But here's the code to do the transform:
    char XDATA SrcNameTable[32] = { '0', '1', '2', '3', '4', '5', '6', '7',
    '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
    'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P',
    'Q', 'R', 'S', 'T', 'U', 'W', 'X', 'Y' };

    void dexcom_src_to_ascii(uint32 src, char addr[6]) {
    addr[0] = SrcNameTable[(src >> 20) & 0x1F];
    addr[1] = SrcNameTable[(src >> 15) & 0x1F];
    addr[2] = SrcNameTable[(src >> 10) & 0x1F];
    addr[3] = SrcNameTable[(src >> 5) & 0x1F];
    addr[4] = SrcNameTable[(src >> 0) & 0x1F];
    addr[5] = 0;