{"id":17449179,"url":"https://github.com/ps2/minimed_rf","last_synced_at":"2025-04-19T14:53:45.070Z","repository":{"id":26126482,"uuid":"29571110","full_name":"ps2/minimed_rf","owner":"ps2","description":"Decoding the radio protocol used by medtronic pumps, enlite cgm, and mysentry monitor.","archived":false,"fork":false,"pushed_at":"2017-02-25T18:47:05.000Z","size":211,"stargazers_count":22,"open_issues_count":3,"forks_count":15,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-29T09:02:10.866Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ps2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-21T04:25:02.000Z","updated_at":"2024-11-04T20:50:49.000Z","dependencies_parsed_at":"2022-07-22T04:17:02.601Z","dependency_job_id":null,"html_url":"https://github.com/ps2/minimed_rf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ps2%2Fminimed_rf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ps2%2Fminimed_rf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ps2%2Fminimed_rf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ps2%2Fminimed_rf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ps2","download_url":"https://codeload.github.com/ps2/minimed_rf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249718535,"owners_count":21315083,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-17T21:05:22.068Z","updated_at":"2025-04-19T14:53:45.050Z","avatar_url":"https://github.com/ps2.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# minimed_rf\n\nMany Medtronic insulin pumps are capable of sending CGM data to a remote monitor called MySentry.  This project provides ruby libraries and tools to decode the message sent between the devices.  To capture and send packets, you can use something like [RileyLink](https://github.com/ps2/rileylink) or an SDR.\n\n## rf modulation\n\nThe frequency used is 916.5MHz, and the modulation is ASK/OOK. Data rate is 16kBaud. I use an RX filter BW of 203kHz since the pump, sensor, and MySentry all use different antennas and the frequency varies a bit from the center.\n\nHere are the settings I use to configure a cc1110 with a 24MHz crystal:\n\n```\n/* RF settings SoC: CC1110 */\nSYNC1     = 0xFF; // sync word, high byte\nSYNC0     = 0x00; // sync word, low byte\nPKTLEN    = 0xFF; // packet length\nPKTCTRL1  = 0x00; // packet automation control\nPKTCTRL0  = 0x00; // packet automation control\nADDR      = 0x00;\nCHANNR    = 0x02; // channel number\nFSCTRL1   = 0x06; // frequency synthesizer control\nFSCTRL0   = 0x00;\nFREQ2     = 0x26; // frequency control word, high byte\nFREQ1     = 0x2F; // frequency control word, middle byte\nFREQ0     = 0xE4; // frequency control word, low byte\nMDMCFG4   = 0xB9; // modem configuration\nMDMCFG3   = 0x66; // modem configuration\nMDMCFG2   = 0x33; // modem configuration\nMDMCFG1   = 0x61; // modem configuration\nMDMCFG0   = 0xe6; // modem configuration\nDEVIATN   = 0x15; // modem deviation setting\nMCSM2     = 0x07;\nMCSM1     = 0x30;\nMCSM0     = 0x18; // main radio control state machine configuration\nFOCCFG    = 0x17; // frequency offset compensation configuration\nBSCFG     = 0x6C;\nFREND1    = 0x56; // front end tx configuration\nFREND0    = 0x11; // front end tx configuration\nFSCAL3    = 0xE9; // frequency synthesizer calibration\nFSCAL2    = 0x2A; // frequency synthesizer calibration\nFSCAL1    = 0x00; // frequency synthesizer calibration\nFSCAL0    = 0x1F; // frequency synthesizer calibration\nTEST1     = 0x31; // various test settings\nTEST0     = 0x09; // various test settings\nPA_TABLE0 = 0x00; // needs to be explicitly set!\nPA_TABLE1 = 0x57; // pa power setting 0 dBm\n```\n\n## data encoding\n\nThe data is encoded using an encoding called 4b6b. It looks like this:\n\n```ruby\n    \"010101\" =\u003e \"0\",\n    \"110001\" =\u003e \"1\",\n    \"110010\" =\u003e \"2\",\n    \"100011\" =\u003e \"3\",\n    \"110100\" =\u003e \"4\",\n    \"100101\" =\u003e \"5\",\n    \"100110\" =\u003e \"6\",\n    \"010110\" =\u003e \"7\",\n    \"011010\" =\u003e \"8\",\n    \"011001\" =\u003e \"9\",\n    \"101010\" =\u003e \"a\",\n    \"001011\" =\u003e \"b\",\n    \"101100\" =\u003e \"c\",\n    \"001101\" =\u003e \"d\",\n    \"001110\" =\u003e \"e\",\n    \"011100\" =\u003e \"f\"\n```\n\nA raw (encoded) packet looks something like this:\n```\nab29595959655743a5d31c7254ec4b54e55a54b555d0dd0e5555716aa563571566c9ac7258e565574555d1c55555555568bc7256c55554e55a54b55555556c55\n```\n\nOnce you have decoded the data, the packets start to show some recognizable fields:\n```\na259705504e541120e1b0e080b004d4e00018a03010628127e0504004f0000008b120c000e080b00000c\n```\n\na2 identifies the type of packet, 597055 is the pump number, etc...  The 0c at the end is an 8bit crc.\n\n## usage\n\n```\nruby -I lib bin/mmdecode \u003cpacketdata\u003e\n```\n\n## example\n\n```\nruby -I lib bin/mmdecode ab29595959655743a5d31c7254ec4b54e55a54b555d0dd0e5555716aa563571566c9ac7258e565574555d1c55555555568bc7256c55554e55a54b55555556c55\na2 597055 PumpStatus: #101 2014-08-11 18:14:00 -0500 - Glucose=154 PreviousGlucose=156 ActiveInsulin=1.975\n```\n\n# Flow control\n\nIf you're using a device that doesn't have flow control (like the ERF stick), set the appropriate environment variable before use:\n\n```\nexport RFSPY_RTSCTS=0\nruby -I lib bin/mmtune /dev/ttyMFD1 123123\n```\n\n## Thanks\n\nThanks to @bewest and @loudnate and others who have provided many insights into the Minimed protocols. Much of the pump-specific knowledge has been figured out by @bewest in his [decoding-carelink](https://github.com/bewest/decoding-carelink) repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fps2%2Fminimed_rf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fps2%2Fminimed_rf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fps2%2Fminimed_rf/lists"}