Our current ESP32-CAM camera swarm is a completly wireless swarm that is capable of caturing synchronized images down to 10ms. The system we have created allows a user to use and Android or iOS app to control the camera swarm. When images are captured they are sent to a web server where all of the images can be downloaded at once. The images collected from the web server can be used in many different applications like 3D modeling or for use in 3D point cloud software.
Each of our completed modules costs only $13.43. When scaled to 256 modules the cost $6.96 per module. This makes this camera swarm an extremely cost effective tool that is a lot more accessible than traditional DSLR focused camera swarms.
The ESP32-CAM modules in our swarm were all programmed to work with the Blynk app. This was mainly due to time constraints and the ease of use. It is setup in a way to perform only a few actions like connect to the Blynk app, save images to an SD card, upload an image via FTP, and live stream video. There are improvements that can be made and it's far from perfect. It satisfied our engineering requirements, which is all we had set out to accomplish.
I encourage anyone that would like to continue this to fork this repository or make pull requests.
The Arduino IDE is what was used for ease of use. It is possible to also use PlatformIO although we have not tested it. It's important to include all of the libraries that you will see in the next section. It is also important that in the change the information in the secrets.h file.
// secrets.h file
#define SECRET_SSID "INSERT WIFI SSID HERE"
#define SECRET_PASSWORD "INSERT WIFI PASSWORD HERE"
#define SECRET_FTP_SERVER "INSERT FTP SERVER IP ADDRESS HERE"
#define SECRET_FTP_USERNAME "INSERT FTP USERNAME HERE" // ex. [email protected]
#define SECRET_FTP_PASSWORD "INSERT FTP PASSWORD"
In order to include all of the necessary libraries for the ESP32-CAM's you need to
add the following additional board manager in the Arduino IDE under File > Preferences
:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
- SD_MMC
- WebServer
- EEPROM
- FS
- WiFi
- And more.
You might have conflicting wifi libraries. You will have to fix this by removing one of the libraries that the error message lists.
- Blynk (Volodymyr Shymanskyy) v0.6.1
- esp32_ftpclient (Leonardo Bispo) v0.1.4
- SD (Arduino) v1.2.4
- Time (Paul Stoffregen) v1.6.1
- Live Stream Functions (Anatoli Arkhipenko, https://github.com/arkhipenko/esp32-cam-mjpeg)
- handle_jpg_stream(void)
- handle_jpg()
- handleNotFound()
- SD Card Functions (Rui Santos, https://RandomNerdTutorials.com/esp32-cam-take-photo-save-microsd-card)
- SD_MMC.begin() // Check to see if sd card is mounted
- SD_MMC.cardType() // Check card type
- FTP Functions
- FTP_upload(void)
- Main Logic Functions
- setup()
- loop()
- take_picture()
- Blynk Functions/Methods
- Blynk.run()
- BLYNK_CONNECTED()
- BLYNK_WRITE(V5)
- BLYNK_WRITE(V10)
- BLYNK_WRITE(V12)
- BLYNK_WRITE(V14)
- Misc. Functions
- deep_sleep()
- ipAddress2String(const IPAddress& ipAddress)
This firmware for the ESP32-CAM is not perfect. We encourage people make improvements as they see fit. Most of the code is to be specifically used with the Blynk Legacy mobile app. If you wish to use your own app it would need to be changed substantially.
One big improvement would be programming the ESP32-CAM modules to take an image at a specified time. This is something we were not able to accomplish with the current version of the Blynk app, but will be coming soon as dicussed in more detail below.
We chose to use the Legacy Blynk app to control our ESP32-CAM camera swarm. It's not a perfect solution, but is much more convenient than writing your own app to fulfill the same functionality. There are a lot of great things you can do with the Blynk app, however we have chosen to use what we believe to be the bare essentials necessary to control and effectively use the camera swarm.
Below are some images of the basic setup of each ESP32-CAM module and how to add all of the modules to one tag. In this case, we named the tag "All", but you could name it whatever you like. Having all of the modules with the same tag allows us to use one button to capture all of the images from each of the cameras in the camera swarm simultaneously.
The most important part of the setup is that you get all of the Authorization tokens (emailing them from the app is easiest) and add them to the section of code below. Make sure you only have one authorization token uncommented at a time. For each ESP32-CAM that you program you need to uncomment a new token and change the `cam_module` number to the current module you are using. This will allow you to identify which module each picture came from and helps with troubleshooting the modules.
String cam_module = "4";
//char auth[] = "MODULE 1 AUTH TOKEN HERE"; //1
//char auth[] = "MODULE 2 AUTH TOKEN HERE"; //2
//char auth[] = "MODULE 3 AUTH TOKEN HERE"; //3
char auth[] = "MODULE 4 AUTH TOKEN HERE"; //4
//char auth[] = "MODULE 5 AUTH TOKEN HERE"; //5
// etc...
While we chose to use these specific components to accomplish what we needed to accomplish, you can choose what you you need and can remove the rest. Just make sure to remove the code for components that you aren't using.
There are improvements coming to the Blynk app that will allow for all of the components to be controlled via the Blynk Cloud web dashboard. This would greatly improve the usability and would elimintate the need to use a mobile phone. Being able to send specific signals such as a time in order to schedule an image capture would greatly improve the synchronization times of the images. We have been told that a lot of this functionality should arrive in Q2 2022.
Until then we highly recommend using the Legacy Blynk app and not the Blynk IoT app.
The web app that we have included in this is a PHP site displays the last images captured as well as images by each module. It is very basic, but allows you to collect all of the images in a zip file which is extremely useful when you need to import the images in other programs.
The login system is something that was added to make sure that people couldn't see the images that were captured unless they had a login. For this specific demo we have a default user and an admin user. Only the admin user has the ability to delete images.
It is highly recommended that you change these usernames and passwords!
-
Default User
- Username: user
- Password: password
-
Admin User
- Username: admin
- Password: password
The usernames and passwords are defined as seen below in an array in the `login.php` page and should be changed.
$logins = array('admin' => 'password','user' => 'password');
- Web Server
- Apache
- PHP v7.0 (or later)
- Optional
- Web hosting
- Domain name
A better way of sorting the images would make this a lot better. Right now it relies on the file name of the images to sort them. This is obviously not ideal.
We went through 5 different iterations of the PCB which can be found in the `pcb-shematic` folder. Many of the changes from version to version were to make the footprint as small as possible and to make changes to the battery connector. The battery connector is a part that likely needs to be changed with a better connector for the battery we used. Since we couldn't find the exact battery connector we made our own part in Autodesk Eagle.
It's highly recommended that you use these PCB schematics as a starting point for your own, unless you use the exact same parts as we did.
The tolerances are really tight with the PCB. This is intentional as it allows the battery to fit against the leaf springs in the battery connector. It is however not as reliable as we would have liked it to be and improvements to the how the battery sits in the housing can and probably should be made.
The tolerances between the two pieces of the case are also tight and will likely vary with different 3D printers. This is an area which may need improvement.
Below is a parts list for all of the different parts required to make the completed product. Most of the items can be found on Amazon, but some are specialty parts like the PCB and battery connector.
Device | Manufacturer | Item |
---|---|---|
ESP32-CAM | espressif | Camera Module |
BP-70A Battery | Kastar | 3.7v Lithium-Ion Camera Battery |
DC-DC Step Up Power Module | Weewooday | Boost Converter |
TP4056 Charging Module | Weewooday | Battery charging circuit |
1.75mm PLA Filament | SUNLU | Product Housing |
2 Position Slide Switch | Tnuocke | Power/Programming switch |
Custom PCB | jlcpcb.com | PCB for each module |
8-Pin Socket Connectors | Comidox | Headers for ESP32-CAM |
3-Pin Leaf Type Connector (1746142-1) | TE Connectivity | Battery Connector |
The boost converter that we used easy extremly sensitive to heat therefor hard to solder without destroying it. It is recommended that is be switched out for a more durable and reliable boost converter.
The battery connector is not meant to be used with the specific battery we are using. It is close to being the right one and will work, but it is recommneded that you find a better connector if you plan to use that same battery.