Software apps and online services
I have a bunch of different diabetes devices, from blood glucose meters to insulin pumps, that I want to connect to my Pixl.js so that I can display the data on its screen. A year ago there was a request for proposed Arduino shields to add to Pixl.js and I suggested adding a USB host shield. The official Arduino USB host shield uses the ICSP header, so that wouldn't work, but it looked like the SparkFun one just might.
I first attempted to write a driver for the TI USB3410 chip, and failed miserably, as this chip requires you to first upload firmware into it before using it. Around a month later (26 July 2018) I finally had something working with the Silicon Labs CP2102 chip. Then life got in the way and I completely stopped working on the project. By now posting this to Hackster.io I hope that others will get use out of the code and write drivers for other USB serial chips as well.
The current code sets up the USB stack, connects to the device, retrieves the device descriptor and prints the vendor ID and product ID to the screen. It also reads the config descriptor.
It then initialises the CP2102 chip and sends the message
02 08 00 04 06 03 78 C1
This message is specific to the Verio IQ blood glucose meter that I connected to the shield. The message consists of the STX control character (0x02), packet length (0x08), link control mask (0x00), read header command (0x0406), ETX control character (0x03) and a two-byte checksum 0x78C1). Lo and behold, the device responded with
7D 02 22 00 04 06 56 65 72 69 6F 49 51 00 00 00 00 00 EC EF 6C 0C 04 EF 6C 0C F9 58 F1 79 1A 00 03 65 4B
which is the requested header. If you look at the 7th to 13th byte, you may notice that it's "VerioIQ" in ASCII.
The SparkFun USB host shield does not come with headers, so you have to buy these separately and solder them on. You can then just plug the shield into the Pixl.js. You may need to put a jumper between D7 and the RESET pin. That's it!
I kept a journal on my blog during development, and here are the posts in series: