Thursday, December 8, 2016

Pebble...

Been kind of done with the blog thing.  Reached my destination and all that.  And then...

Shouldn't be too surprised, did a year on Metawatch and 2 years on Pebble.  Now, looks like I need to find the next watch.

Although, no great rush.  Hoping to buy another Round at fire sale prices.  I can push my app changes directly to the watch from my Mac, note to self: test that process since it's been over a year.

Future platform, probably Android Wear.  Almost bought a Moto 360 sport last night, but the battery life on all of these watches is junk.  When using a watch as a CGMS, it's always working.  I can't leave it in a charger all night.  Really need 24+ hours of battery life, that means I can charge it for an hour once a day (say while reading before I fall asleep).  Anything less than that means having to charge multiple times a day, which is unacceptable, at least while I have another option.

Waiting for the next generation of Android Wear wearables at this point.

Saturday, May 14, 2016

Smartstrap Debugging



It's getting near to a year on the transmitter, so I needed to get my battery levels to the watch, where I can keep an eye on it.  The current plan is to add a battery to an old "thick" transmitter that I have saved.  This will give me a backup, while I try to change the batteries in my current "thin" transmitter.  There are some excellent tutorials out there, so expect to hear something about that over the next few months.  Currently the battery is at 0xD6.

Meanwhile, I needed to get the battery levels to the watch.  This didn't go smoothly, and I was frustrated by the lack of debugging information since I'm bound directly to the watch, so cloud pebble can't help me.  A while back I looked into the smartstrap functionality, but for day to day use, the amount of hardware would be bulky, and the connector looked problematic, and the parts are extremely small.  I went as far as having shapeways print the connector for me, but it didn't come out right.  Anyway, I realized this would be perfect for debugging.  So, above, you see a Teensy 3.1, a WT12 bluetooth module and a Wixel.  Took 2 days to get all this working, but I now have battery levels, and a way to see what's going on in the watch.

I also want to get the Pebble pairing code onto the Wixel, which would allow me to re-pair or add another watch to the module I carry, without hooking jumpers to everything and wiring up a Teensy when I need it.

The Pebble round is working great after some of the initial horrors.  Earlier, the Pebble update process was problematic, one update blew away my pairing to the WT12.  Also, the watch is stable now.  No guarantees, but I'm not seeing app restarts any longer, and I've got the calibration persisting.  It still appears possible to lose it, at least on my Pebble Time, possibly when bad code causes the app to crash outright.  Life on the bleeding edge, I can deal.

Another interesting feature, at least with the Round, the WT12 is paired using bluetooth, but the BLE channel is still accessible.  One day, I noticed by accident that the Pebble was still able to show me the Weather and Sunrise/Sunset day summary.  I should be able to pair the BLE Mini with the watch and maybe push glucose values to it.  Would allow me to store readings someplace (if I felt the need...), I add a custom alert device to really wake me up at night, the vibration on the Round doesn't wake me up as quickly as I'd like.  My other thought is changing the Pebble app to require a double tap to stop alerts.  I'll probably add this first, then do the hardware thing some rainy day.

Finally, thought I'd include a picture of the current device.  Similar to the part mockup in an earlier post.
This time, I used a small amount of hot glue to put the parts onto a piece of paper, then wired everything point to point.  This avoids the added thickness of a PCB.  If I do it again, I'll use smaller wires.  Also the "dead bugged" WT12 doesn't appear to interfere with the Wixel, which was a happy surprise.



Update:  Be careful when updating the Round with new code.  If it doesn't show you a status bar indicating an app is being loaded, it's not actually loading it.  Cloud Pebble will report the installation as successful.  From the Pebble app, you may see your application in the unsupported apps's category.  Remove it, then redeploy.

Friday, March 11, 2016

Smallest device with the smallest watch

I've always wanted the Analog watchface, probably why I put up with my ugly display for as long as I did.  Now with the the Pebble round, seemed appropriate to spend the time and get the Analog face working.


The 3'oclock position shows estimated time until 80/180.  Under the date will be the missed signal (!) and funny data(???) indicators.  12'oclock is the slope of the glucose readings followed by the Calibration slope.  9'oclock is Glucose.
The round pairs better with the Blugiga radio than it does with my iPhone, good thing.  It seems the best way to get paired to upgrade the App, is to reboot the watch.  Strange.

Still need to design and print a charger base.  Good day today, the 3d printer is working!

Here's a better picture with more indicators in use.


Monday, March 7, 2016

Bluegiga WT12 Controls all Pebbles

Did some searching and found a bluetooth chip that does SSP Master, which is used by all the pebbles.  My existing code still works, just the initial configuration of the board (which you can do through serial) is different.

SET BT PAIR *
SET BT AUTH * 0000
SET BT SSP 3 0
SET BT POWER 0 0 0
CALL b0:b4:48:9d:cc:08 1101 RFCOMM
SET CONTROL AUTOCALL 1101 5000 RFCOMM

This configures the board to connect and automatically reconnect to a watch.  Power=0, gets translated to -2, which is still enough power to cover my house.  Once paired with the watch and the Wixel in sleep, it's around 5ma.  With the Wixel actively listening it's approx 27ma.  When the Bluetooth module receives data it's 35ma.  Generally you're running at 5ma, the higher numbers are for a few seconds every 5 minutes.  The pebble appears to be "chatty", so you see frequent 35ma bursts, this may be an issue, but I think I can get 20 hours out of a 110 mAh battery.

