Heart Rate Measurement

Hello Ioannis.

As of here, if you use the hardware sensor described here along with App Inventor, you can.

You can do a search here to find more queries.

https://community.appinventor.mit.edu/search?q=heart%20rate

Dear Gordon_Lu,
thank you for your immediate response. Indeed, I've seen the proposed links for hardware sensor implementation (mainly using an external Arduino-based hardware from an external sensor and other commercial products) in order to access the HR from activity trackers based on the BLE protocol. However, my question is referred to something different; In the available in AI2 tools, in the Sensors field, a developer can have access to the internal sensors of a Tablet or a Smart Watch (SW) for example, running Android and having the capability to download external Applications. Thus, someone can "read" data from the internal to the Tablet or the SW sensors e.g. the GPS, the pedometer, the accelerometer and so on. Why there is no the capability (i.e. the suitable blocks "when HR change" .... to access an internal HRM if such sensor is available in a Smart Watch for example??

I understand, good question.

When AI2 developers add s new component, they first think if it is needed by the majority of users. App Inventor is mainly used for education and not many components are needed. Heart beat sensors built in the phone is not currently needed by a lot of users, as they mainly focus on sensors like accelerometer, location sensors, clocks, and pretty much that's it.

AI2 developers also have interests in other areas. They are currently focusing on mainly storage management (the new Google Sheet component) and App Inventor implementation of Alexa.

Of course, I am an extension developer myself, when I have enough time I can write you an extension that does that.

Best regards,

Gordon

1 Like

Also bear in mind Ioannis that not all Android devices actually have an HRM and of the best (Smart Watches) hardly any are deemed accurate enough. One notable exception is the Apple Watch - which has it's own OS (OS9) - outside of App Inventor's remit.

The Android devices that have HRM, like the sports watches, already have good software and are not necessarily programmable (meaning you could not load your App).

1 Like

What type of heart rate measurement are we talking about here? Using light sensor measurement or Bluetooth with a chest strap etc?

Using the flashlight or a light sensor is more of a gimmick than an accurate HRM.

Dear Gordon_Lu
I understand that AI2 is intended mainly for education and it indeed is an excellent tool! However, looking at the relative discussions in the AI2 forum, I see a great interest of a lot of AI2 developers to the field of HRM. Some students in our University, under my supervision, are dealing with a project in which the need to access the HRM through a Smart Watch has arrised and this was the reason for asking the above query. By the way, we also use storage to Google Sheet.
Anyway, thank you very much for your interest, and your kind willingness to write an extension.
Bet regards
Ioannis

1 Like

Dear Anke
we use three different types of commercially available Android Smart Watches (e.g. FunOS H1), including an HRM sensor, not chest straps. Indeed, all of them are using light sensor measurement. We didnt yet estimated their accuracy, which from a first sight seems to be low.
Thank you for your interest
Ioannis

I would not consider this method as it is unreliable and inaccurate.

2 Likes

Do any of those offer an API to allow you to program them?

Dear ChrisWard
all Smart Watches used by us, (as well as smartphones and tablets, running Android also), allow to download external applications. Thus an app build in AI2 can equally well run in a SW, in a tablet and in a smartphone.

When you finally decide to post a link to the sensor's internal API, know that there is a section of this board for commercial requests:

Dear ABG
sorry, but I really didnt understand you suggestion. What exactly "link to the sensor's internal API" do you expect to post?

I was assuming you had access to information by the sensor makers for the purpose of making them accessible to software developers.

If you don't have that information, expect whoever tries to develop an extension or component to have a harder job.

Dear ABG
No, not in any case. We are developing our own applications using AI2 as usually, using the typical blocks available for internal sensors accessing in AI2 (e.g. "When Location Sensor1 Location changed" block ...), build an app and download it to our Smart Watch or Tablet.

Dear Gordon_Lu
I have found already an extension, in a relative post. I have downloaded it from ewpatton, MIT, Dropbox:

it is in
Comment 26/46
but its not running in my app!

thank you again

The extension you refer to apparently only works with an Arduino

You are not using an Arduino so you need a different solution.

Some smart watches use the Wear OS (a variety of Android). To use Wear OS you need access to it's api.

and that might not be possible using App Inventor without an extension.

To get help accessing the heart rate functions of a watch; establish whether the watch is using the Wear OS; if not, provide an api to use Get to access the watch functions using Blocks.

Here is a link to the Google FIT api Google Fit  |  Google for Developers

See also this discussion HRM heart rate monitor

FITBit SDK Heart-rate API

GARMIN Overview | Health SDKs | Garmin Developers

POLAr GitHub - polarofficial/polar-ble-sdk: Repository includes SDK and code examples. More info https://polar.com/en/developers

Various smartwatches etc. https://www.programmableweb.com/news/10-most-popular-wearable-apis/brief/2021/11/25

What exactly does this mean? What is the symptom of "not running"? Did you appropriately connect to the HRM with the BluetoothLE component, and can you confirm that the HRM in question is advertising the Bluetooth SIG approved heart rate service and characteristics?

to Evan

Sorry dear ewpatton, I'm new in the area and I really don't know how to find the version of the extension (I tried in the properties field of the .aix file, but I failed).. Anyway, I've downloaded it from your Dropbox two weeks ago. What is my main problem with the BLE algorithms implementation using AI2, is that when I'm trying to run in my Samsung tablet, or three different Smart watches (running Android 5, or 7, or 10) ALL the apps implemented by a lot of different users in several blogs (providing their .aia), the applications fail to detect any active Bluetooth device in the nearby area during the "scan" phase! Is it due to the BLE extension I use?

I would appreciate your help.

Thank you in advance

Ioannis

Give the Scan some time by launching the scan and then running a clock timer.

We have found that to use other devices like microcontrollers it is (more often than not) necessary to switch on Location, a Google Security requirement. To trigger that, simply drag a location sensor component into the Project. That may affect the scan, I really don't know.

The latest BLE extension is version 20201223, package name 'BLE-device-sort.aix'

If your App is going to be installed on a Smartwatch, keep it as lean as possible else it could exceed the memory allocation.

Also, make sure the Smartwatch is actually using BLE, that's not a given, many wearable devices still use BT Classic.

https://www.professorcad.co.uk/appinventortips#TipsBluetooth