This article supports a video on the build of the Star Trek Sick Bay project (external you tube link). You should watch that video as well as this article as it contains information not mentioned below. This is part one of a two part write up. Doing all this on one video/article would be too much at once and so has been broken down into to chunks.
Parts List (Ignoring wires/ breadboard etc.)
- Arduino (Nano used, but Uno or Mega would also be fine)
- MAX30100 Heart rate sensor/O2 sensor
- DS18B20 (Temperature sensor – 2 required)
- TFT Screen (ILI9341, SPI, 320×240 pixels, 2.4″ or 2.8″ are common)
- DF Player Mini (MP3 player)
- SD card – smallest you can find as very small file stored on it.
- 4 to 8 Ohm 3Watt Speaker
- Small tactile push switch
- 4K7 Resistor (4 required)
- Breadboard
Affiliate list (if you want to order from Amazon UK and support this channel)
Arduino Nano : https://amzn.to/2XmDDLT
TFT LCD : https://amzn.to/2YAGEo4
MAX30100 blood oxygen/pulse : https://amzn.to/2YnWR04
DS18B20 Temp sensors : https://amzn.to/2FMF37D
DFPlayer Mini (MP3 player) : https://amzn.to/2YrrXnx
Speaker : https://amzn.to/2FMFoqV
Push Button (multi pack) : https://amzn.to/2J5Tp4V
Breadboard : https://amzn.to/2xrHh7L
Wires : https://amzn.to/2FO7wtx
Tools
Due to some very tiny alterations to the MAX30100 board to get it to work with the Arduino you will need access to a soldering iron.
References
The body core temperature is derived from an equation based on the research paper published by Loughborough University (UK), here’s the link.
Circuit Diagram
Required Software Libraries
Several libraries are required to allow the source code (listed later) to work with the hardware. The list is below, typing these into the search of the Arduino IDE’s Library Manager should bring up the correct library, but double check the video linked to at the start to double check.
- Adafruit ILI9341 LCD driver
- Adafruit Graphics Library
- Dallas DS8B20 temperature sensor
- MAX30100 Pulse Oximeter
Building a bit at a time
This is a reasonably complex project for a beginner or intermediate builder and you should build and test each module in stages otherwise discovering what has gone wrong can be very difficult. Therefore use the video to help you build the various stages and the code below is used in the video for the various tests.
The ILI9341 Screen
One of the two more complex items to get working (the other being the pulse/oxygen sensor itself). First there are a lot of wires to connect and secondly there are conflicting accounts of whether to solder a jumper pad together. Wire it up as shown above and then follow the video for testing, if yours does not work then firstly double check your connections and then try connecting the two solder pads together. The test for this screen is the standard Adafruit graphics test as shown in the video.
The Max30100 Pulse-oximeter
Below is a picture of the sensor used.
They do need a small hack to work with Arduino which is covered in the video. But basically you need to remove the three 472 resistors shown above and add some 4K7 ones to your breadboard/prototype board. There is a version of the MAX30100 board that is supposed to not need this hack but I failed to get it to work with my set-up so I’ve ignored it for now. Note the external 4.7K resistors in the circuit diagram, this is explained on the video, but basically it allows our 5V Arduino to talk with this 3.3V sensor.
In the past when I’ve covered this sensor more than one person has asked if this is strictly necessary and the unfortunate truth is the sensor will not work with our Arduino unless these alts are done. See the video to see the resistors being removed.
Download the testing code below which presumes you have correctly got your screen working – as the results of the test will be displayed there.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
#include <Adafruit_GFX.h> #include "Adafruit_ILI9341.h" #include "MAX30100_PulseOximeter.h" #include <Wire.h> #define TFT_DC 9 #define TFT_CS 10 #define BLACK 0x0000 #define YELLOW 0xFFE0 Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC,-1); PulseOximeter pox; void setup() { tft.begin(); tft.setRotation(1); tft.fillScreen(BLACK); tft.setTextSize(2); tft.setTextColor(YELLOW,BLACK); if (!pox.begin()) { tft.println("Sensor start up failed"); for(;;); } else { tft.println("Sensor start up success"); } tft.setCursor(0,32); tft.print("Heart rate: BPM"); tft.setCursor(64,32); tft.setCursor(0,64); tft.print("O2: %"); } void loop() { static uint32_t tsLastReport = 0; uint8_t BPM; uint8_t O2; pox.update(); // Asynchronously dump heart rate and oxidation levels to the tft // For both, a value of 0 means "invalid" if (millis() - tsLastReport > 1000) { BPM=round(pox.getHeartRate()); O2=pox.getSpO2(); tft.setCursor(130,32); tft.print(BPM); if(BPM<100) tft.print(" "); tft.setCursor(34,64); tft.print(O2); if(O2<10) tft.print(" "); tsLastReport = millis(); } } |
End of part 1
In the next installment we’ll look at getting the two Dallas 18DB20 temperature sensors working together and setting up and using the DF Player Mini MP3 Player.