Code for Arduino IDE used in the video is listed below. It targets the Wemos D1 R32 ESP32 board, but can be modified to suit. // Tinker Foundry // Accompanying video: https://youtu.be/xjwSKy6jzTI // Code for ESP32 to interface with MAX30102 breakout board and report blood oxygen level // Refer to https://github.com/DKARDU/bloodoxygen - below code is simplified version // https://www.analog.com/media/en/technical-documentation/data-sheets/MAX30102.pdf // Connections from WEMOS D1 R32 board to MAX30102 Breakout Board as follows: // SCL (ESP32) to SCL (breakout board) // SDA (ESP32) to SDA (breakout board) // 3V3 (ESP32) to VIN (breakout board) // GND (ESP32) to GND (breakout board) #include <Wire.h> #include "MAX30105.h" //sparkfun MAX3010X library MAX30105 particleSensor; double avered = 0 ; double aveir = 0 ; double sumirrms = 0 ; double sumredrms = 0 ; int i = 0 ; int Num = 100 ; // calculate SpO2 by this sampling interval int
Code listings... For the ESP32 C-code, please start off with a sketch from any existing example for ESP32 CAM and use that as your starting point... it will include app_httpd.cpp and camera_pins.h files. CameraWebSocket.ino // refer to https://shawnhymel.com/1675/arduino-websocket-server-using-an-esp32/ // To make sure WebSocketServer.h is available: // Sketch > Include Library > Manage Libraries // Search for "WebSockets Sattler' and install the library named "WebSockets by Markus Sattler" // // WARNING!!! PSRAM IC required for UXGA resolution and high JPEG quality // Ensure ESP32 Wrover Module or other board with PSRAM is selected // Partial images will be transmitted if image exceeds buffer size // #include "esp_camera.h" #include <WiFi.h> #include <WebSocketsServer.h> // Select camera model #define CAMERA_MODEL_WROVER_KIT // Has PSRAM #include "camera_pins.h" // This must come after camera m
Comments
Post a Comment