-
Moved butterworth over to ESP32
03/04/2019 at 00:27 • 0 commentsThe process of moving my filtering from JS up to the esp went very smooth. I couldn't get the esp8266 to hold it but had no problem with the esp32.
Currently am using a 100Hz 2nd order butterworth with poles at 0.5 and 25 Hz. Raw data averages are needed on the client side to calculate SpO2 concentration and adjust led brightness which are calculated by the esp and transmitted in the tcp return packet.
Also learning my way around github and plan to pub code and instructions shortly.
-
ESP32 and MAX30102 - massive upgrade
03/02/2019 at 18:09 • 0 commentsA couple of days ago I got my first ESP32 module and a MAX30102 module and decided to upgrade.
The ESP32 is a real good upgrade - I tripled my tcp update rate and doubled the max30102 sampling rate to 100Hz, while decreasing the number of dropped packets by 95+%. The ESP32 has much more memory so my buffer sizes are no longer an issue and don't have to worry about task stack allocation sizes.
I feel emboldened to move the dsp ops over to the esp, including butterworth filtering, raw data averaging and floating point conversion.
My daughter is attending a 'Girls Who Code' Club meeting over at WPI this winter and is learning some html coding - so I got her on the rope to add at least a few style tags to the html page.
ps. Upgrading from esp8266 was not bad. I am currently maintaining separate IDF toolchains (but it looks possible that the esp32 tools might work with the 8266 as long as you configure in menuconfig - which would be worth doing), some of the library functions changed slightly but we're talking 99% of code portable.
-
ESP8266 Heartrate Moniitor
02/28/2019 at 18:26 • 0 commentsThis project collects data from a max30100 heart rate monitor device and presents a webpage to a connected browser displaying the real time data as well as the dsp derived Pulse Rate and Oxygen concentration results.
Here we are using the Espressif IoT Developemnt Framework to compile user application code, build the ESP code image and flash it into the ESP device. The setup is pretty easy and well documented on several websites.
The ESP device establishes a wi-fi connection, then configures the max30100 to collect 50 samples per second of red and IR data. It then continuously runs two tasks: a) read max30100 buffer pointers and construct a read of available sample data with I2C bus, configure data into words and load into local buffer, b) setup tcp server socket and listens for http request. When http request packet is received it is parsed to extract whether it is requesting a) a file, like index.html or index.css or a js file, b) a request for a data string dump or c)a POST append containing variables altered within the client browser (or a curl command).
This nets a single C program with no non-ESP8266_RTOS_SDK dependencies of about 300 lines, most of which were cut and pasted from the sdk examples folder. The other coding portion of this program is an .html (about 200 lines) that is embedded in the esp read only memory at compile time (if referenced in component.mk). The .html file is served via tcp to your browser when the esp's url is addressed.
The JavaScript in the .html runs a setInterval function a few times a second to make a tcp HTTP Request to the esp to getData it them performs a bunch of bookkeeping for each plot update cycle : a)control of plot modes, ie run/pause, display data type raw/filtered b)send POST variable data from browser tags to esp (for things like controlling led brightness) c)downloads plotly.js for handling graph real time output display d)formats data returned from esp into plotly format e)performs dsp operations to bandpass filter (4 pole butterworh) raw data and extract and display heartrate and oxygen concentration measurements.