Dear all,

the covid-19 period, i have spent lots of time designing a 3D printed Adaptable medical Mask for covid-19. It was succesful using bio-compatible materials

(here's the liink: https://www.linkedin.com/feed/update...6630277947393/)

I have printed free of charge, for the kids in school about 50 of face shields in order to be safe inside the lectures.

The same i did for the professional 3D printed Adaptable Medical Mask, for Hospitals. Just printed couple of those for testing.

Now i would like to prepare a free of charge again low cost electronic heart rate circuit, for my sons classroom. Kids are in total 15 in class.


As it is my first time using I2C protocol, i would like your help in order to establish a connection with the heart sensor MAX30102.

If anyone have tried this sensor i would be much appreciated if you could share a part of your code.

I have in front of me the manual of the MAX30102 and all the control and register modes. Actually i'm reading this 2 days now, and really as a newbie, cant understand where to start from.

I will use the PIC18F26K22 at 16Mhz as from the PICBASIC manual I2C protocol needs to run up to 20MHZ using the I2CWRITE or I2CREAD software commands. (i hope i'm right)

Next the following ports will be used.

Code:
LATC.1 for Data 
LATC.2 for Clock 

also reserved two more ports for external serial display

LATC.6 for TX
LATC.7 for RX
Some MAX30102 registers

Code:
;-------------------------------------------------------------|
;------------------------ max30102 registers------------------|
;-------------------------------------------------------------|
define  I2C_WRITE_ADDR  $AE     ; b10101110
define  I2C_READ_ADDR   $AF     ; b10101111
define  I2C_ID_ADDR     $57     ; 7-bit version of the above
;define I2C_ID_ADDR  57h ; 7-bit version of the above

;//register addresses
;---------------------- STATUS REGISTER -----------------------
define REG_INTR_STATUS_1   $00
define REG_INTR_STATUS_2   $01

define REG_INTR_ENABLE_1   $02
define REG_INTR_ENABLE_2   $03

;----------------------- FIFO REGISTERS -----------------------
define REG_FIFO_WR_PTR     $04   ; FIFO WRITE POINTER REG ADDR IS 0X04
define REG_OVF_COUNTER     $05
define REG_FIFO_RD_PTR     $06
define REG_FIFO_DATA       $07

;---------------------- CONFIG REGISTER -----------------------
define REG_FIFO_CONFIG     $08
define REG_MODE_CONFIG     $09
define REG_SPO2_CONFIG     $0A
define REG_LED1_PA         $0C
define REG_LED2_PA         $0D


define REG_PILOT_PA        $10
define REG_MULTI_LED_CTRL1 $11
define REG_MULTI_LED_CTRL2 $12

;----------------------- TEMP REGISTER -------------------------
define REG_TEMP_INTR       $1F
define REG_TEMP_FRAC       $20
define REG_TEMP_CONFIG     $21
define REG_PROX_INT_THRESH $30

;----------------------- PART ID REGISTER ----------------------
define REG_REV_ID          $FE
define REG_PART_ID         $FF
Now i'm trying to understand based on the manual how could i communicate with sensor and at least see it alive (any led light on the sensor)

Really looking for your help.