MICILE EZ_PulseOx Documentation
version: 0.9
A few notes about our documentation:
  • The intentions of this documentation are to keep things simple.
  • Please see the examples at the end of each section for concrete examples of how to use each function.
  • If in doubt how to use a function, experiment!
  • We don't believe in writing more words just to make the documentation look more substantial
  • Quick Reference
    Function List
    Compatible Devices
    Contect CMS-50D+ with USB

    * Please contact us for information on adding support for a device.


    PulseOx Functions
    pulseox_connect(type='CMS50D+', serial_port='/dev/ttyUSB0')
    Connects to the pulse oximeter. The type and serial_port parameters can be omitted since the default values should work just fine.
    pulseox_clear_data()
    Clears all pending data from the pulse oximeter data buffer.
    pulseox_has_data()
    Returns True if there is data available in the pulse oximeter data buffer. Returns False if not data is available.
    pulseox_has_data()
    Pops a data item off the pulse oximeter data buffer. Each data item contains the following attributes:
    pulse_rate - Pulse rate detected by the pulse oximter in beats per minute
    sample_rate - The number of data items sampled per minute by the pulse oximeter
    spo2_rate - The current blood oxygen saturation measurement
    wave_y - The y position of the plethysmograph waveform showing the change in blood volume
    # --------------------------------------------------
    # pulseox_demo.py
    # --------------------------------------------------
     
    # import the graphics library and the pulse oximeter library
    from ez_graphics_09 import *
    from ez_pulseox_09 import *
     
    # Connect to the pulse oximeter
    pulseox_connect()
     
    # clear the screen
    clear_screen('black')
    sw = get_screen_width()
    sh = get_screen_height()
     
    # draw some nice graphics
    set_color('cyan')
    set_text_size(40)
    draw_text('spO2'10010)
    draw_text('Pulse Rate'50010)
     
    # Main Loop
    x = 0
    while True:
        # draw the wave form for every data point    
        d = None
        while pulseox_has_data():
            # get the latest data
            d = pulseox_pop_data()
            
            # update the waveform graph
            set_color('black')
            draw_line(xsh - 128xsh - d.wave_y)
            set_color('yellow')
            draw_line(xsh - d.wave_yxsh)
            x = (x + 1) % sw
            
        # only update the pulse and spo2 the last sample
        if d is Nonecontinue
        set_color('black')
        fill_rect(1005070040)
        set_color('yellow')
        draw_text(str(d.spo2)10050)
        draw_text(str(d.pulse_rate)50050)

    pulseox demo