OESF Portables Forum
General Forums => Off Topic forum => Topic started by: lardman on July 30, 2004, 10:18:22 am
-
I'd like to be able to download my blood sugar readings from my meter to my Z (I'm diabetic). I have some software on the PC which can download the readings, but the Z is of course best ;-).
I hope the protocol will be fairly simple - you just hold down a button on the meter and it starts spitting out data to the PC once they've enstablished comms. It must also pass its current time as the meter can be reset if the clocks change, but that's about all it can do.
Anyway I've never tried anything like this before and was just wondering how to go about it?
I presume some tools like LIRC, xmode2 will be required, I have an IR serial adaptor.
Any suggestions gladly accepted. I'll be doing the development work on a desktop Linux box for the most part - though I may need to use the Z to record the PC's part of the conversation (as I dual boot Windows & Linux at home).
Cheers,
Si
-
Lardman, since you have the IR serial adaptor, rather than trying to understand the IR signal itself, a better plan of attack might be to use a packet sniffer, such as Ethereal, and record the entire conversation over the serial channel between the meter and the PC software during normal use.
That way, you can see what the handshaking looks like between the two devices. After a couple of recorded sessions, it should be easy to pick out what is handshaking & what is data.
Good luck!
-
Good idea, are the baud rates etc. standard for IR connections or am I going to have to fiddle about to get them set correctly (actually are they even the same type of settings as a standard serial connection - I assume so).
Si
-
If the device is outputting IRDA serial data, you're in luck - just load up minicom on your Zaurus, set it to /dev/ttyS2 (SL5500) or /dev/ttyS1 (SL5600 and more recent clamshells), and you can fiddle with the baud rates to find a setting that get's you a stable, repeatable data stream....
Don't use LIRC if the device is doing IRDA serial data as it won't handle it.
The Pocketop keyboard sends IRDA serial data (that's how IRK works....).
-
Lardman -
My wife saw your post and you peaked her interest she's diabetic also. Yes she has a Z but for some reason won't participate here. Please let us know how this works out.
Thanks,
Jim
-
and you can fiddle with the baud rates to find a setting that get's you a stable, repeatable data stream....
I can run at 38400, 19200, 9600 and 4800 all with 8N1 (the only ones I've tried thus far) and always get the same stuff out (for each baud rate, different data for different baud rates).
I'm not quite sure what the data should look like, so where do I go from here?
Si
-
Try something like
cat /dev/ttyS1 | od -tx1z -Ax
to see the data stream in hex (/dev/ttyS2 if that is your IrDA port).
Try it at different baud rates.
Also if you have or can borrow an oscilliscope and ir sensor (solar cells may work) you can see the data stream.
-
How would I alter the port settings if trying to use od?
I'm currently investigating the use of a Windows driver which attaches to the serial port and can then (hopefully) grab the data going back and forth. Fingers crossed ;-)
Si
-
All looking good. I downloaded portmon from http://www.sysinternals.com (http://www.sysinternals.com)
Nice bit of (free!) software, respect to the authors.
I have captured the PC side (and this is what I want to emulate) of a couple of conversations. Time to start comparing the hex with the data I know was in the unit.
It actually looks reasonably simple:
IOCTL_SERIAL_SET_BAUD_RATE: 9600
IOCTL_SERIAL_SET_RTS
IOCTL_SERIAL_SET_DTR
IOCTL_SERIAL_SET_LINE_CONTROL: StopBits: ERROR Parity: NONE WordLength: 8
IOCTL_SERIAL_SET_CHAR: EOF:0 ERR:0 BRK:0 EVT:0 XON:11 XOFF:13
IOCTL_SERIAL_SET_HANDFLOW: Shake:1 Replace:40 XonLimit:0 XoffLimit:4096
Not sure what the StopBits: ERROR means (other than it's trying to use an illegal value - can you have no stop bit?). Any guesses?
Si
P.S. I've stuck up a web page about this: http://sgp.zaurii.net/howtos/accu-chek.html (http://sgp.zaurii.net/howtos/accu-chek.html)
Edit: This page has moved now: http://students.bath.ac.uk/enpsgp/Zaurus/accu-chek.html (http://students.bath.ac.uk/enpsgp/Zaurus/accu-chek.html)
No actual data yet, but I'll put it up there and report back here as I progress.
-
Thanks for putting up your logs...
This has to be the most incredible timing, you started this thread the day my endocrinologist gave me an Accu-Chek Compact when I asked him about it. (Gotta love the "give away the razor, rip em' off on the blades" concept that the bloodsugar meter companies adopted.)
Going through portmon logs is really unpleasant... All those *$#@)* status checks, but I eventually figured out a good deal of what's going on by looking through the log you posted. (I don't have Compass myself, nor do I even have the cable, but neither have stopped me thanks to your log.
The protocol is standard IrDA serial, 9600 8N1. If you happen to have a machine with an IrDA port (The Zaurus is a good example, I'm not a Zaurus owner myself but I do have a Dell Inspiron 8200 with an IR port that is dual-boot Linux/Win2k)., no need for Roche's $30 cable.
The protocol seems to be a mix of ASCII with the occasional nonprintable control character thrown in. Most prominent are that all commands seem to have 0x0D as a postfix, and most return strings are preceded by 0x0602 and followed by 0x0406. I have actually been able to see my bloodsugar results in plaintext returned from the meter.
I'm working on a Perl script that retrieves the readings from the meter. I'll post it after I clean it up slightly. I also need to bump up the count of readings by one so I can figure out which of the return values is indicating the number of current readings in the meter. Yours is obviously at the maximum value of 200, mine isn't (5 right now... Since I only have one drum I'm switching back and forth between my Compact and my Glucometer DEX.), and the number of readings to retrieve must be specified. (If you specify too high a value, it won't work. Appears to give some sort of error, but I have no idea if it's actually an error or what. )
Edit: Just did my evening bloodsugar test, and the number of results is returned after the "`" command is issued. Yes, one of the commands is simply "`" followed by 0x0D.
The other commands present in that log are:
C4
C 3
S 1
S 2
S 3
a 1 N - where N is the number of readings to retrieve. The command actually be
a X Y - where X is the index of the first reading to retrieve and Y is the index of the last.
The second to last printable character of EVERY return string seems to be 6.
Another last edit: For some reason you cannot send characters to the meter very fast. In my script I need to put a small sleep in between each sent character - If I send them all at once, or each in a seperate write() command without any sleep commands in between, things break.
-
Attached is a somewhat cleaned-up version of my Perl script. It's still a mess. There are a lot of print statements commented out - uncomment them to see what the meter is spewing back.
This version actually pretty-prints the results and times.
-
Great stuff! I've been a bit busy this weekend (at the rugby) so hadn't a chance to even do anything with the logs.
I'm glad they were useful and even more so that you've managed to put together a perl script in such a short time.
And there I was thinking this would be a fairly random thread, I didn't realise anyone else might actually be interested in its application :-)
Time to put Octave to work and do some data processing (once I decide just what to do with it all ;-))
Si
-
Although I'm not diabetic myself, my wife's a nurse who deals with diabetics a lot (community nursing - not sure if you have it outside the UK). Anyway, she tell's me she has a couple of these meter's in the boot of her car so I'll try to find some time to have a look at it myself as well...
-
Hello :
I am lalso a diabetic. I am also trying to download data from my meter. I have a One Touch Ultra. They have a communications spec defining control signals but there is a problem. I can talk to the meter using hyperterminal with no problem and am able to download the information. When I try with my application, I am not able to power up the meter. I used a serial port spy to see what was happening and found out that I am setting everything the same except for the following that does nto match.
I see IOCTL_SERIAL_SET_HANDFLOW with the following data.
01 00 00 80 40 00 00 80 50 00 00 00 c8 00 00 00
I do not know how to set this using the Win32 APIs. Can anyone help me solve this problem? Maybe someone out there has solved this already.
my email is peterd_330q4@yahoo.com
thanks
-peter
-
Hello :
I am lalso a diabetic. I am also trying to download data from my meter. I have a One Touch Ultra. They have a communications spec defining control signals but there is a problem. I can talk to the meter using hyperterminal with no problem and am able to download the information. When I try with my application, I am not able to power up the meter. I used a serial port spy to see what was happening and found out that I am setting everything the same except for the following that does nto match.
I see IOCTL_SERIAL_SET_HANDFLOW with the following data.
01 00 00 80 40 00 00 80 50 00 00 00 c8 00 00 00
I do not know how to set this using the Win32 APIs. Can anyone help me solve this problem? Maybe someone out there has solved this already.
my email is peterd_33014@yahoo.com
thanks
-peter
Hello :
I am lalso a diabetic. I am also trying to download data from my meter. I have a One Touch Ultra. They have a communications spec defining control signals but there is a problem. I can talk to the meter using hyperterminal with no problem and am able to download the information. When I try with my application, I am not able to power up the meter. I used a serial port spy to see what was happening and found out that I am setting everything the same except for the following that does nto match.
I see IOCTL_SERIAL_SET_HANDFLOW with the following data.
01 00 00 80 40 00 00 80 50 00 00 00 c8 00 00 00
I do not know how to set this using the Win32 APIs. Can anyone help me solve this problem? Maybe someone out there has solved this already.
my email is peterd_33014@yahoo.com
thanks
-peter
-
All looking good. I downloaded portmon from http://www.sysinternals.com (http://www.sysinternals.com)
Nice bit of (free!) software, respect to the authors.
I have captured the PC side (and this is what I want to emulate) of a couple of conversations. Time to start comparing the hex with the data I know was in the unit.
It actually looks reasonably simple:
IOCTL_SERIAL_SET_BAUD_RATE: 9600
IOCTL_SERIAL_SET_RTS
IOCTL_SERIAL_SET_DTR
IOCTL_SERIAL_SET_LINE_CONTROL: StopBits: ERROR Parity: NONE WordLength: 8
IOCTL_SERIAL_SET_CHAR: EOF:0 ERR:0 BRK:0 EVT:0 XON:11 XOFF:13
IOCTL_SERIAL_SET_HANDFLOW: Shake:1 Replace:40 XonLimit:0 XoffLimit:4096
Not sure what the StopBits: ERROR means (other than it's trying to use an illegal value - can you have no stop bit?). Any guesses?
Si
P.S. I've stuck up a web page about this: http://sgp.zaurii.net/howtos/accu-chek.html (http://sgp.zaurii.net/howtos/accu-chek.html)
No actual data yet, but I'll put it up there and report back here as I progress.
How do I make a call to this IOCTL_SERIAL_SET_HANDFLOW: without having the windows DDK? I am trying to set the values using Win32 function calls.
If you have any info please email me at peterd_33014@yahoo.com
thanks in advance.
-Peter
-
Hello,
I am from Germany and in my computer science lessons at school I want to programm a Diabetes-Management-Software with Delphi.
But there are some problems: I've downloaded a rs-232-monitor-tool for testing the communication to the hardware.
It doesn't matter which caracter I send, the meter doesn't power on and I always reseive a String: Something like a "Y".
Please take a look at the screenshot...:
http://www.basicmotion.de/sonstiges/rs232.jpg (http://www.basicmotion.de/sonstiges/rs232.jpg)
The computer communications port is set to 9600 baud, 8data bits, 1 stop bit.
What do I make wrong? Where is the problem?
I just can't find any solution :-(
So please help me,
Thanks,
Anton
antonbischof@web.de
-
Speaking of reverse engineering IR protocols, I'm thinking of getting a casio camera watch, but don't have an ir port on my pc. What's more, I tried talking to a clie by using the ir applet on pdaXrom and couldn't even get started. How difficult would that be?
http://www.i4u.com/reviews/casiowristcamerareview_i4u.htm (http://www.i4u.com/reviews/casiowristcamerareview_i4u.htm) (they're pretty cheap now on Ebay)
-
I have a copy somewhere at home, I'll find it and email you.
BTW where has it gone? It should be attached to the page.
Have all attachments vanished, or just this one?
Cheers,
Si
-
http://people.bath.ac.uk/enpsgp/Zaurus/metertest.pl (http://people.bath.ac.uk/enpsgp/Zaurus/metertest.pl)
Edit: Moved slightly, I've changed the link above to match the new location.
Si
-
I think all attachments got lost when the forms moved servers.
Can you also provide that log file again? http://sgp.zaurii.net/howtos/accu-chek.html (http://sgp.zaurii.net/howtos/accu-chek.html) is no longer a valid address. It would be really helpful to me.
Thanks!
Bob
-
http://students.bath.ac.uk/enpsgp/Zaurus/accu-chek.html (http://students.bath.ac.uk/enpsgp/Zaurus/accu-chek.html)
Si
P.S. I received an email from a chap who was interested in adding support for this meter to the KPUMPE (http://kpumpe.sourceforge.net/) Project (of which I'd never heard I must admit). It seems to be a blood sugar analysis program, and OpenSource, just what I wanted :-) (though I'm sure there'll still be a place for Octave/R analysis too ;-))
-
http://students.bath.ac.uk/enpsgp/Zaurus/accu-chek.html (http://students.bath.ac.uk/enpsgp/Zaurus/accu-chek.html)
Si
P.S. I received an email from a chap who was interested in adding support for this meter to the KPUMPE (http://kpumpe.sourceforge.net/) Project (of which I'd never heard I must admit). It seems to be a blood sugar analysis program, and OpenSource, just what I wanted :-) (though I'm sure there'll still be a place for Octave/R analysis too ;-))
[div align=\"right\"][a href=\"index.php?act=findpost&pid=65169\"][{POST_SNAPBACK}][/a][/div]
I haven't been here in a while. (BTW, I'm not a Zaurus user, this was just the only place I could find any protocol information.)
Annoying that my attachment got nuked, good thing you've mirrored it, although I'm pretty sure I still have it on my laptop. I still need to do some serious cleaning up of that script, I've just been too busy with other stuff to actually DO anything.
BTW, could you post a communications log of the Compass software setting the meters' time? I'd love to be able to add time setting functionality to my meter.
-
Will do.
Si
-
Right, here are two files which should be pretty much identical (they're not of course) except that on one the time was changed, and on the other I said no when the dialog window came up.
http://students.bath.ac.uk/enpsgp/Zaurus/P...bs_readings.zip (http://students.bath.ac.uk/enpsgp/Zaurus/Portmon_transfer_bs_readings.zip)
http://students.bath.ac.uk/enpsgp/Zaurus/P...d_date_time.zip (http://students.bath.ac.uk/enpsgp/Zaurus/Portmon_transfer_bs_readings_and_date_time.zip)
The time on the meter when it was changed was about 11:01:41, and the PC time (to which it was changed - GTM->BST) was 12:00:10 or so.
Let me know how you get on,
Si
P.S. I do wonder about releasing my blood sugar history in this way :-D. By way of an excuse for those who do look at the data, Saturday's readings were affected by my staying at a friend's house after a night out and not having much with me (no meter - makes life difficult when you go to bed very drunk and tired, and wake up the same way ;-) and then having to play it by ear (in terms of when/how much insulin to give myself) for the rest of the day (which I obviously got wrong in the end). My hba1c is still about 5% though so I can't be doing it all wrong :-).
-
Attached is a somewhat cleaned-up version of my Perl script. It's still a mess. There are a lot of print statements commented out - uncomment them to see what the meter is spewing back.
This version actually pretty-prints the results and times.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=38748\"][{POST_SNAPBACK}][/a][/div]
-
Attached is a somewhat cleaned-up version of my Perl script. It's still a mess. There are a lot of print statements commented out - uncomment them to see what the meter is spewing back.
This version actually pretty-prints the results and times.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=38748\"][{POST_SNAPBACK}][/a][/div]
-
Attached is a somewhat cleaned-up version of my Perl script. It's still a mess. There are a lot of print statements commented out - uncomment them to see what the meter is spewing back.
This version actually pretty-prints the results and times.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=38748\"][{POST_SNAPBACK}][/a][/div]
Could you please email me your perl script with a brief word on how to run it. I don't know how to run a perl script. I want to be able to download my accu-chek readings using your perl script if that is ok.
My email is mohanc@ozemail.com.au
Thanks
Mohan
-
It's on my web site.
Under Linux just make sure it's executable and run it (you ought to have perl installed by default).
Under Windows, install perl and then you can probably just double click on the file (assuming it registers a handler for the .pl extension).
Si
-
Hi guys, great stuff going on here.
One question though, about the Perl script.
Can I use my laptop's built-in IR port? I am quite certain that it resides on COM4:, but it seems that it's only activated when I put another device, like my mobile phone or my Zaurus PDA in front of the IR port/'window' on my laptop.
Do you guys know how to set it up, so that I can use it for 'normal' serial communication with a device (Accu-Chek Compact Plus meter in my case)?
I'm using (Active)Perl v5.8.8 on Windows XP.
Maybe i'd be better off when just booting Linux on my laptop; sadly I'm a Windows:P user most of the time (sorry )
[span style=\'font-size:8pt;line-height:100%\']First I couldn't get the Win32API module to work, but the solution turned out to be simple for me:
I just had to type this at the Command Prompt to completely install it from the ActivePerl site:ppm install Win32-API
Maybe someone else will be helped by this [/span]
-
Even when using a plug in serial IR adaptor, I had to install some drivers to make it use ircomm rather than irobex (that's my understanding anyway).
You might try something like this: http://www.ircomm2k.de/ (http://www.ircomm2k.de/)
Si