Monthly Archives: June 2015

Remote Blood Sugar Monitoring

With Samantha about to start in the competitive gymnastics program, we really needed to have a better way to monitor her blood sugar.  In the recreational program which she has been a part of until now, Cynthia or I would sit in the waiting room.  She would stop by and let us test her if she felt low.  With the activity, she did tend to drop during her gymnastics classes.

But for the competitive program, the coaches really do not want the parents sitting in the waiting area and potentially distracting the girls.  I am sure they would make an exception for us but we wanted to give Samantha some more space.  At the same time, we knew that gymnastics was one of those times that her blood sugar needed to be watched closely.

We decided to get a continuous glucose monitor for Samantha.  There is a sensor which is inserted into her skin and replaced every several days.  A transmitter sits on top of the sensor and send the readings every five minutes to a receiver wirelessly.  The receiver has a screen and you can look at recent readings and trend arrows that tell you how her sugar is changing.

The receiver needs to be within about 20 feet or so though.  To make the next jump, we used something called NightScout.  NightScout is a project by several people online to piece together a way to monitor blood sugar remotely.  You connect the receiver to a cell phone using a USB cable.  The cell phone runs a special app which reads the blood sugar readings from the receiver and sends them out to a database you setup on the Internet.  You also setup a web server on the Internet which reads the database and presents the readings to a web browser.  Then, there are apps for the iPhone and other devices which display the data.

The NightScout setup instructions describe how to setup a database and a web server on two different hosting platforms.  Initially, I setup services on these other hosting platforms.  I did this so I could at least test everything and ensure it was all working.  Easiest to follow the instructions exactly the first time.  Once I saw how it actually worked, I was ready to do it my way.

I have had my web hosting with Dreamhost for years and I really didn’t want to suddenly use a bunch of other services.  First, I needed to move my existing web sites (including this one) from their shared servers to a VPS (virtual private server).  The web server for NightScout is node.js based and will not work from a shared server.  Dreamhost moved my existing websites to the VPS without a hitch.

Next, I setup the NightScout database on my new VPS.  I redirected the cell phone to send the readings to my new database and sure enough, I started getting data.  I changed the web server (still at the non-Dreamhost server) to get its data from my VPS hosted database and that worked.  Now I needed to move the web server.

I grabbed a copy of the Javascript source for the node.js server and poked around for bit.  The instructions have you use these other hosting services partly because they are cheap but also they have nice interfaces for configuring everything.  I was working from a command line into my VPS and trying to figure out how to configure things.  When the instructions said to set a field in a form to X, what do I need to do in order to accomplish the same thing.

After browsing the code for the server a bit, I wrote a simple script to setup some config options and launch the server.  After a couple of tries, I got the script right and the server started working.

With that up, I changed Cynthia’s and my phone to pull data from the server running on our VPS.  I decommissioned the services I setup with the other providers.  The entire solution was now running through a VPS I managed.  I wrote a backup script to make sure all of this configuration was backed up every night.  The backups go back to our computer at home.

We even bought a Pebble watch for Cynthia which lets you have the blood sugar readings right on the screen of the watch.  So, here is the sequence of events to get blood sugar readings to us:

  1. The sensor takes a blood sugar reading.
  2. The transmitted connected to the sensor sends that reading to the CGM receiver wirelessly.
  3. The cell phone pulls that reading from the CGM receiver through a short USB cable.
  4. The cell phone uploads the reading to the database running in our VPS.
  5. The web server on our VPS provides that reading and all other data to any client which requests it.
  6. Our iPhones have apps on them which will communicate with the web server on the VPS and display the blood sugar values and trends in real time.

The only requirement is that the receiver/cell phone stay within about 20 feet of Samantha and that the cell phone has a good Wifi or cell signal so it can upload the data.  This will be how we give Samantha more independence while also continue to be able to manage her blood sugar.

Samantha’s Activities

Samantha is a busy girl.  She has been doing gymnastics for the last few months in a recreational program.  She had visions of joining their competitive gymnastics program but that is by invitation only.