I'll probably make this over the weekend:

That's the WT12 "dead bugged" on top of the Wixel.  Curious to see if I can get away with that.

Allot of useful information here: http://www.keyglove.net/2011/03/24/bluegiga-wt12-bluetooth-module-connection/ , this guy also sells a development board for the WT12 which makes it breadboard friendly.

Friday, February 26, 2016

More BLE Central

I would still like a "Band"...  I really can't wear the watch when doing hand to hand stuff etc.  A band is a little easier to get away with, and less likely to hurt someone.

A few weeks ago I stumbled on some posts for the Xiomi MI, band.  Cheap thing $30, Amazon gets it to me in 2 days.  I found websites that detailed how to communicate with it from a BLE Central device, so I thought cool, I'll get one.  Impulse buy.

This was the perfect use for my BLE Nano.  I already had some BLE Central code written that worked for communicating with the RFDuino.  Of course, this wouldn't work...
After about 8 hours, it came down to a parameter change on the connect, ex.

ble.gap().connect(params->peerAddr,  Gap::ADDR_TYPE_PUBLIC, NULL, NULL);

My original code had a random address type.  This was quite maddening because I could connect with the MI from both Unix and my iPhone using "LightBlue".  

It wasn't until I connected that I realized the communication protocol's for the MI had changed. 
The current protocol is actually more standardized.  All alerts (buzzing) are through a standard BLE endpoint for "Immediate Alert".   LED control, not so much, I now realize LED control isn't exposed to an external device.  My plan had been to use the 3 led's as a sort of traffic light, or:
- led 1 = >200mg/dl
- led 2 = >100mg/dl
- led 3 = blink out the 10's every minute or so.

Or something like that, coupled with buzzing to queue me in on what's going on.  
If you look around for posts on the MI, you'll see the lights don't really work anyway.  They're triggered by an accelerometer that only responds to some bizarre form of hand waving, I got them to light up once or twice, the motion required being way to ridiculous for public presentation.

That said, could be an excellent vibrating alert device that can go a month on a charge.

Some other notes from this experience:
1. The BLE Nano (with MBED) doesn't really work with Windows 10, unless you're comfortable restarting windows frequently.  The Arduino version may be fine, I have one of each, but I have issues with BLE Central on the Arduino version.  In the end, I moved my development over to the Mac.  Additionally, opening and closing serial windows and dragging/dropping hex files is a PIA.  I was able to automate this to some extent with the Mac, one of the reasons I purchased a Mac, nice to finally put that to use.  See my github for a basic script.  In a nutshell, it's a ksh that watches the download folder for a hex file, moves it to the Nano, and launches a serial window.

2.  I don't think BLE sniffing is all it's cracked up to be.  I have an Ubertooth and a Nordic device and can hook them up to Wireshark.  With an RFduino I can see all the "Magic" packets (ATT etc).  With more proprietary devices like the MI or the Pebble, once these things pair, I don't see anything.  If you want to hack a BLE device, decompile the Android APK if one is available.

On to the Pebble watch.  Still going strong.  Found out from Pebble support that the aplite versions of the pebble support "Pin" pairing via bluetooth.  The new models only support ssp (simple secure protocol).  They also pointed out the mfg'r note for nRF51, which indicates that while ssp is in the command set, it doesn't actually work.  Allegedly there's a beta that will support ssp, and will pair with the Pebble Time.  Wait and see.  





Wednesday, January 13, 2016

New year, new device



Finally got most of the kinks worked out of the Pebble as CGMS project.  Above is the device with it's charging stand.  Completely removed the phone component.  Added all the calibration functionality to my pebble.  Some screen shots from the emulator:



For calibration values, you can choose 80-190 in 10 mg/dl steps.  I also added a 15 minute snooze for alarms.  Entering anything is a two step process to avoid issues with accidentally pushing the buttons.  This will probably see more work, but for now, you click an action then scroll back to the top and choose Enter.  Finally broke my watch code up into libraries, much happier with it now, and it's easier to maintain.  Maybe I'll let my iOS developer license lapse now.  I really dislike xCode, I spend more time proving to it that I'm an authorized developer, than I do coding.

For the circuit, I realized I was better off with the Wixel, since it handles running it's radio and a 115k Serial connection.  Almost no room for a program on the Wixel, but I only had to cram in a function to blast out 2 packets to the pebble every 5 minutes.

A picture of the packed circuit board:


I'm very happy with this.  I no longer have to keep track of the phone.  Also both the boards I'm using are pretty awesome at their jobs.  The Bluetooth board easily covers the house, and pairing is automatic, handled by firmware.  No more disconnects from blocking the device.  The Wixel is also much better at pulling in signals than my CC2500 devices.

I did the PCB on a CNC router this time.  Just barely worked, luckily this is a simple circuit.  I should be able to do better on the next PCB I route.



One downside for now, is I can only get the Classic Pebble and Pebble Steel to pair.  There is something different with the Pebble Time and what it expects for Pairing.  There are quite a few parameters for the RN41 so I have a few other options to explore.  On the upside, while the Classic is fairly ugly, it has nearly a 5 day battery life.