Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an example peripheral to work with Science Journal app #112

Closed
ukBaz opened this issue Dec 9, 2016 · 6 comments
Closed

Create an example peripheral to work with Science Journal app #112

ukBaz opened this issue Dec 9, 2016 · 6 comments

Comments

@ukBaz
Copy link
Owner

ukBaz commented Dec 9, 2016

I've just stumbled across the Science Journal app from Google. It allows you to data log sensor data on your phone.
https://play.google.com/store/apps/details?id=com.google.android.apps.forscience.whistlepunk

The bit that caught my attention was that it can also do the logging for sensors over BLE. Their GitHub repo has some Arduino examples. I would expect that this could be done with Bluezero also. The key bits of Arduino code with the BLE service and characteristic seem to be:

BLEService whistlepunkService("555a0001-0aaa-467a-9538-01f0652c74e8"); // create service
// Must be 20 char long to accomodate full-size messages.
const char *value = "                     ";
const char *config = "                     ";
BLECharacteristic valueCharacteristic( "555a0003-0aaa-467a-9538-01f0652c74e8", BLENotify, value);
BLECharacteristic configCharacteristic("555a0010-0aaa-467a-9538-01f0652c74e8", BLEWrite, config);
const unsigned short version = goosci_Version_Version_LATEST;

BLEUnsignedShortCharacteristic versionCharacteristic("555a0011-0aaa-467a-9538-01f0652c74e8", BLERead);

The app code is available at:
https://github.com/google/science-journal

@ukBaz
Copy link
Owner Author

ukBaz commented Dec 11, 2016

This is a work-in-progress of what the understanding is of the Bluetooth profile required by Google Science Journal to be able to read Bluetooth (BLE) sensors

Service

Field Details
Name Science Journal
UUID 555a0001-0aaa-467a-9538-01f0652c74e8

Characteristic

Field Details
Name Value
UUID 555a0003-0aaa-467a-9538-01f0652c74e8
Flags Read, Notify
Fields utf8s
Summary Sends the value of the sensor as a string (Max 20 characters)

Characteristic

Field Details
Name Config
UUID 555a0010-0aaa-467a-9538-01f0652c74e8
Flags Write
Fields utf8s
Notes Send instructions to the sensor as a string (Max 20 characters) ?What instructions does the app send?

Characteristic

Field Details
Name Version
UUID 555a0011-0aaa-467a-9538-01f0652c74e8
Flags Read
Fields ?unit8?
Notes ?It is unclear to me what this should be set to but it looks like we might be on version 1 and it might be optional?

@ukBaz
Copy link
Owner Author

ukBaz commented Dec 11, 2016

I've been looking around the app files. The heavy lifting for the Bluetooth sensors seems to happen in the following file:
https://github.com/google/science-journal/blob/master/OpenScienceJournal/whistlepunk_library/src/main/java/com/google/android/apps/forscience/whistlepunk/sensors/BluetoothSensor.java#L204

The above link is to a comment which states:
For Value (UUID:555a0003), it's a protobuf
Which I think is referring to Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data called Protocol Buffers

It is looking like the value is made up of a timestamp and value although the exact details are still a mystery at the time of writing.

@ukBaz
Copy link
Owner Author

ukBaz commented Dec 12, 2016

I asked a question in the Google Science Journal Support Forum about the Bluetooth Profile required and they have come back with "We do not have a BLE protocol layer that we are yet ready to support long-term"

The solution is to build an Android application package (APK) that interfaces between Science Journal and the Bluetooth as detailed here:
https://github.com/google/science-journal/blob/master/api/ScienceJournalApi/README-api.md

Writing the APK seems outside the scope of this project so I'm closing this

@ukBaz ukBaz closed this as completed Dec 12, 2016
@ukBaz
Copy link
Owner Author

ukBaz commented Dec 13, 2016

Just wanted to capture here for future reference that the Bluetooth SIG has an adopted GATT specification for Environmental Sensing Profile and Environmental Sensing Service.
More information can be found at: https://www.bluetooth.com/specifications/adopted-specifications
This PDF and XML is probably the most useful

@Geoffysicist
Copy link

Did you get any further with this? Now that the science journal has gone over to arduino and they can link to the arduino nano sense, it should be possible to pursue this. I want to make a physics sensor based on the adafruit feather sense but would prefer to work in circuitpython because arduino is a pain.

@ukBaz
Copy link
Owner Author

ukBaz commented Oct 4, 2020

This idea got abandoned previously because there was not a documented API accessible from the Raspberry Pi. I believe this is still the situation. If you know of some documentation then please share and I can take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants