These are chat archives for nightscout/intend-to-bolus

23rd
May 2015
Pete Schwamb
@ps2
May 23 2015 01:21
I finally published the design files for the RileyLink: https://github.com/ps2/rileylink/tree/master/hardware
Will be publishing the firmware source next.
Pete Schwamb
@ps2
May 23 2015 01:38
It might be interesting for those of you that were looking at Bluetooth -> CC1110 connectivity
Darrell Wright
@beached
May 23 2015 01:42
Did you use sdcc or iar?
Pete Schwamb
@ps2
May 23 2015 01:42
sdcc
the bluetooth is a ble113, which has it's own firmware compiler/uploader that uses a CC debugger
Darrell Wright
@beached
May 23 2015 01:45
that's pretty close to what I was working on. I was going to just use a jy-mcu for BT because I have one handy
how is the power life with the 850mAh battery?
Pete Schwamb
@ps2
May 23 2015 01:47
I get about a day and a half, without any sleep; should be able to increase it quite a bit with sleeping.
Darrell Wright
@beached
May 23 2015 01:51
I think if one knows the preamble the CC1110 can be set to wake on that but I am not 100%
pretty board btw
Pete Schwamb
@ps2
May 23 2015 01:54
Thanks; the label layer was a mess (v 0.2 was an early version that just ended up working better than later ones that I cleaned up the label layer, and tried to add battery monitoring circuitry to).
But since it's working better than the subsequent versions, so I'll be rebasing from that and any further changes will from 0.2 as well.
To go into the main power saving mode on the cc1110, you have to turn off rx completely, but I think we could still get a good sleep period in there.
Darrell Wright
@beached
May 23 2015 01:57
I was thinking the bt serial was good too because I can backfeed the calibrations to the MCU and then output ANT+ too and use it on a garmin watch
once it has a sensor, the timing is predictable. then the trick is to not miss the glucose values
Pete Schwamb
@ps2
May 23 2015 01:58
the pump sends out up to 3 copies of the bg packet, if it doesn't get an ACK.
(when using the MySentry style protocol)
you could also poll, using the table dump commands.
Darrell Wright
@beached
May 23 2015 02:11
oh so you are polling the pump. not the senor/glucometre?
Pete Schwamb
@ps2
May 23 2015 02:14
Yes, the pump gives off a much stronger signal than the sensor, I believe.
I can pick up the pump anywhere in our house just about, so she doesn't have to carry an extra device around.
Darrell Wright
@beached
May 23 2015 02:15
with mmcommander i get singal accross floors and house
does it work with temp basal unlike an upload
Pete Schwamb
@ps2
May 23 2015 02:20
When configured to talk to a MySentry, the pump sends out messages (up to three copies) each time the sensor reports. The messages contain bg, iob, battery status, remaining insulin in the reservoir, and other data.
That's not polling.
Darrell Wright
@beached
May 23 2015 02:21
cc1110 should have a wake on radio mode
Pete Schwamb
@ps2
May 23 2015 02:24
I believe it does; basically you shut down the CPU and can wake on an interrupt. But the cpu uses a relatively small amount of power compared to the RX, so it's not much of a sleep mode. To really save power, you need to shut off the RX, which I think you can do. If you rx a packet, you know you don't care about getting anything for at least the next 4 minutes.
i see what you mean
Darrell Wright
@beached
May 23 2015 02:32
although, it looks pretty good with WOR, they are in the uA ranges. I think it would depend on the whether it can calibrate (I think about 75microseconds) in time to review the next packet
Darrell Wright
@beached
May 23 2015 02:38
Wow, you mentioned checking the input voltage. the code is like 7 lines long. what doesn't this chip do
Pete Schwamb
@ps2
May 23 2015 02:43
What code are you referring to?
The adc will poll the VDC and give a voltage valute
value
sorry VDD
sample, wow I need to read what I am typing here
Pete Schwamb
@ps2
May 23 2015 02:46
The max voltage that the ADC can measure is VDD, which is regulated to 3.0v on my board. I need to measure the lipo voltage, the lowest that I should let it (the lipo) get to is 3.8 volts or thereabouts.
Darrell Wright
@beached
May 23 2015 02:47
I thought they could safely go lower than that? like closer to 3
Pete Schwamb
@ps2
May 23 2015 02:48
I could use a voltage divider, but then I was thinking that would always be bleeding current, so I found a circuit with mosfets that could turn on and off the voltage divider part of the circuit. Ended up with a ton more parts, and it wasn't working for some reason. sigh. I'm not an EE, so I was getting too far ahead of myself. :)
The power mgmt circuit I'm using cuts off the lipo before it gets dangerously low, so from an end user standpoint, the device just goes dead at some point, safely.
Darrell Wright
@beached
May 23 2015 02:49
i was going to use the voltage drop from a diode and didnt get this far
im no EE either, diving into the deep end is fun though
Pete Schwamb
@ps2
May 23 2015 03:12
yeah, although sometimes uncomfortable. When I assembled the first RileyLink and it didn't work, I was like "what do I do now?". I had no clue, and thought I had just wasted months of time on a quixotic quest.
Darrell Wright
@beached
May 23 2015 03:17
Checked the lipo's i am using and they come with protection circcuitry and cutoff at 3.0V https://www.adafruit.com/products/258
Pete Schwamb
@ps2
May 23 2015 03:19
Yeah, I see lots of different numbers about "how low can you go". Regardless, I need something in the 4.2 - 3.x range, and I can't do that directly with the ADC, and didn't figure out a good way of dropping the voltage.
diabeticgonewild
@diabeticgonewild
May 23 2015 03:26
@ps2 what do you need help with with respect to circuit? I know voltage divider laws, kirchoff laws etc. I passed circuit analysis
Darrell Wright
@beached
May 23 2015 03:27
You are, currently, in a different ballpark and designing the circuit while I am playing with lego. So I am using the adafruit lipo/usb charger and the voltage drop of a couple diodes(not sure of another cheap way)
diabeticgonewild
@diabeticgonewild
May 23 2015 03:27
I'm an EE student but it's been awhile since I took circuits. Have a bunch of medical problems but Intel wanted me as an EE intern back in the day but I was too sick to take up the offer
To get the voltage drop off of a diode you would just put the terminals of the voltmeter in series and measure voltage...
That's basically a voltage divider as the multimeter has a resistor
Embedded in it but the effect of the resistor is of little significance with respect to measurement
Pete Schwamb
@ps2
May 23 2015 03:32
I have the cc1110 and the ble113 both sitting behind a DC/DC converter (TPS63031) that regulates VDD to 3.3v
Both the cc1110 and ble113 chips have an ADC that can measure 0 - VDD
How can I hook up the lipo + signal to one of the ADCs in a manner that doesn't waste power?
Could I rely on diodes like @beached suggested? Would they need to be individually calibrated?
Darrell Wright
@beached
May 23 2015 03:35
I have read two silicon in series should cover it at our currents. it was specific to a cc1110, at 3.7v they glow red apparently
so it's a 15% loss give or take, but much cheaper and smaller.
I thought I read that others are running them unregulated, not sure how that affects the operation.
Pete Schwamb
@ps2
May 23 2015 03:38
Maybe this discussion is just academic for me; i've kinda given up on the problem, since I realized it wouldn't change the usability of the device for me much. I just plug it in at night, like I do the phone that is part of the system as well.
I'm still kinda curious if there is some obvious solution I've missed.
Darrell Wright
@beached
May 23 2015 03:38
actually i read wrong, 1 silicon did it for the person
i like that you are able to get sentry mode working, I also like the extra backup cgm provided with polling for the sensor/glucometre as the pump can be off or wrong. the cc1111 picks up the sensor accross the house where the pump cannot get through me or my kid often enough
diabeticgonewild
@diabeticgonewild
May 23 2015 03:42
Couldn't you just use resistors? Those are always passive devices like LEDS
Pete Schwamb
@ps2
May 23 2015 03:42
yeah, a voltage divider, right?
diabeticgonewild
@diabeticgonewild
May 23 2015 03:43
I haven't read all of the messages but a voltage divider specifically for what?
Pete Schwamb
@ps2
May 23 2015 03:43
Maybe I dismissed that too quickly when I read that it constantly dissipates power. I never really figured out how much power.
Darrell Wright
@beached
May 23 2015 03:43
diode also provides protection from reversing polarity
Pete Schwamb
@ps2
May 23 2015 03:43
To bring the 4.2-3.x range down to < VDD range
diabeticgonewild
@diabeticgonewild
May 23 2015 03:44
V=(I^2)*R
I equals current in amps
R equals resistance in Ohms
Pete Schwamb
@ps2
May 23 2015 03:45
If I hooked up LIPO+ to a gpio pin on the cc1110, with a resistor or diode connecting them, is that what we're talking about?
diabeticgonewild
@diabeticgonewild
May 23 2015 03:45
i don't even know what a lipo is
Pete Schwamb
@ps2
May 23 2015 03:45
a battery
diabeticgonewild
@diabeticgonewild
May 23 2015 03:45
Oh
Pete Schwamb
@ps2
May 23 2015 03:46
the voltage of which we'd like to measure
and its range is 4.2 to 3.7v, say
diabeticgonewild
@diabeticgonewild
May 23 2015 03:46
If you are doing kirchoff's voltage law across a mesh, all adjacent nodes are going to have the same voltage regardless of the devices in the nodes
Darrell Wright
@beached
May 23 2015 03:46
@diabeticgonewild the current changes though and a resister will have a different voltage drop then based on current, a diode is constant isn't it?
diabeticgonewild
@diabeticgonewild
May 23 2015 03:47
Current differs voltage is the same across adjacent nodes in a mesh
Resistor voltage drop will vary according to Ohms law
Current will vary based on the voltage drop of the resistors (based on resistance) and the voltage of the passive device (diode)
Darrell Wright
@beached
May 23 2015 03:49
That's what I am saying, the current draw of the circuit isn't constant
Pete Schwamb
@ps2
May 23 2015 03:49
Sorry, I'm lost. :worried: Yes, I understand voltage drop across a resistor and a diode. I just don't understand how much current will flow through the GPIO pin if I hook it directly up.
diabeticgonewild
@diabeticgonewild
May 23 2015 03:49
Not everywhere
Current draw at the Lipo/battery will be the same until it branches off.
Kirchoff's current law
KCL
Darrell Wright
@beached
May 23 2015 03:50
@ps2 I see what you are saying. You just want to measure but keep the regulator right?
Pete Schwamb
@ps2
May 23 2015 03:50
I think this is where the impedance of the gpio pin comes into play, but I don't understand that really.
diabeticgonewild
@diabeticgonewild
May 23 2015 03:51
Impedance is just resistance with frequencies pretty much
Pete Schwamb
@ps2
May 23 2015 03:51
Yes, I want to keep VDD stable.
diabeticgonewild
@diabeticgonewild
May 23 2015 03:51
It's only significant outside of the time domain, so when time is invariant
I mean if you give me a schematic I can figure it out
Darrell Wright
@beached
May 23 2015 03:52
@ps2 I am not sure, it says that the pins are intollerant of a voltage 0.3v above VDD though
diabeticgonewild
@diabeticgonewild
May 23 2015 03:52
Don't worry most of us had fun with circuits...class average on exams being like a 43 or something with no curve...
I guess Vdd is like Vcc?
Darrell Wright
@beached
May 23 2015 03:53
vdd is the power pin on the chip
diabeticgonewild
@diabeticgonewild
May 23 2015 03:53
Like V_in
Yeah
Darrell Wright
@beached
May 23 2015 03:53
yeah
diabeticgonewild
@diabeticgonewild
May 23 2015 03:53
Correct
Darrell Wright
@beached
May 23 2015 03:53
positive
affirmative
yes
diabeticgonewild
@diabeticgonewild
May 23 2015 03:54
LOL!
Darrell Wright
@beached
May 23 2015 03:56
@ps2 Me thinks it cannot be done with that restriction. With what I am doing(untested) is running it all unregulated and just protecting the top end from going above 3.6v. the chip and the others will all have the same reference voltage then and cutoff at 3.0v battery(2.3v ish on the chip).
diabeticgonewild
@diabeticgonewild
May 23 2015 03:56
So it's a matter of relating ohms law, kirchoff's voltage law, and kirchoff's current law...in the passive sign convention...if you want to do it on your own for about 8 hours or so...or you could just give it to me.
Darrell Wright
@beached
May 23 2015 03:56
many lipos will cutoff at low end anyway and turn off
diabeticgonewild
@diabeticgonewild
May 23 2015 03:56
The schematic, that is
Darrell Wright
@beached
May 23 2015 03:57
ps2 posted the schematics earlier https://github.com/ps2/rileylink/tree/master/hardware
with pictures :)
diabeticgonewild
@diabeticgonewild
May 23 2015 03:57
Just use like circuitlab.com or visio or omnigraffle
Now I have to figure out how to open the .sch file
Darrell Wright
@beached
May 23 2015 03:59
@ps2 I see what you meant now, sorry. If you divide the voltage it will be below the 3.3v and not above so it should be ok as it isn't above the 3.3v + 0.3v. So 4.3v/2 = 2.15v for full and 1.5v for empty
Pete Schwamb
@ps2
May 23 2015 04:01
Right. I think I get into issues with selecting values for the voltage divider. I want the resistors to be as high as possible to minimize power expenditure, but at some point there probably isn't enough current for the adc to work.
@diabeticgonewild, the schematic opens in Eagle
Darrell Wright
@beached
May 23 2015 04:09
@ps2 WAG it and then a binary search?
Pete Schwamb
@ps2
May 23 2015 04:11
Something like that would probably work. I wonder, though if there is some way of not consuming power when we're not interested in voltage; I would only need to poll voltage once a minute at most; the adc itself consumes a fair amount of power when running, I think.
diabeticgonewild
@diabeticgonewild
May 23 2015 04:12
Got it. Going to try to look at it tonight. Don't have much experience with electronics. Would have blasted through undergrad if I wasn't sick for the whole experience...
I don't think there's an answer to that unless you made the voltage low across all nodes...
Pete Schwamb
@ps2
May 23 2015 04:13
I don't know what these "nodes" are?
Darrell Wright
@beached
May 23 2015 04:13
I read here that he used a 3.3k when communicating with an arduino. probbly a good bet it would work for the divider? http://daveshacks.blogspot.ca/2010/01/im-me-hacking.html
I think diabeticgonewild is having dreams of semiconductor theory
diabeticgonewild
@diabeticgonewild
May 23 2015 04:14
LOL!
Darrell Wright
@beached
May 23 2015 04:15
This is software developers do circuits 101, at least for me. I know just enojugh to blow a circuit
diabeticgonewild
@diabeticgonewild
May 23 2015 04:15
yeah I don't really read actually but I am looking at the images in that blog and they don't do resistors drawn like us 'mericans do LOL,
this is digital circuits...much easier. Complicated stuff ends up always going to analog no matter what...even if they wanted it to be all digital
Darrell Wright
@beached
May 23 2015 04:16
analog dudes are f'ing wizards
My best friend is a radio guy
diabeticgonewild
@diabeticgonewild
May 23 2015 04:17
that sounds awesome!
yeah when you interview with Intel and stuff...you always say you "like analog" never digital LOL
Darrell Wright
@beached
May 23 2015 04:17
like look at the 1960's rock experimentation and bouncing signals off rocks in space and stuff. dark wizardry
peter framtons stuff. he lets stick an amp in a bathtub. except the analog guys know why
diabeticgonewild
@diabeticgonewild
May 23 2015 04:19
I mean since this is being used intermittently, I would just use resistors....power shouldn't be too much of a concern...it won't always be discharging when off or whatever.
Like I think the power situation will be a matter of finding the right battery/lipo as anything in parallel with it will have the same voltage as the power source (battery)
Darrell Wright
@beached
May 23 2015 04:22
@ps2 I think 1-3.3k should be fine and @diabeticgonewild is right, you are not sampling the adc very often and the circuit will be open
diabeticgonewild
@diabeticgonewild
May 23 2015 04:28
But capacitors and inductors work primarily in the frequency (time-invariant--when lapses in time are insignificant) domain. I wouldn't recommend them in this case.
The circuit would not be open, technically. An "open circuit" type situation classically occurs with capacitors primarily over a long time period where time lapses are insignificant.
diabeticgonewild
@diabeticgonewild
May 23 2015 04:35
Also using a capacitor in parallel is not sound advice, either. It leads to "ringing" and "vibration-like" activity in the circuit. It's not good advice at all, for creating a decent circuit, especially for the type of application we are using. It's particularly bad advice when the cc1111 is only being used intermittently and not constantly in long-term settings.
Because the voltage is "distributed evenly" along the [parallel] nodes of the circuit, according to Kirchhoff's Voltage Law, and the capacitor wired on its own will determine the voltage accummulated over time across these nodes, versus other devices which don't depend on time
Pete Schwamb
@ps2
May 23 2015 04:38
If you look at the circuit at the bottom of that doc file, you'll see where I eventually arrived. They have a mosfet that turns on the voltage divider. The capacitor charges up after the circuit is turned on, then a reading is taken on the adc. That's the only way I've ever seen it work to not draw power when you're not measuring.
I'd have to see a schematic of what you're suggesting to understand your suggestion, I think.
diabeticgonewild
@diabeticgonewild
May 23 2015 04:39
OK
I have to download pspice or orcad or whatever...
That logically makes sense, but the capacitor has to be wired with a resistor or something in the node to avoid the noise/ringing/vibration...
Pete Schwamb
@ps2
May 23 2015 04:40
It will stabilize after a small period of time; it's a small cap, I believe.
diabeticgonewild
@diabeticgonewild
May 23 2015 04:41
yeah but it's still supposed to be wired with a resistor...no matter what.
you can also fry components that way...
where is the DOC file?
I think I found it...
Pete Schwamb
@ps2
May 23 2015 04:43
All the inputs on the positive side of the cap do have resistors; the gpio pin has an impedance as well.
Darrell Wright
@beached
May 23 2015 04:45
@ps2 I don't have eagle installed right now, did you put a capacitor after the buck/boost to prevent voltage ripple? while looking up this stuff I just read http://www.ti.com/lit/an/swra173b/swra173b.pdf and it talks to the need to mitigate it
diabeticgonewild
@diabeticgonewild
May 23 2015 04:46
that sounds right...so far.
Pete Schwamb
@ps2
May 23 2015 04:47
Yes, there's a 10uF cap on VOUT on the TPS63031 (C4)
Darrell Wright
@beached
May 23 2015 04:52
between this and kids i got reddit done tonight. time for bed so i can run in the morning. cannot wait to see the code
diabeticgonewild
@diabeticgonewild
May 23 2015 04:53
Good night!
diabeticgonewild
@diabeticgonewild
May 23 2015 06:37
At least halfway done with the image I am making for instant download...it's due to accessibility issues though
Matthias Granberry
@mgranberry
May 23 2015 13:08
@ps2 does the microcontroller you use have a high impedance mode for an input? You can toggle the port flags on PICs and AVRs so they don't draw much current as a high impedance input. Wire the legs of the divider to high impedance pins then make them low outputs when you want to ground the divider.
And for power you just need the ratios of resistances to be about right. You could probably go into the 100s of kOhms if you wanted and be alright. You just get more external noise that way. Not a big deal for battery measurements
Matthias Granberry
@mgranberry
May 23 2015 13:16
You might want a pull up resistor too, to keep from having a floating voltage near the middle. That sometimes saps power in sneaky ways. The 111x may have a configurable internal pull up.
Matthias Granberry
@mgranberry
May 23 2015 13:39
It looks like the cc111xs do have high impedance inputs. If you run the "ground leg" of thevoltage divider into an input you can definitely ground it by setting the pin as an output and setting it to low, then disconnect it by setting it as an input again.
Pete Schwamb
@ps2
May 23 2015 13:42
ok, and the voltage going through it when I set it low will always be safe since it's past the resistors.
Matthias Granberry
@mgranberry
May 23 2015 13:45
Exactly. It's a fairly common microcontroller trick, but circuit guys miss it because they don't think about the micro and micro guys don't think about circuits
Pete Schwamb
@ps2
May 23 2015 13:45
The impedance of the pin when in input mode appears to be 200k or so (http://e2e.ti.com/support/wireless_connectivity/f/155/p/166320/607077). So when I'm not measuring voltage, the current drain will be the voltage of the lipo over the resistance of both legs of the divider + 200k.
Matthias Granberry
@mgranberry
May 23 2015 13:47
If that bothers you, you can run it through a transistor to ground it.
I think a PNP unless an EE wants to correct me
Just be sure to use a resistor on the input or use a MOSFET, but that's overkill.
Pete Schwamb
@ps2
May 23 2015 13:49
Looks like that would be around 10uA if I was using resistors in the 200k range
(getting total resistance around 600k)
Matthias Granberry
@mgranberry
May 23 2015 13:50
What's your goal?
Pete Schwamb
@ps2
May 23 2015 13:51
Good question. :)
I just thought there should be a simple way to measure power without draining current all the time, but 10uA might be fine.
Matthias Granberry
@mgranberry
May 23 2015 13:53
You'll get further optimizing your power supply at that point
BTW ADC and other gpio pins often have different impedances. 1M is not uncommon.
Lower impedances on ADCs let you read faster for certain loads, so they engineer them differently.
Pete Schwamb
@ps2
May 23 2015 13:57
Ok. That's interesting too. I think if I get time to do another rev, I'll add this. Would be nice to have battery level. Thanks for the input.
Matthias Granberry
@mgranberry
May 23 2015 13:57
But 10uA will take a while to matter. Or 40uA with a different divider.
Pete Schwamb
@ps2
May 23 2015 13:58
My next steps are to post the firmware code, and then to update my app to upload to nightscout instead of my ad-hoc db.
Pete Schwamb
@ps2
May 23 2015 14:19
Posted the firmware source: https://github.com/ps2/rileylink
Positive side effects of dislocating my kneecap: downtime is making me productive on sharing the RileyLink.
Matthias Granberry
@mgranberry
May 23 2015 14:27
neat. It talks w/ the pump?
Or does it pull info directly from the sensors?
Pete Schwamb
@ps2
May 23 2015 14:34
I use it mainly to receive data from the pump, but it can read from the sensor as well.
Matthias Granberry
@mgranberry
May 23 2015 14:35
what kind of range do you get with it?
Pete Schwamb
@ps2
May 23 2015 14:38
It can go across floors & rooms in our house pretty easily. I’d guess 100 ft or so
Matthias Granberry
@mgranberry
May 23 2015 14:39
To the pump? The carelink sticks get such terrible range.
Pete Schwamb
@ps2
May 23 2015 14:40
yes
I don’t have a carelink stick, but I have the same issue uploading to carelink using the contour next link meter; I have to have it within about a foot, it seems.
I wouldn’t be suprised if the antenna in both those devices is the same chip antenna based daughterboard. I think it’s a poor antenna
Matthias Granberry
@mgranberry
May 23 2015 14:44
We need to work on some OpenAPS hardware for device interaction. BLE, dexcom, and medtronic with a LiPo charger and we'd be set.
It has to be an intentionally poor antenna for "security purposes"
but they couldn't ruin the antenna on the pump or the remotes wouldn't work
Pete Schwamb
@ps2
May 23 2015 14:47
I’m surprised that others are getting a good range talking to the sensor. IIRC, when I used the SDR to look at the signals, the sensor signal is always a lot quieter than the pump.
Matthias Granberry
@mgranberry
May 23 2015 14:48
I bet there's a lot of variability there.
it might also be that there's less noise in the sensor signal. Who knows.
Pete Schwamb
@ps2
May 23 2015 16:31
For those on the medtronic sensor (we are switching back from dexcom), you could do a complete OpenAPS with just the RileyLink, if we could get the openaps code running on one of its microcontrollers.
Emma Black
@StephenBlackWasAlreadyTaken
May 23 2015 16:39
dear god @ps2 , you are a wonderful person for posting the firmware up!! tytytyt
I am having no luck with my dmas, I think I broke them :-(
Pete Schwamb
@ps2
May 23 2015 16:41
:) glad to help!
I think I played around with dma, but eventually decided I could do what I needed to without.
Emma Black
@StephenBlackWasAlreadyTaken
May 23 2015 16:50
Are you splitting up packets on the bluetooth side? or cc1110 side?
Pete Schwamb
@ps2
May 23 2015 16:51
packets are split up on the cc1110 side, but not decoded; I actually decode them in the app; that gets me error correction through the whole pipeline.
Emma Black
@StephenBlackWasAlreadyTaken
May 23 2015 16:54
Yeah, thats what I was going for as well, It worked decently from the ble end, but I never got the rf end right :-( sooo it wasnt so great
Emma Black
@StephenBlackWasAlreadyTaken
May 23 2015 17:09
Sorry if Im a little dense, so Im reading through it and I see you have some commands for command mode
and pass it an arg telling it to send packet
Pete Schwamb
@ps2
May 23 2015 17:11
There might be some needed work on the TX side; I have been using RX primarily for my own use.
Emma Black
@StephenBlackWasAlreadyTaken
May 23 2015 17:14
Makes sense
Pete Schwamb
@ps2
May 23 2015 17:15
https://github.com/ps2/rileylink/blob/master/firmware/ble113/bgdemo.bgs#L143-L159 <- shows how to tell the radio to send a packet over SPI. Not 100% sure it works right now.
diabeticgonewild
@diabeticgonewild
May 23 2015 18:04
so, @mgranberry , and others, you may be interested in this. This was the paper by Walsh saying what studies were credible/weren't with respect to euglycemic clamp studies. Of course I am referencing another paper from another journal that tells how bolus on board or insulin on board is derived, but this was the paper from Walsh that is freely and legally downloadable on the Internet the studies (to be taken into consideration...I am going for the 0.2 U/kg clamp studies, based on what I have read so far) can be found in a table
J Diabetes Sci Technol-2014-Walsh-170-8.pdf
Matthias Granberry
@mgranberry
May 23 2015 18:55
I respect Walsh a lot and I've learned a lot from him, but he seems a little aggressive on the DIA issue. It might just be that I have some significant chunk of insulin production left after all these years. I often see 3-4h DIA and only rarely do I see insulin having much of an effect out at 6h.
I'm inclined to think that this is really something that needs to be determined experimentally for a particular patient once a sufficient basal rate has been determined. If I follow his recommendations of 4.5h I don't end up overcorrecting, but I also almost never give a correction dose and always run high. The reality is that it's trickier than it looks.
diabeticgonewild
@diabeticgonewild
May 23 2015 19:25
I agree with you actually. But I don't want to ditch it or use alternative methods for mainstream users. So I'm interpolating values on the glucose infusion rate graph for 12 units novolog which is approximately 0.2 U/kg in this study. See: http://m.imgur.com/dHSQTeC
i am going to make an equation based on the interpolated values according to that monatomic stuff you mentioned like a week ago
Matthias Granberry
@mgranberry
May 23 2015 19:28
What is that image from?
diabeticgonewild
@diabeticgonewild
May 23 2015 19:29
Then I am going to do [1-((integral of equation I made of glucose infusion rate graph from t=0 to t=points at 1 minute increments)/(integral of equation I made of glucose infusion rate graph from t=0 to t=end))]*100 plus modifications according to the paper that I didn't mention yet
it's in this article Insulin aspart has a shorter duration of action than human
insulin over a wide dose-range
Matthias Granberry
@mgranberry
May 23 2015 19:30
yep. That's how I calculated my own IOB based on CGM "drops"
diabeticgonewild
@diabeticgonewild
May 23 2015 19:30
like there are confidence intervals I have to deal with
nice!
Matthias Granberry
@mgranberry
May 23 2015 19:31
I need to write up a tool that takes nightscout data and pump data from OpenAPS and spits out IOB curves. That would be awesome, but I'm too lazy to do the cleanup work
diabeticgonewild
@diabeticgonewild
May 23 2015 19:31
Also, I can make a +20% error, +10% error, -10% error, -20% error the same exact way I described...same type of function
cause according to the authors, aspart/novolog varies 10-20% by injection, just like regular insulin
so I can just make basically the same function with the % remaining IOB in terms of units, with + or - 10 to 20 percent error, even in 5 percent increments....
Matthias Granberry
@mgranberry
May 23 2015 19:32
yep. I would like to add some interquartile ranges to my calculations to accommodate the same thing
diabeticgonewild
@diabeticgonewild
May 23 2015 19:32
easy peasy
so all you do for like the +20% one, is add 20% to the values for the Glucose infusion rate graph
Matthias Granberry
@mgranberry
May 23 2015 19:34
it drives you crazy that 10-20% is the best you can hope to do even with perfect conditions
how is the error distributed? It isn't necessarily that simple in the real world.
diabeticgonewild
@diabeticgonewild
May 23 2015 19:35
yeah, that's why I want to go all out in my work
I'm trying to find the paper that said 10-20% error in insulin levels or whatever it was
Matthias Granberry
@mgranberry
May 23 2015 19:36
I've seen similar figures in medical literature. Liver/subcutaneous insulinase action etc all play a part
diabeticgonewild
@diabeticgonewild
May 23 2015 19:36
CONCLUSIONS: The metabolic effect of soluble insulin shows an intraindividual variability of 10-20% in healthy volunteers, even under strictly controlled experimental conditions. The overall variability of action of insulin aspart was comparable to that of soluble insulin.
So that would be glucose infusion rate pharmacodynamics, not pharmcokinetics
so like glucose uptake
Matthias Granberry
@mgranberry
May 23 2015 19:37
My own experience shows that it's probably closer to 10-35% depending on the day, but that's probably just real-world stress or site issues creeping in.
diabeticgonewild
@diabeticgonewild
May 23 2015 19:37
so make like +20% curve and increase the glucose infusion rate by 20 percent
make an equation, like that monochromatic one that you recommended
and then basically do that function with the integral with it
and then the variation is covered for in IOB, or propagated or whatever...
technically not propagated
but it represents the effects of glucose uptake
Matthias Granberry
@mgranberry
May 23 2015 19:39
you mean a monotone (monotonicity is the unchanging positive/negative state throughout a range) cubic interpolation?
diabeticgonewild
@diabeticgonewild
May 23 2015 19:40
correct. Yeah I kind of forgot it, but I was going to look it up and I am taking your word for it being the proper function for fitting
Matthias Granberry
@mgranberry
May 23 2015 19:41
the only reason I suggest monotonicity is that you can then use it for calculating expected glucose infusion rate. If your function is non-monotonic, then you would potentially see periods of negative glucose infusion over short periods
diabeticgonewild
@diabeticgonewild
May 23 2015 19:41
so like the derivative, you mean....
Matthias Granberry
@mgranberry
May 23 2015 19:42
yes
diabeticgonewild
@diabeticgonewild
May 23 2015 19:42
Very nice. I wouldn't had thought of that. I never really formally encountered monotonicity...
Matthias Granberry
@mgranberry
May 23 2015 19:42
^--- took lots of applied math in school
diabeticgonewild
@diabeticgonewild
May 23 2015 19:42
And there is lots and lots you can do with that particular derivative, given how well you have your parameters set up
like CHO intake, stuff like that
the inputs...
Matthias Granberry
@mgranberry
May 23 2015 19:45
the error bands make it difficult for me to extract much from my own data, but I play pretty fast/loose with a lot of my dosing, preferring a fix-it-later approach and frequently monitoring trend lines.
diabeticgonewild
@diabeticgonewild
May 23 2015 19:56
yeah, same...but I can't really babysit my diabetes. I suck at self-care! Too much garbage going on, that's why I am going for OpenAPS and eventually VirtualPancreas whenever I feel well enough to get overwhelmed...
Toby Canning
@TC2013
May 23 2015 20:01
Yes, I really like Walsh's work too, but have found the same issue with his views (which are dogmatic) on DIA. I think when you factor the amount of CHO being eaten in, his research makes sense. My son eats three 20-40g and one 60g CHO meals and even on the 60g CHO he is only pushing 4 hours DIA. Now, if he eats 80+g CHO meals, sure the DIA easily gets into the 5+ hour range.
Whoops, wrong channel
diabeticgonewild
@diabeticgonewild
May 23 2015 20:02
Yeah, well it can be adjusted, and the derivative of the IOB function can calculate glucose infusion rate, and that can be used for all kinds of things related to glucose...lots of possibilities
This message was deleted
you could even initially calculate the expected displacement/rise in glucose due to carbohydrate ingestion, and determine how much of that has been affected so far, how much of it was predicted to according to the IOB function, and the error between the two...like the possibilities are endless
Matthias Granberry
@mgranberry
May 23 2015 20:05
@TC2013 Walsh is doing his damnedest to avoid hypos, which is noble, but I feel like crap when I run as high as he seems to want to run people. I'll take a few dips lower to avoid that. To be honest, I use a few different profiles that are the same in everything except DIA on my t:slim to manage the mega-doses. It records the DIA that it uses at the end of a bolus, so you can mix and match a bit to make it work out.
Toby Canning
@TC2013
May 23 2015 20:06
We are doing something similar with our OpenAPS design.
diabeticgonewild
@diabeticgonewild
May 23 2015 20:06
and you can make a BG prediction function out of the derivative of the IOB function, with the glucose infusion rate (which is the derivative), if you fit it all to a piecewise monotonic function...
and you can make a modified IOB function based off of those calculations, etc, etc
Matthias Granberry
@mgranberry
May 23 2015 20:07
that's essentially what Dana/Scott have done, although they started with an action "curve" (2 straight lines) and they integrated it to give the IOB
Toby Canning
@TC2013
May 23 2015 20:09
I think we have settled on carb absorption rate: low, medium, high (CAR 30, 35, 40) and DIA (based on carb amount of 3, 4, 5 hour) low, medium and high. Then the pump boluses and adjusts accordingly.
diabeticgonewild
@diabeticgonewild
May 23 2015 20:09
yeah. I'm going to use that paper @bewest referenced when I was PMSing and being a you know what for that...this particular work is for nightscout and for fun mostly...kind of. I think there is some fear of using curves fitted by pumps due to IP concerns, but I wouldn't be worried. It's just there to play around with as far as I'm concerned
that sounds reasonable
Toby Canning
@TC2013
May 23 2015 20:10
I don't think there is that fear
Matthias Granberry
@mgranberry
May 23 2015 20:10
@diabeticgonewild it's hard to protect math, so that's probably not a real fear
diabeticgonewild
@diabeticgonewild
May 23 2015 20:10
Well, IDK. I really don't. But there were some concerns about that.
Yeah, I mean, sitting in front of a pump for 5 hours producing 61 data points and fitting the data.
Toby Canning
@TC2013
May 23 2015 20:12
I did the same, LOL!
Matthias Granberry
@mgranberry
May 23 2015 20:12
@TC2013 What you're doing with respect to CARs and DIA works really well for me.
diabeticgonewild
@diabeticgonewild
May 23 2015 20:12
Next time I know to use a piecewise monotonic Hermetian or whatever function so the derivative is always positive so the glucose infusion rate can be used nicely...Actually I should update the pump functions...That's pretty easy...just coding in front of a computer and not that taxing on the brain. I really should do that after I take care of the Ubuntu image for the visually impaired users today...
Toby Canning
@TC2013
May 23 2015 20:12
@mgranberry good to know!
Matthias Granberry
@mgranberry
May 23 2015 20:12
I guess I'm lazy. I air-bolused in the middle of the night and looked at pump logs :)
Toby Canning
@TC2013
May 23 2015 20:12
If you ever get around to writing up some tips, let us know
Our son has done that many times!
diabeticgonewild
@diabeticgonewild
May 23 2015 20:13
the ideas are endless, you can go wild if you put your mind to it
it's basic calculus applied....
Toby Canning
@TC2013
May 23 2015 20:13
Or started to bolus and forgot the last button push!
Pete Schwamb
@ps2
May 23 2015 20:14
@TC2013 gah, done that too many times.
Matthias Granberry
@mgranberry
May 23 2015 20:14
oh, no. I was saying that to get the IOB numbers I just squirted insulin into the air and watched the data output by the pump in its logs.
Toby Canning
@TC2013
May 23 2015 20:14
Hey Pete! Thanks for the repos!
Matthias Granberry
@mgranberry
May 23 2015 20:14
it dumps that info with every basal rate infusion
Toby Canning
@TC2013
May 23 2015 20:14
or repo sharing
Pete Schwamb
@ps2
May 23 2015 20:14
Sure; we’re switching back to medtronic, so it makes sense for me to work on this project more.
Toby Canning
@TC2013
May 23 2015 20:15
Are the new sensors out here?
Matthias Granberry
@mgranberry
May 23 2015 20:16
@TC2013 yeah. I need to open some stuff up. I just don't want anyone to do something stupid with it and hurt themselves. I'm not the most careful developer when playing with numbers because I know what "looks" wrong and there are some assumptions that I make. It's hard polishing these things for real-world users with vastly different control styles
Toby Canning
@TC2013
May 23 2015 20:16
@mgranberry Understood
Pete Schwamb
@ps2
May 23 2015 20:17
No, but I don’t feel like the dexcom has lived up to the hype. I can’t believe how often it drops data (and doesn’t back fill!). I have a list of gripes, and the accuracy seems roughly equivalent for us.
diabeticgonewild
@diabeticgonewild
May 23 2015 20:17
Mine doesn't
Matthias Granberry
@mgranberry
May 23 2015 20:17
I'm putting a lot of it into my auto-logging app, which I'm trying to get out for public consumption in the next couple weeks.
Toby Canning
@TC2013
May 23 2015 20:17
How long did you use for?
Pete Schwamb
@ps2
May 23 2015 20:18
A bit over two months, I think.
Matthias Granberry
@mgranberry
May 23 2015 20:18
@ps2 I'm with Monica. I calibrate whenever I'm on a long flat line (max 2x/day) and try to get a high in every 4 or so calibrations and I am rarely more than 5-10% off unless I'm moving rapidly.
and the dropped numbers are mostly where I have the receiver located
I try not to cover it with a baby and usually I'm good.
Pete Schwamb
@ps2
May 23 2015 20:19
Right, but with an active girl, it’s really hard to keep her close to the receiver all the time.
Toby Canning
@TC2013
May 23 2015 20:19
Could you have a bad transmitter or something interferring in that tx range?
Pete Schwamb
@ps2
May 23 2015 20:19
Having the pump be the receiver is a nice solution.
Matthias Granberry
@mgranberry
May 23 2015 20:19
SPI belts are wonderful
diabeticgonewild
@diabeticgonewild
May 23 2015 20:19
sounds like a bad transmitter to me
Pete Schwamb
@ps2
May 23 2015 20:20
She’s a small girl, and very active; trying to avoid her having to carry another device.
Toby Canning
@TC2013
May 23 2015 20:20
Me too. Let me go take a picture of this morning when our child was on a soccer field (12 year old size field so not regulation)
Matthias Granberry
@mgranberry
May 23 2015 20:20
I cram my pump and receiver in one and forget about it.
Toby Canning
@TC2013
May 23 2015 20:20
Even then we picked up from 30-50 yards line of sight
diabeticgonewild
@diabeticgonewild
May 23 2015 20:20
If it's off, I actually heard this from the NS group, but you recalibrate 3 times at 15 minute intervals when your blood sugar isn't changing much (no food or IOB) over a 30 minute time period
problem solved
works every time
Pete Schwamb
@ps2
May 23 2015 20:21
I think the accuracy is fine (when I get data). But I also felt the enlite accuracy was fine.
Matthias Granberry
@mgranberry
May 23 2015 20:21
usually that's helpful if you calibrated with a bad value. The receiver only keeps 6 records for its regression.
diabeticgonewild
@diabeticgonewild
May 23 2015 20:21
Yeah on the 7+ I had a 85-90% sensor failure rate. I think I had a bad transmitter but they never replaced it. So, I went without a CGM for years.
Toby Canning
@TC2013
May 23 2015 20:22
Yes, I like the enlite accuracy too, except for lows
Both are problematic there
diabeticgonewild
@diabeticgonewild
May 23 2015 20:22
Enlite drops off ISIG significantly like clockwork at 3 days...that's a major problem. And I don't calibrate like I'm supposed to.
Matthias Granberry
@mgranberry
May 23 2015 20:22
maybe that's just a child/adult mindfulness issue. It's really all a matter of finding what works.
Pete Schwamb
@ps2
May 23 2015 20:22
The thing I have a hard time with on medtronic is the alerts.
Toby Canning
@TC2013
May 23 2015 20:22
NightScout to the rescue then!
Wait you built your own fix!
diabeticgonewild
@diabeticgonewild
May 23 2015 20:23
Like I can't deal with things already. Have a ton of medical problems. I'm not going to be babysitting a medical device that has to be calibrated every 12 hours like clockwork.
Toby Canning
@TC2013
May 23 2015 20:23
Okay, gotta run. Take care all.
Pete Schwamb
@ps2
May 23 2015 20:23
Yes, I hadn’t done alerts yet; NS is so far ahead of my server side stuff at this point, that I need to switch my device to use it for the back end.
diabeticgonewild
@diabeticgonewild
May 23 2015 20:23
you too :D
Pete Schwamb
@ps2
May 23 2015 20:23
later!
Matthias Granberry
@mgranberry
May 23 2015 20:24
I love this community :) It's been fantastic seeing all the annoyances killed by a few motivated people.
I got my first thank-you email for fixing a bug on an open-source project today (in about 15 years of activity), too, so it appears that some of the work is helping other people too.
diabeticgonewild
@diabeticgonewild
May 23 2015 20:26
that's awesome and kind!
Pete Schwamb
@ps2
May 23 2015 20:29
ordered a kids spibelt. hadn’t heard of them before.
Matthias Granberry
@mgranberry
May 23 2015 20:54
I also have one of the extra pockets that I use when I want to carry a meter and glucose tabs
they have a diabetic spibelt option that has an insulin pump passthrough button hole
Pete Schwamb
@ps2
May 23 2015 20:54
yeah, that’s the one I ordered
Matthias Granberry
@mgranberry
May 23 2015 20:56
it's the only thing I've ever found that reliably holds insulin pumps while I'm running, too. I used to lose more infusion sets than i'd like to admit while running, but not any more.
@diabeticgonewild how often do you end up taking a 0.2 U/KG dose? That seems like an awful lot of insulin to me. I'd only do that with a big fast food meal or mexican dinner.
diabeticgonewild
@diabeticgonewild
May 23 2015 21:19
it's the only way to cover for basal suppression.
I'm not that much of a fatty so not that often...
diabeticgonewild
@diabeticgonewild
May 23 2015 21:36
hey @bewest I used PyPi to install openaps and I tried openaps init myopenaps and it wouldn't return anything and it doesn't create a directory
I am pretty sure it installed
The OpenAPS tools....can anyone help me? I am creating an image of ubuntu with all of this stuff preinstalled for the visually impaired only
Matthias Granberry
@mgranberry
May 23 2015 21:46
is git installed? And does openaps depend on git or is it using a python lib?
Ben West
@bewest
May 23 2015 21:46
yes, both
no error?
diabeticgonewild
@diabeticgonewild
May 23 2015 21:48
no error
photo.jpg
afterwards I did ls and no myopenaps dir
even if I go to the main directory it doesn't matter
trying to install via GitHub but I am SSHing and it's a pain...
Ben West
@bewest
May 23 2015 22:50
the init command is what creates the directory, not the install command
diabeticgonewild
@diabeticgonewild
May 23 2015 22:55
I know...it looked like it was installed. But now I am reinstalling it another way. It has to do with SSH and SSH keys...it's a super pain to deal with
but I think I got it to install. But I feel like crap...story of my life
It's currently installing
Ben West
@bewest
May 23 2015 23:29
you can use https links instead of ssh links
eg https://github.com/openaps/openaps.git can replace anywhere you see git@github:openaps/openaps.git
diabeticgonewild
@diabeticgonewild
May 23 2015 23:41
oh, well I got it loaded...currently uploading an ubuntu image with openaps, a WiFi driver installed, and decoding-bayer installed for the visually impaired users. Super excited.
They seriously are super excited about this. The two people I have been in contact with. They are super enthusiastic and happy to hear about this option.
Ben West
@bewest
May 23 2015 23:42
decoding-bayer doesn't do anything
diabeticgonewild
@diabeticgonewild
May 23 2015 23:42
So like WiFi can be installed via a single command unless the SSID isn't being broadcasted
I know, but it's there
it's a start
Ben West
@bewest
May 23 2015 23:42
most of the decoding-foo projects are just for note-taking
decocare got carried away, hahaha
diabeticgonewild
@diabeticgonewild
May 23 2015 23:43
oh
well I went wild
but they will be happy
Ben West
@bewest
May 23 2015 23:43
openaps installs decocare and dexcom_reader automatically now, so it should be easier going forward
diabeticgonewild
@diabeticgonewild
May 23 2015 23:44
I verified that everything worked, so all they have to do is SSH with an ethernet cable connected to the computer and the Pi
and use the screenreader on the computer (Windows, Mac) or an iPhone
but they need to be able to read off the Bayer Contour Link meter....not trying to be bossy but it's useful for them. It's really the only accessible solution that they really have.
but thank you so much for doing this @bewest . They are so happy!