Heart rate sensor MAX30102


Closed Thread
Results 1 to 40 of 85

Hybrid View

  1. #1
    Join Date
    Oct 2010
    Posts
    411


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    Thanks both for your kind reply.

    I will find the way. I know it is quite difficult and options are limited to use Arduino.

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


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    i tried the arduino code again with the sensor attached to my finger with a rubber band , it works a bit better that way
    do you have a stl model for an enclosure ? . its difficult to make any sense of wildly unstable readings

    i'm thinking a ESP8285 M3 board would make a better platform and allow use of arduino libs if they can be proven to be adequate
    ESP8285's these cut down esp8266's are very cheap and still have more processing power than a bucket full of pic chips they are quite happy to run on two aaa batteries and consume little energy if wifi not engaged
    Last edited by richard; - 4th September 2020 at 10:24.
    Warning I'm not a teacher

  3. #3
    Join Date
    Oct 2010
    Posts
    411


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    Hi Richard,

    once i have all the components (including the arduino board or ESP8285) then i will be ready to design the 3D cad model and printed.

    I will order some arduino and ESP and check them out.

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


    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

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


    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

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,821


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    Interesting 3D print!

    Ioannis

  7. #7
    Join Date
    Oct 2010
    Posts
    411


    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: 1082
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

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 : 3

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