Dual-Wavelength System
This section will provide you with the necessary information to create the Digital Pulse Oximeter System using the Arduino shield created within the department. The actual operation and final outputs of the system will be based on the skills you have learnt so far.
The current system includes a sensor, display, and peripheral IO which can be used as you see fit. The system is intended for accessibility so may also be powered via battery but for this week will be powered by USB. The system also has room to be improved in multiple areas so feel free suggest, with relevant detail, improvements that can be made/added.
The final system will be compared to a commercial system, and a medical grade ICU monitor on the final day of the Project Week.
Step 1: Unboxing
Open the kit box and check that you have all the necessary components. If any components are missing, please go and find a demonstrator. The parts that should be within the box are specified in the Equipment section.
Step 2: Preparation
Identify all the components by referring to the parts list and the device schematic. This should assist with choosing the right tools and order in which to complete the next step.
Step 3: Populate the PCB
By now you may have noticed that the PCB includes SMD and THD components. It is recommended to attach the SMD components using the reflow ovens before hand soldering the THD components.
Surface Mount Components
Use the provided Schematic, PCB stencil, and Reflow Oven to populate these components on the PCB. Instructions for the use of the ovens are located next to the stations.
Through Hole Components
Use the provided Schematic and a solder station to populate these components on the PCB.
The 22-Pin Sockets should be shared between the components for which it is listed.
Step 4: Program the Arduino
Now that the system is assembled, the next step is programming the Arduino Nano ESP32 to function as the pulse oximeter. This will require the addition of libraries to the environment to make this a simpler process. The alternative would be recreating code for each device included on the PCB.
The overall objective is to write a script which reads the heart rate, in bpm, and SpO2 values, as %, and displays them on the OLED screen when a finger is placed on the MAX30100 sensor. The other peripherals (LEDs and Buttons) may be utilised in whichever way you see fit but should relate to the operation of the system.
A) Obtain Sensor Readings from the Click Board
The sensor chip used on the Click Board is the MAX30100
. There are several libraries available to handle the I2C interface with this chip, but the recommended one is MAX30100lib
by Oxcullo Intersecans. You can find the documentation relevant to this library here.
You can use the available examples to familiarize yourself with how the library works and test its operation.
B) Use the LEDs and Buttons
The LEDs and Buttons can be useful components to integrate in your system design.
- Try to get output to the various LEDs of the system. The
Blinky
example found underBasics
may help.
-
Use the push button to turn
ON
orOFF
an LED. TheButton
example found underDigital
may help. There may be spurious behaviour on button presses due to their mechanical nature. TheDebounce
example found underDigital
may help to prevent this issue. -
You may find the video on interrupts in the additional information section useful.
C) Use the OLED
- The following is a list of open source libraries (available in the Arduino Library manager) to help get you started:
Adafruit SSD1306
Adafruit GFX Library
Adafruit BusIO
- Try to output ‘Hello World!’ to the OLED screen. The
ssd1306_128x32_i2c
example may be a helpful starting point.
D) Refine & Iterate
Repeating the process of writing and testing code until it works should leave you with a system that improves with each change.
Step 5: Improve the System
With the prototype assembled, and hopefully running on code that works, consider and possibly implement improvements to the system. This can take many forms and can be used to claim skills at various levels. The Taking it further section has some ideas but this is by no means an exhaustive list.
Additional Resources
You were provided with this cheat sheet within the lecture on MATLAB vs Arduino. You may find it useful to refer to it as a reminder of the different arduino commands.
Using the bootloader mode can sometimes help when facing issues with uploading scripts to your arduino. Below is the description from the Arduino website.
Arduino Bootloader Mode
The Nano ESP32 has a feature that we call Arduino Bootloader-mode, what this means is that you are able to put the board in a sort of recovery mode by double pressing the reset button while the board is powered on.
This mode is useful if you’ve uploaded a sketch that produces some unwanted behaviour. Maybe the sketch causes it to become undetectable by your computer, or maybe its an HID sketch that took over your keyboard and mouse and you need to regain control of your computer. It lets you turn the board on without actually running any sketch.
To enter bootloader-mode, press the reset button, and then press it again once you see the RGB LED flashing. You’ll know that you’ve successfully entered bootloader-mode if you see the green LED pulsing slowly.
ROM Boot Mode
In addition to the normal bootloader-mode, the Arduino Nano ESP32 lets you enter ROM boot mode. This is rarely needed, but there are some cases where it might be useful, for example you may want to follow this process to:
Update the Arduino bootloader already on the board. This can resolve issues with Nano ESP32 being misidentified as other ESP32 boards. Restore the ability to upload regular Arduino sketches to a Nano ESP32 that has been flashed with a third party firmware.
Resetting the Bootloader
Resetting the bootloader can also be useful. Here is a link to an arduino webpage explaining how to do it.
You will have a lecture on I2C communication in semester two, but below is a video outlining a brief introduction to help you understand how the digital sensor works.
The Arduino website has a useful webpage with some fundamental debugging tools and techniques to help you identify why the code you have written may not be working as expected.