python-usb-wixel-xdrip
python-usb-wixel-xdrip copied to clipboard
No data for long periods
Hello, ant thank you for all your efforts with your software. Helps us a lot as family w/a 3yr old with T1D
I am having some problems getting this to work, and any help would be appreciated:
Hardware:
- Pololu Wixel (tried 2 separate wixels)
- Raspberry PI 3 Model B
- 1 x xDrip+ App running on Android x86 Computer
- 1 x xDrip+ App running on Android 5.1.1 Phone
I have followed the guide as best I can, and I get data to the xDrip applcation(s), but more often than not there is no data received. I can have data for 1h max (usually a lot less), but then it drops out for several hours, before coming back for a few readings again. It is the same readings showing on both xDrip app units
Running 'sudo screen -r wixel' I see that the xDrip apps are connected. What type of info would be usefull for debugging?
It is not a range-issue, as I did testing during evening & night w/my son sleeping 2m from the wixel. Also get some reading when he is on a different floor in the house, which indicates range is ok. Reboot of RPi doesn't fix this either. Behaviour is always the same.
Additional Info:
- I get the exact same behaviour when using the NodeMCU WiFi wixel
- Using Dexcom G4 + Animas Vibe
Okay, so we need to find out where in the chain things are breaking, where the data is failing to get passed on.. There are quite a few components here so it isn't completely simple.
If you have two devices running xDrip+ and they both show the same missed data then I think we can say that the missed data is occurring on the raspberry pi. This is a good clue.
My first question is which wixel firmware are you running? Did you use the auto-installation method as described in the How-To document? https://github.com/jamorham/python-usb-wixel-xdrip/blob/master/HOWTO.md
Yes, I did the auto-install script, and it seemed to work fine.
-
I read something about different printf-versions, but I didn't quite understand it, and since I got some data I assumed it was fine
-
I read something about the wixel restarting, and issues related to this (serial interface). I will link more info, but heading out now, so not back untill later today
(So your Wixel Firmware should be the recommended one - that is good - next questions:)
Okay, also what version of raspberry pi software did you install? Did you use NOOBS? Do you know which version? How recently it was downloaded do you think?
Can you login to the RPi and use the command uname -a and paste me the results. I am just interested in the Linux kernel version, like 4.4.11-v7+ etc. I recently had a problem with a raspberry pi3 having unreliable wifi connection until I did sudo rpi-update which installs an experimental but more recent Linux kernel which made the wifi more stable.
If it is drifting off the wireless connection then this would also stop you getting readings but I am thinking you would know as the raspberry pi would be unreachable over wifi.
Do you connect to it via WiFi or use a screen and keyboard?
EDIT: Well this is awkward.. :P After changing usb cable, it seems to be very stable. Only lose a few signals now and then (could this be avoided by changing dexdrip.c setting to constantly scanning?). Will update how the night goes. If its fine, then I guess this can be closed. ...
- I installed Raspbian;
uname -ayields:4.4.11-v7+ #888 - I connect via WiFi (ssh from linux), as it is a headless pi
- Had to follow instructions in README.txt inside 'wixel_linux' to get it compiling properly
- Had earlier considered WiFi interference, so I was using long USB cable to the wixel
- Then considered PI unable to power wixel 100%; swapped cable for a shorter one..
Message(s) when failing: It is a bit different now, compared to before swapping cable. Earlier it was reporting client thread timeout all the time. That doesn't seem to happen anymore.
Kept sending the same record to connected clients for 15 mins, but wixel was blinking yellow (searching for G4). Then it seemed to find a good signal again, and it started working:
Exception: device reports readiness to read but returned no data (device disconnected?)
Connected with 192.168.10.170:60755
{
"numberOfRecords": 2,
"version": 1
}
{"TransmitterId": "6736927", "RelativeTime": "672000", "CaptureDateTime": "1466365997000", "UploadAttempts": 0, "UploaderBatteryLife": 0, "ReceivedSignalStrength": "-88", "FilteredValue": "125584", "RawValue": "130816", "Uploaded": 0, "TransmissionId": "143", "BatteryLife": "216", "_id": 1}
Connected with 192.168.10.166:46041
{
"numberOfRecords": 2,
"version": 1
}
{"TransmitterId": "6736927", "RelativeTime": "672000", "CaptureDateTime": "1466365997000", "UploadAttempts": 0, "UploaderBatteryLife": 0, "ReceivedSignalStrength": "-88", "FilteredValue": "125584", "RawValue": "130816", "Uploaded": 0, "TransmissionId": "143", "BatteryLife": "216", "_id": 1}
Output with OK connection:
Startup
Socket created
entering serial loop - waiting for data from wixel
Waiting for connections
AT+NAMExDrip6736927 99584 97520 216 -84 111 0
Serial line: 6736927 99584 97520 216 -84 111 0
Connected with 192.168.10.170:39673
{
"numberOfRecords": 1,
"version": 1
}
{"TransmitterId": "6736927", "RelativeTime": "3000", "CaptureDateTime": "1466363596000", "UploadAttempts": 0, "UploaderBatteryLife": 0, "ReceivedSignalStrength": "-84", "FilteredValue": "97520", "RawValue": "99584", "Uploaded": 0, "TransmissionId": "111", "BatteryLife": "216", "_id": 1}
Connected with 192.168.10.166:58117
{
"numberOfRecords": 1,
"version": 1
}
{"TransmitterId": "6736927", "RelativeTime": "4000", "CaptureDateTime": "1466363596000", "UploadAttempts": 0, "UploaderBatteryLife": 0, "ReceivedSignalStrength": "-84", "FilteredValue": "97520", "RawValue": "99584", "Uploaded": 0, "TransmissionId": "111", "BatteryLife": "216", "_id": 1}
6736927 103520 99072 216 -84 115 0
Serial line: 6736927 103520 99072 216 -84 115 0
Connected with 192.168.10.170:39179
{
"numberOfRecords": 1,
"version": 1
}
{"TransmitterId": "6736927", "RelativeTime": "2000", "CaptureDateTime": "1466363896000", "UploadAttempts": 0, "UploaderBatteryLife": 0, "ReceivedSignalStrength": "-84", "FilteredValue": "99072", "RawValue": "103520", "Uploaded": 0, "TransmissionId": "115", "BatteryLife": "216", "_id": 1}
Connected with 192.168.10.166:42127
{
"numberOfRecords": 1,
"version": 1
}
{"TransmitterId": "6736927", "RelativeTime": "3000", "CaptureDateTime": "1466363896000", "UploadAttempts": 0, "UploaderBatteryLife": 0, "ReceivedSignalStrength": "-84", "FilteredValue": "99072", "RawValue": "103520", "Uploaded": 0, "TransmissionId": "115", "BatteryLife": "216", "_id": 1}
It is running fine now, but I I still get ~30 minute gaps from time to time. E.g. I had 2 x 30 minute gaps during last night.
I guess this issue can be closed, but if you have any idea what could cause the gaps it wouldof course be much appreciated.
I will try to recompile wxl without sleepmode and see if that makes any difference.
Okay, so the rpi3 is pretty power hungry. You can usually tell if it isn't happy with the power level because the red led will flicker off for periods during uses. This indicates the voltage is below what it wants. Many USB cables are not good enough and I have used very high grade thick copper usb cables with rpi3 to avoid this problem. Many power supplies designed for rpi offer slightly higher than 5v in order to avoid voltage drops as well. This could be related to your issue.
There are some improvements which can be made to the wixel firmware to get better reception and there is work going on in this area at the moment, but I would expect to see random drops here and there instead of a consistent 30 minute outage.
If the wixel can't get a signal for ages then it will reboot and that is what causes the serial readiness errors you see. The rpi will reconnect to the serial port after the wixel reboots.
I am very interested to hear of any improvements you might get disabling sleep mode. I left it as it was with the parakeet firmware because I know that works and has been well tested.
static volatile uint8 misses_until_failure = 0;
This had no effect; still get the timeouts. Tried a few powersupplies, and got the clienthread timeout for suplies with 10W. With 2.0A & 5.2V, I still have some gaps, but no clienthread timeouts.
Wil buy new PS & shorter mini-USB; fairly confident this will fix it :)
A small correction: I noticed the wixel code gets updated when running the installation scrip. This means my edit didn't actually make it into the wxl.. I recompiled & loaded the wixelcode again by itself, with the change in previous post.
I have not had any 30 min gaps since then, but still get a few dropped readings now and then (rarely more than 2). Difficult to know if this is random, though, since my pi is clearly underpowered..
Another thing; i set up the cfg file to uoload to parakeet receiver, but then the script didn't start. I could run it manually w/no errors, but I was not able to connect w/screen -r wixel on reboots. I don't know if this is an error on my part, or if it's due to the script. Can provide mote info if it is of any interrest. I just modified the code directly in the .py instead, and then it works as expected
Okay probably you can't connect to it with screen -r after reboot because it runs as root from the rc.local startup. Just do sudo screen -r
Are you sure it wasn't running? I would expect it to work the same as when run manually and I use the .cfg method here and it works good.
If given some more time to test you think the prevention of sleep is helping improve reception I can build that in to the installer script or indeed the main wixel firmware when usb powered.
Not an extremely hepful contribution on my part, but want to say I got mystery issues when using the typical edimax wireless adapter that totally disappeared when I switched to ethernet. The Pi was powered with a 1.5 amp small phone charger, no issues on that side. Had X-Windows, VNC and screens, pi itself was stable (2014 model B v2)
Hi,
I will keep monitoring the stability. On vacation now, so the pi is not currently in use. I can send the feedback via xdrip+ if you want to close this issue.
On the other hand, you might consider building it into installer script anyway, since it doesn't have any negatives?
Will also test w/wired network based on previous comment.
EDIT: For info, I was using sudo screen -r wixel