curtpw / nRF5x-device-reverse-engineering

nRF52/nRF51 Fitness Trackers & Smartwatches Reverse Engineered for use as a Wearable Device Development Platform
252 stars 43 forks source link

HR sensor #5

Open scientistnobee opened 6 years ago

scientistnobee commented 6 years ago

Hi Curt,

Thanks for all your good work. I am able to flash code into ID107HR fitness tracker that shows accelometer data onto its screen. Now, I would like to access it's HR sensor. Do you have any code that works with this sensor? I worked with only Arduino but never with mbed. So, any help with sensor is highly appreciated.

54696d21 commented 6 years ago

Hi,

I’m not Curt but maybe I can help you too :) According this blog post: http://www.rogerclark.net/new-nrf52832-based-smart-watch-available/ the sensor is a Si1143. There is a Arduino library for it: https://github.com/moderndevice/SI1143_Pulse_Prox_Sensors and two others for a different model oft he sensor: https://github.com/adafruit/Adafruit_SI1145_Library https://github.com/Seeed-Studio/Grove_Sunlight_Sensor The example of the Adafruit library compiles successfully with the board set to "Generic NRF52"

scientistnobee commented 6 years ago

Thanks for offering help. Yes, the Adafruits example compiled for my 1D107HR although it is based on nRF51. But it is written for SI1145, while the sensor in 1D107HR is SI1143. I don't know how this will go. I will test tomorrow. I know the I2C id of this device is 0x5A, I will make the necessary changes. Also, Mark @micooke is working on a library for this sensor. Examples in that library are also successfully compiled.

micooke commented 6 years ago

My library is a fork of the modern devices one, but it's as a class not just sequential i2c calls. The Si114x series are all very similar. My library should work with the Si1145 (and visa versa), but it won't set up the UV sensor (the only difference to the Si1143). From memory the Si1142 is a Si1143 without the IR sensor.

scientistnobee commented 6 years ago

Hi Mark, I think SI1143 library might work with SI1141/Si1142/Si1143. But I think Si1145 is significantly different. In particular the register values in the library looks very different. A very small question. Do you think the below line in your library (Si114x_defs.h) should changed to PARAM_I2C_ADDR = 0x5A, instead of current PARAM_I2C_ADDR = 0x00.

micooke commented 6 years ago

Nope, you are referring to a parameter offset table. The default address in the class instantiation.

scientistnobee commented 6 years ago

Hi, I have uploaded the adafruits test code for Si1145 and it outputs that "Didn't find Si1145" In the library its I2C address is 0X5A, same as the address of the Si1143 device in ID107HR, still it didn't work.

micooke commented 6 years ago

(this should have been asked in the adafruit github) - line 29 of Adafruit_SI1145.cpp is looking for a 45, you need to change this to 43

curtpw commented 6 years ago

I think Mark has the Si114x covered. I'm working on a version of the PulseSensor code (https://github.com/WorldFamousElectronics/PulseSensorPlayground) for the X9 and N68 which have a green LED and photosensor directly broken out. Unless someone is opposed I'm going to add sensor/peripheral libraries that emerge from threads like this to the common --> libraries directory.

scientistnobee commented 6 years ago

Hi everyone, I am now able to blink the green LEDS on the Si1143 using the code posted by @najnesnaj in the below link. I modified little bit to turn off the LEDS, otherwise LEDS are blinking all the time. Now, I will focus on getting the photodiode values. Thanks everyone for your support so far.

https://github.com/najnesnaj/smartband.