3 ms·
Fantastic that you're able to track down your health issues. One day I really want to get into making health tracking sensors. Oh I've read about the ESP32 ADC
by elcritch 6y ago
Fantastic that you're able to track down your health issues. One day I really want to get into making health tracking sensors.
Oh I've read about the ESP32 ADC being pretty non-linear, but the racey issues are new to me. Do you have example code/repo for how you use the I2S to read the ADC? I'd like to add it to my ESP32 wrapper library (see `elcritch/Nesper` on GitHub)). It's mostly started as Nim wrapper's for the ESP-IDF api's, but it is letting me wrap certain errors conditions in the ESP-IDF and configure workarounds. Mostly small stuff, but handy.
- sgtnoodle 6y agoDue to all the medical scans I've had done, I can confidently say that my heart is in perfect health other than the nerves being flaky. The pacemaker is a nearly flawless replacement, but it has its technical limitations. It's been very handy to see what's going on when my heart is beating funny. Here's the relevant section. I was getting pretty fed up with battling the ESP32, so it's probably not the prettiest. http://sgtnoodle.com/files/adc_snippet.txt http://sgtnoodle.com/files/adc_snippet.txt The function runs as an RTOS task, woken up once every millisecond by a timer. I also pinned it to one of the two CPUs because I was originally doing software triggered sampling at 8Khz. The timer and pinning is rather overkill since I2S clocks the sampling and has tons of buffer. In an effort to get better data, I have the I2S sample at 40Khz. The function copies the samples out the I2S buffers, and down-samples to 8Khz. The 8Kz samples are pushed into a circular buffer that uses a std::atomic head pointer to make it thread safex.
- elcritch 6y agoThanks! I'll take a look at it and try and port it over. Hopefully it'll help some other poor souls (possibly myself) who have to deal with the same issues.