After experimenting with Wi-Fi, I have now added a Bluetooth
link between my system and an Android tablet. This has proved to be very
reliable, and simpler to implement when compared to Wi-Fi.
As the Bluetooth modem operates from a 5 V supply, no level
shifting is required on the data line.
However, there is one constraint that has to be considered.
When the tablet tries to connect to the system, the connection will fail if there
is data already flowing on the serial output.
There are 2 ways to deal with this:
- add a
switch to manually cut the serial input during the connection step;
-
connect during an initial delay at the system start-up (this is how I proceed,
as there is a 10 seconds delay without transmission when my system is switched
on).
In my Bluetooth app, the first screen shows a ‘Connect’
button and a disabled ‘Start’ button. The 'Connect' button is pressed when there
is no data coming in. Once the connection is established, the ‘Start’ button is
enabled and can be pressed to initiate a new thread that decodes the modem
output, and pass the information to the main instrument view that is now
switched on, refreshed 10 times per second.
The Bluetooth thread also saves all data in a large memory
buffer (16 MB) that can store up to 4.5 hours of data per session. When the app
is closing, these data are written to a file on the tablet’s internal memory
card, that can later be transferred to a PC for analysis.
No comments:
Post a Comment