I had the GUI and did know how to do the "shot" captures based on streaming video and not based on still images yesterday:
https://www.esp32.com/viewtopic.php?f=1 ... 710#p45710
Today I solved the issues left, biggest was to realize that doing "window.stop" to stop MJPEG streaming did show the last captured frame nicely only with Firefox (sorry Chrome).
I had learned earlier how to do µs precision waveforms with ESP32 RMT component.
Today I did wire all together, and built complete "miniature global external shutter" (I started with complete room dark with v1 camera, then reduced to a dark moving box, and now I ended up with a 22cm×16cm×11cm cardboard box):
This is the inside, just ESP32-CAM module and fast rotating mini drone propeller:
I still did not make use of the cable soldered to flex cable connector pin10 of ESP32-CAM module, so no global shutter videos yet. But a single shot scenario with rolling shutter does work already, with these menu settings:
Yesterday I thought that I do not need the offset input, today I realized that I do need it, but had to change its unity from µs to ms, I will explain below what that value is used for.
And this is the 800x600 frame captured with above settings (after many tries, because I have no mechanism yet to sync the timings to frame start (that is likely to come for free with FREX mode later). It stayed after having pressed doit button, that did a 550µs length flash with GPIO4 connected ESP32-CAM internal flash led only(!). Mini drone propeller normally get powered from 3.7V lipo, but powering from laptop USB with 5V does not do harm besides just rotating faster (more than 27000rpm instead 20000rpm):
Before describing the new features implementation in more detail, we can use this frame for propeller rpm determination. The 550µs flash length lights roughly 1/4 of a full rotation. Speed is therefore 1000000/(550µs*4 )= 454rps = 27272rpm (that is 48.5m/s or 174.6km/h radial speed at blade tips).
The changes to index.html are:
- adding a doit button and changing offset unity from µs to ms
- make "function updateConfig (el)" correctly deal with type="number" input
- hide "Flash" group when enetering any global external shutter mode
- add doit button JS running in browser, doing synchronous sleep for offset milliseconds before stopping stream
Code: Select all
+ const doitButton = document.getElementById('ges_doit')
+ const ges_offset_value = document.getElementById('ges_offset')
+
+ function sleep(ms) {
+ return new Promise(resolve => setTimeout(resolve, ms));
+ }
+
+ async function doit(ms) {
+ updateConfig(doitButton)
+ await sleep(ms)
+ stopStream();
+ }
+
+ doitButton.onclick = () => {
+ doit(ges_offset_value.value)
+ }
+
The changes to app_httpd.cpp are:
- adding only "shot" mode for doit button for now
- use an array of two rmt objects, one for GPIO4, the other for GPIO13
The complete changes can be found in this (not that big) commit:
https://github.com/Hermann-SW/Raspberry ... 8da9cce6cd