BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Image counter for each ESP32-CAM swarm image capture

I have a camera swarm that I need to record capture numbers with their filenames so I can group them together on the webserver they are uploaded to. Each time I capture images I would like each of the modules that took a picture to have the same capture number.

I have been able to write code to increment the capture number each time (image attached), but the issue is that I have to use a bridge which only works with 2 ESP32’s at a time. I could fix this by adding bridges to each module effectively “daisy chaining” them, but that would require a new program for each module and that would be a huge hassle for 16 - 24 ESP32 modules.

Is there an easy way to keep (and preferably even reset) a global capture number that each of the ESP32-CAM modules pull from each time a new image is taken?

I’m using the legacy app to control them.

I don’t really follow what you’re saying here…

Do you mean that the numbers of the captured images should increment sequentially, and that the next image should have the next number in the sequence regardless of which device captured the image?

Pete.

When I hit the “shutter button” all of the ESP32’s that are online will take a picture. I want all of those to have the same capture number. And then the “global” capture number increments by 1. So essentially I’m using it as a way to tell which group of images were taken at the same time.

How is the capture command (the shutter release command from the shutter button) communicated to the various devices?
Is this a Blynk widget button? If so is it connected to a virtual or physical pin?
Are each of the devices running Blynk code, and do they have separate Auth tokens?

Pete.

Each of the ESP32-CAM modules are listed in the app and are under a tag I created. Yes, it is a widget button that uses the tag and connected with a virtual pin.

Yes, they are all running the blynk code and have separate Auth tokens.

Okay, is it feasible for you to designate one of the devices as the master device, and gave that take care of the numbering sequence?
If so, then I think I’d store the next sequence number in a central location. This could be either on the Blynk server or your FTP server.
Each device would then read this number, either via an API call or an HTTP call to your FTP server and use that the next time it saves a file.
The master device would then increment that number after it had taken a shot and saved it.
You slave devices could maybe save their image, wait a short time (so that the master device handles the number incremental in process) then reads the next number.

Pete.

1 Like

:+1: Thanks for the help Pete. That’s what we were thinking we would have to do, so it’s nice to get an opinion that confirms that.

I guess another options is to use your master device to do a Bridge update to each of the devices. You said before that…

but in reality I believe that you can define as many bridges as you wish on your master device, and do consecutive writes to each of them with the same piece of data - the next file number to use.

Multiple bridges are discussed here…

Alternatively, you could do multiple API calls from the master device to update each of the slave devices with the next file number.

Pete.