Cynthia and I encouraged her to work hard.  We told her that if she focused, listened to the coach and tried her best, she would have her best chance to join the competitive program.

Sure enough, a month or so ago, she was asked to try out for competitive gymnastics and we found out recently that she was accepted.  That means starting after the summer, she will go to practices a couple times a week instead of just once.  And she may be going to gymnastics meets next year.

Not content to wait for that, Samantha asked if she could play soccer this summer.  We were late to register her but she was lucky they had room for her.  So, every week, she plays soccer at a field very close to home.

Gymnastics and soccer are her favorite sporty activities these days but swimming in our pool will probably be up there also as soon as the temperatures go up a bit more.

Misty Jumps!

We have adopted a second cat for the last few months.  Her name is Misty.  She may be smaller than Joey, but she bosses him around.

Today, we found her trying to catch a bug on the other side of the patio doors and grabbed some video.  Check it out.

Infiniti Q50

I bought a new car.  And not just new to me.  An actual, for real, new car.

When we moved to California, we had to buy cars for both Cynthia and I.  Importing our existing vehicles was more trouble than it was worth.  We both bought used cars.  Cynthia got a 2007 Toyota Matrix and I got a 2005 Infiniti G35.

I have always been happy with the G35 but it was now ten years old and it was time for something new.  That something new was the Infiniti Q50.  It is essentially the successor of the G35 I was driving but in some ways, it is an entirely new car.

The Q50 has “drive by wire”.  The steering wheel has a mechanical connection to the wheel but that is a backup.  With the Q50, when you turn the steering wheel, software responds to that and makes the appropriate change to the direction of the front tires.  Feedback goes both ways so you still get a feel for the car through corners.  This also allows you to select the kind of handling you want.  Do you want loose casual handling?  Do you want tight control in “sport mode”?

It has a pile of safety features.  It has blind spot detection so small lights on either side come on if there is a vehicle in a blind spot.  If you try to turn towards a car which is in your blind spot, it sends an audible alarm.  It will even take temporary control and stop you from steering into the other car.  Again, because it is “drive by wire”, it can do these kinds of things in software.  The Q50 even tries to detect the lanes and it will warn you if you are drifting out of your lane.  Again, if you ignore the alert, it will take over and put you back in your lane.

The Q50 is monitoring the distance between you and the car in front of you.  If that car brakes quickly, the Q50 will brake for you in order to try to avoid an accident.  Even more, the Q50 is monitoring the distance between the car in front of you and the next one ahead.  If the car in front of you is closing quickly on the next car, then chances are the driver ahead of you is going to slam on the brakes.  Again, the Q50 will brake preemptively.  I have seen this come on at times and it feels strange to suddenly be slowing when maybe you still have your foot on the gas.  But there is evidence that features like this really do reduce the chance of collisions, so I am willing to put up with that odd feeling the very few times it happens.

But the feature I like the most is the adaptive cruise control.  We drove to Toronto recently and it was my first chance to really try it.  Basically, you set a target speed and the Q50 tries to go that fast.  But if you are approaching someone going slower, the car automatically slows down to keep a safe distance.  You have some control over what that safe distance is.  I think I took cruise control off three times in the whole trip to Toronto.  I had cruise control on through Toronto highway traffic!  As you approach someone going slower, you just signal and switch to the right lane.  The Q50 detects that the lane is clear and goes back to the target speed.  No need to turn off cruise control.  Normally, you have to make decisions.  Can I leave cruise on?  How close will I get to this guy in front of me before I can get to the right and pass him?  And you are always tempted to get too close.  Now, I just don’t worry about it.  The car is managing my speed.  I am just making decisions about which lane to travel in and when it is safe to switch.  The stress level for the trip was definitely lower.

I am very happy with my new car.  And it is definitely an intermediate point along the way to truly self-driving cars.  I like to drive but if I could have let the car drive us to Toronto on our recent trip, I would have.