Heart rate sensor MAX30102


Closed Thread
Results 1 to 40 of 85

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,141


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    Use of such finger sensors need to have your finger cleaned from oil with alcohol (isoprop. alcohol or similar).

    It is necessary for the sensors to keep working with consistency.

    Ioannis

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,655


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    thanks ioannis, with out the repeatable test conditions its all guess work

    i might see if i can print this
    https://www.thingiverse.com/thing:4395147
    Warning I'm not a teacher

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,141


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    Interesting 3D print!

    Ioannis

  4. #4
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    I will try once again to find out how could i make this sensor work.

    Anyone is interested of helping in creating a simple driver for this sensor, please any help is much appreciated.

    At the moment i have changed the diagram. For being aligned with the following code please check the test board as well.

    Name:  circuit board.png
Views: 7588
Size:  716.0 KB

    Up to now the componets im using:

    1. PIC18F26K22
    2. A Crystal 16Mhz
    3. 2 capacitors 22p
    4. 2 capacitors 100n
    5. 3 LEDs, RED, ORANGE, BLUE
    6. couple of resistors, 4.7K, 100Ohm, 220Ohm
    7. An LCD screen from 4D Systems
    8. MAX30102 Heart Rate Sensor

    I have managed with the following code to understand and complete easy tasks like:

    1. to read the PART NUMBER ID of the sensor based on the manual.
    2. How to light up the LEDs (IR and RED LEDs) Cant really understand how to send the right command for controlling the current)


    Code:
    '*********************************************************************************
    @ ERRORLEVEL -306 ; this command prevents the compiler to give you a notice of   *
                      ; crossing page boundary - make sure bits are set              *
    '********************************************************************************* 
     
      #CONFIG   ;  The PBP configuration for the PIC18F26K22 is:
    
        CONFIG FOSC     = HSHP	        ; HS oscillator (high power > 16 MHz)
        CONFIG PLLCFG   = ON	        ;Oscillator multiplied by 4                       
        CONFIG PRICLKEN  = ON	        ;Primary clock enabled
        CONFIG FCMEN     = OFF	        ;Fail-Safe Clock Monitor disabled
        CONFIG IESO      = OFF	        ;Oscillator Switchover mode disabled
        CONFIG  BOREN    = SBORDIS      ; Brown-out Reset enabled in hardware only (SBOREN is disabled)
        CONFIG  WDTEN    = ON           ; WDT is always enabled. SWDTEN bit has no effect                     ;|
        CONFIG  WDTPS    = 32768        ; 1:32768 ---> HERE enable the watchdog timer with a 1:32768 postscale;|
        CONFIG  PWRTEN   = ON
        CONFIG  HFOFST   = ON           ; HFINTOSC output and ready status are not delayed by the oscillator stable status
        CONFIG  MCLRE    = EXTMCLR      ; MCLR pin enabled, RE3 input pin disabled
        CONFIG  LVP      = OFF          ; Single-Supply ICSP disabled
        CONFIG  XINST    = OFF          ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
        CONFIG  DEBUG    = OFF          ; Disabled
        CONFIG  CP0 = OFF             ; Block 0 (000800-003FFFh) not code-protected
        CONFIG  CP1 = OFF             ; Block 1 (004000-007FFFh) not code-protected
        CONFIG  CP2 = OFF             ; Block 2 (008000-00BFFFh) not code-protected
        CONFIG  CP3 = OFF             ; Block 3 (00C000-00FFFFh) not code-protected
        CONFIG  CPB = OFF             ; Boot block (000000-0007FFh) not code-protected
        CONFIG  CPD = OFF             ; Data EEPROM not code-protected
        CONFIG  WRT0 = OFF            ; Block 0 (000800-003FFFh) not write-protected
        CONFIG  WRT1 = OFF            ; Block 1 (004000-007FFFh) not write-protected
        CONFIG  WRT2 = OFF            ; Block 2 (008000-00BFFFh) not write-protected
        CONFIG  WRT3 = OFF            ; Block 3 (00C000-00FFFFh) not write-protected
        CONFIG  WRTC = OFF            ; Configuration registers (300000-3000FFh) not write-protected
        CONFIG  WRTB = OFF            ; Boot Block (000000-0007FFh) not write-protected
        CONFIG  WRTD = OFF            ; Data EEPROM not write-protected
        CONFIG  EBTR0 = OFF           ; Block 0 (000800-003FFFh) not protected from table reads executed in other blocks
        CONFIG  EBTR1 = OFF           ; Block 1 (004000-007FFFh) not protected from table reads executed in other blocks
        CONFIG  EBTR2 = OFF           ; Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks
        CONFIG  EBTR3 = OFF           ; Block 3 (00C000-00FFFFh) not protected from table reads executed in other blocks
        CONFIG  EBTRB = OFF           ; Boot Block (000000-0007FFh) not protected from table reads executed in other blocks
        
      #ENDCONFIG
      
    ;*---------------------------------------------------------------------------------------------------------|
    ;*---------------------------------------------------------------------------------------------------------|
    'define I2C_SLOW 1
    define  OSC 64
    
            INCLUDE "modedefs.bas"
            INCLUDE "ALLDIGITAL.pbp"
    
    OSCCON    = %01110000   ; 16Mhz
    OSCTUNE.6 = 1           ; Enable 4x PLL
    
    while ! osccon2.7 :WEND ; to make sure the pll has stabilised before you run any other code
    
    TRISA = %00000000  
    TRISB = %00000000   
    TRISC = %10011000                  
    
    '----------------------- At start all PORTS LOW -------------------------|
    '------------------------------------------------------------------------|
    PORTA = 0            'make low all ports at A range                      |
    PORTB = 0            'make low all ports at B range                      |
    PORTC = 0            'make low all ports at C range                      |
    PORTE = 0            'make low all ports at E range                      |
    '------------------------------------------------------------------------|
    
    '-------------------------- COMPARATORS OFF -----------------------------|
    '------------------------------------------------------------------------|
    CM1CON0.7 = 0 'Disable comparator1                                       |
    CM2CON0.7 = 0 'Disable comparator2                                       |
    '------------------------------------------------------------------------|
    
    '*----------------------- | EUART 1 Configuration  | --------------------------|
    
            DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
            DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
            DEFINE HSER_CLROERR 1 ' Clear overflow automatically
            DEFINE HSER_SPBRG 160 ' 38400 Baud @ 64MHz, -0.08%
            SPBRGH = 1
            BAUDCON.3 = 1         ' Enable 16 bit baudrate generator
    '*-----------------------------------------------------------------------------|
    
    ORANGE  var LATA.2   ' ORANGE LED TO INDICATE POWER ON OF THE PIC
    BLUE    var LATC.0   ' BLUE LED TO INDICATE SENSOR WOKRING CONDITION
    RED     VAR LATC.5   ' RED LED TO INDICATE ERROR
    SDA     var portc.4  ' DATA PIN
    SCL     VAR portc.3  ' CLOCK PIN
    
    ;-------------------------------------------------------------|
    ;------------------------ max30102 registers------------------|
    ;-------------------------------------------------------------| 
    Timeout  cON 2000
    i        var byte
    mydata   var BYTE
    fifowr   var byte
    fiford   var byte
    fifoD1   var byte
    fifoD2   var byte
    fifoD3   var byte
    
    ContWR   var byte      ; $AE or b10101110
    ContRD   var byte      ; $AF or b10101111
    ContRD = $AF           ; b10101111
    ContWR = $AE           ; b10101110
    addr     var byte      ; this must be defined as variable word
    
    'I2C_ID_ADDR  con   $57     ; 7-bit version of the above
    'define I2C_ID_ADDR  57h ; 7-bit version of the above
    
    ;//register addresses
    ;---------------------- STATUS REGISTER -----------------------
    REG_INTR_STATUS_1 var byte ' con  $00
    REG_INTR_STATUS_2 var byte ' con $01
    
    REG_INTR_ENABLE_1 var byte ' con  $02
    REG_INTR_ENABLE_2 var byte 'con  $03
    
    ;----------------------- FIFO REGISTERS -----------------------
    REG_FIFO_WR_PTR  var byte 'con   $04   ; FIFO WRITE POINTER REG ADDR IS 0X04
    REG_OVF_COUNTER  var byte 'con   $05
    REG_FIFO_RD_PTR  var byte 'con   $06
    REG_FIFO_DATA    var byte 'con   $07
    
    ;---------------------- CONFIG REGISTER -----------------------
    REG_FIFO_CONFIG  var byte 'con   $08
    REG_MODE_CONFIG  var byte 'con   $09
    REG_SPO2_CONFIG  var byte 'con   $0A
    REG_LED1_PA      var byte 'con   $0C
    REG_LED2_PA      var byte 'con   $0D
    
    
    REG_PILOT_PA        var byte 'con $10
    REG_MULTI_LED_CTRL1 var byte 'con $11
    REG_MULTI_LED_CTRL2 var byte 'con $12
    
    ;----------------------- TEMP REGISTER -------------------------
    REG_TEMP_INTR        var byte 'con $1F
    REG_TEMP_FRAC        var byte 'con $20
    REG_TEMP_CONFIG      var byte 'con $21
    REG_PROX_INT_THRESH  var byte 'con $30
    
    ;----------------------- PART ID REGISTER ----------------------
    REG_PART_ID      var byte
    ' -----------------------------------------------------------------------------|  
    ' indication of the working code
    
    for i= 0 to 3
    orange = 1
    pause 100
    orange = 0
    pause 50
    next i
    orange = 1
    
    init: 
    low blue
    low red
    pause 100
    
    REG_PART_ID = $FF     ' this is the part id reg adress which gives hex 15
    i2cread  SDA,scl,contrd,REG_PART_ID,[mydata],error
    
    '*******************************************************************************
    ' if %00000010 is used then only IR LED for heart rate mode is set             *
    ' if %00000011 is used then only RED & IR LED for SPO2 mode is set             *
    ' if %00000111 is used then Multi Led Mode is set                              *
    '*******************************************************************************
    
    addr = $09   ' MODE CONFIGURATION 
    i2cwrite  SDA,scl,contwr,addr,%00000010,error  ' ModLED = $02 as per data sheet heart rate mode, $03 SpO2 mode
    'pause 100
    
    addr = $0C    'LED PULSE AMLIDUDE FOR for LED1_PA[7:0] 0x0C
    i2cwrite  SDA,scl,Contwr,addr,$3f,error' if LED1_PA = $3F  , 12.6 mA , ($7F is 25.4 mA)
    'pause 100
    
    '********************************************************************************
    
    REG_FIFO_DATA = $07
    i2cread  sda,scl,contrd,REG_FIFO_DATA,[fifod1,fifod2,fifod3],error
    '********************************************************************************
    
    start:
    HSEROUT [$73,$03,$04,$11,$ff,$ff,"PART ID: ",hex mydata,"h",$00]
    Hserin  timeout,error,[wait(6)]
    
    HSEROUT [$73,$05,$0A,$11,$07,$E0,"FIFO DT: ",$00]   ' lime color $07,$E0
    Hserin  timeout,error,[wait(6)]
    
    HSEROUT [$73,$03,$0C,$11,$07,$E0,dec fifod1,dec fifod2,dec fifod3,$00]   ' lime color $07,$E0
    Hserin  timeout,error,[wait(6)]
    'goto start
    
    blueled: 
    high blue
    PAUSE 300
    goto init
    
    error:
    high RED
    pause 100
    end

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,655


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    it looks like there is not much interest in this project

    there are a number of issues i can see, starting at the top with the physicals

    1, why a xtal osc, getting a stable xtal osc to work on a bread board is not guaranteed.
    xtal pins are often too thin for reliable connection and the capacitive coupling between strips is high.
    the internal osc is easily stable enough for this project and so much simpler.
    2, you provide nil detail on the display specs, the 3.3 v supply from lcd is it stable and capable of suppling the project ?
    Warning I'm not a teacher

  6. #6
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    Thanks for the reply.

    I will give it a try as i would like to make this sensor work. I just need some guidance if possible.

    1. I will remove the external crystal, less part the better, in case for this project the internal is stable enough.
    2. The 4D Systems display, is an easy display to use, as they have on board chip and loaded a ready made driver for ease of use. I have this display couple of years now and it works as expected.

    You can find the datashet of the display here and the SERIAL COMMAND REFERENCE

    Regarding the output 3.3V from the display, looks like it is quite stable as i measured it. The Sensor's Power Supply: 3.3V~5V, so i could also use 5V.

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,655


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    There is your first major hurdle

    Name:  LEO.jpg
Views: 7241
Size:  171.9 KB

    each led in 30102 can draw 50ma the two leds on your board 20ma each , the pic chip maybe another 20ma.
    at least use a 470uF smoothing cap but another 3.3v power source would be better

    the led can be lit
    Warning I'm not a teacher

  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    2,655


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    mine has 3.3v written on it but the data sheet says the led supply can be 6v and the other sda scl pins are 6v tolerant
    maybe mine has a cheap 1.8v regulator , it works fine at 3.3v
    Last edited by richard; - 11th January 2022 at 09:43.
    Warning I'm not a teacher

Similar Threads

  1. New PIC failure rate
    By timmers in forum General
    Replies: 5
    Last Post: - 26th March 2009, 12:11
  2. Rf module baud rate
    By tazntex in forum Serial
    Replies: 4
    Last Post: - 5th August 2008, 18:47
  3. Replies: 6
    Last Post: - 18th January 2008, 08:17
  4. SHIFTOUT Clock rate
    By Brock in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th July 2006, 23:42
  5. Detect baud rate
    By Dick M in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 2nd July 2005, 21:10

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts