Electronics > Projects, Designs, and Technical Stuff
ESP32 CAM Module Setup using Arduino
(1/1)
Gandalf_Sr:
You know how it is, you're shopping on one of those Chinese web stores and you have a $4 item in your cart and want to get something else interesting because shipping is going to be the same for 1 item or 2. Well I recently bought a 3.2 TFT display from Banggood.com and added a $12 ESP32 CAM module complete with OV2640 camera and yesterday I set it up so I thought I'd share my experience here.
Mini Arduino Primer
If you are familiar with the Arduino integrated development environment (IDE) you can skip this part and jump down to the ESP32 CAM part below. The Arduino platform has evolved from a simple development environment interface that supported a not very powerful 8 bit processor PCB with a weird 'shield' header setup with libraries (that you had to find and add yourself) into one that's been expanded to support multiple kinds of Arduinos (and clones) and many other cheap development platform PCBs that include the ExpressIF ESP8266 and ESP32 modules which are interesting in that they are a) cheap and b) powerful c) have WiFI capabilities built in. I wasn't a fan of the Arduino IDE when I first tried it but it has truly come of age - here are my pros and cons:
Pros
1. Many different hardware platforms are supported although that has some downsides as code examples often have to be tweaked to work with different platforms
2. Driver libraries are ubiquitous, easy to find, install, and update - this is the real power of the IDE
3. There are often many example programs that are offered to you by the IDE after you add in support for a specific board/platform.
4. There are many sites such as Sparkfun and Adafruit that have some great articles and videos walking you through step by step.
5. There are 1,000s of shields and many non-Arduino evaluation boards have adopted the shield header format to allow their hardware to use Arduino shields.
6. The code and drivers are all free and Open source, you just have to buy the hardware.
Cons
1. I don't like it that most of the examples and drivers are written in C++; I want them in C to make them portable to other IDEs but I guess that's my problem.
2. There are at least 3 different versions of the shield header that try to be hardware compatible but it can be confusing
3. As the Arduino caught on, they brought out newer and better versions such as Uno, Due, and Mega and these have been cloned but some clones are real clones in that they are (or claim to be) 100% compatible with the real Arduino boards. Then there are clones that look like one of the real Arduino PCBs but carry a different processor e.g. ExpressIF.
4. There are voltage differences and incompatibilities between Arduino PCBs & clones; the first ones were 5V only, now some are 5V & 3.3V with selection jumpers, and some are 3.3V only. Shield manufacturers have tried to keep up with this using things like voltage level translators but it's a jungle and you can end up with shields that just don't work or, worse still, shields that will fry if you plug them into the wrong platform.
But here's why I use the Arduino IDE - take the example of the 3.2 TFT display I was originally shopping for; I want to prove that it works and figure out how to talk to it. Well, if I find a code example for the Arduino, all I have to do is plug it into (the right) platform PCB and , load and run it. I can then study the hardware connections, sniff the busses, copy the libraries (it's all Open Source) into my own IDE and adapt the drivers to my needs.
ESP32 CAM
So I followed the instructions for setting up the ESP32 CAM module here and it just works. The link is pretty accurate but I have a few comments to add.
1. The schematic for the ESP32 CAM shows that the 5V supply goes into a 3.3V linear regulator. Many people claim it doesn't run reliably on a 3.3V supply so I provided my power from a 5V (measured 5.2V) 2A wall power supply and it worked well.
2. I used a cheap FTDI serial PCN just like in the pictures in the randomnerdtutorials link but make sure you set the voltage jumper to 3.3V
3. Once you've compiled and loaded the code, you need to set the Baud rate for the Arduino serial port to 115,200
4. You don't have to use the Arduino IDE serial monitor program, any other one like Tera Term will work.
5. Once you know what the IP address is for your ESP32 CAM and type that into your browser, you will see the OV2640 camera controls and you need to scroll to the bottom to find the [Start Streaming] button
6. You can remove the control bar by clicking on the =OV2640 camera text at the top and you'll just see the picture
7. My picture looks slightly out of focus, I think there's a tiny lens that I can adjust on the camera - I'll let you know
There's also a pretty good video here although the URL they gave that ends in json wasn't the right one.
If anyone has tweaked the code to add functionality, please feel free to chip in here.
Raj:
I hate C++ too
For most 5v arduino, you can just yeet out it's voltage regulator and it's crystal for a slower one and use it with 3.3v....At most, you'll have to jump a pad or upload a new boot loader, (which, most of the times, I remove for more space, anyways).
Same goes for the sensors....if they have a voltage regulator for 5v to 3.3v, I just yeet them out when using it with esp series micros.
Even when arduino was made for arduino boards....For most of my projects, I only use it for creating hex files that I upload directly onto microcontroller on my own custom board instead of using a carrier pcb
What's worse thing about the clones...most of them share the same processor as the original like the metro 328 which is same as nano but way more expensive...Why, just why?
Gandalf_Sr:
--- Quote from: Raj on May 16, 2020, 08:38:43 am ---I hate C++ too
For most 5v arduino, you can just yeet out it's voltage regulator and it's crystal for a slower one and use it with 3.3v....At most, you'll have to jump a pad or upload a new boot loader, (which, most of the times, I remove for more space, anyways).
Same goes for the sensors....if they have a voltage regulator for 5v to 3.3v, I just yeet them out when using it with esp series micros.
Even when arduino was made for arduino boards....For most of my projects, I only use it for creating hex files that I upload directly onto microcontroller on my own custom board instead of using a carrier pcb
What's worse thing about the clones...most of them share the same processor as the original like the metro 328 which is same as nano but way more expensive...Why, just why?
--- End quote ---
Raj, "yeet" is a word I'm not familiar with, a Google search told me this...
--- Quote ---Yeet is an exclamation of excitement, approval, surprise, or all-around energy, often as issued when doing a dance move or throwing something.
--- End quote ---
But I think you mean take or yank it out?
Anyway, it seems you share my frustrations on the lack of processing power in Arduionos in general. 2 or 3 years back, I got into Cypress PSoCs which I find very easy to work with although the driver aspects aren't as easy to handle as Arduino.
For instance, you can get a PSoC6 Evla PCB, the CY8CKIT-063-BLE for $20 (free at trade shows) and it's got a dual core Arm M4/M0+ processor with:
■ 1 MB Application Flash with 32-KB EEPROM area and 32-KB Secure Flash
■ 288-KB SRAM with Selectable Retention Granularity
■ Up to 36 GPIOs with programmable drive modes, strengths, and slew rates
■ Bluetooth 5.0 qualified single-mode module
These specifications make an Arduino Mega 2560 look pathetic in comparison.
The IDE to develop in is called PSoC Creator which I love but, annoyingly, Cypress is moving across to something called MODUS toolbox for the IDE that supports all new PSoCs and that's a learning curve I haven't negotiated fully yet. MODUS is Eclipse-based and they are clearly doing a lot of work on it but it's still not quite there for me yet. This has been complicated by the fact that Cypress was bought by Infineon recently.
Anyway, the CY8CKIT-063-BLE can be programmed from PSoC Creator but it's not easy to set it up, you have to follow the steps in this document; instructions to get PSoC Creator set up to work with the CY8CKIT-063-BLE start on page 15 , don't forget the step of installing support for the PSoC 63-based EZ-BLE Creator Module.
I own Arduinos as the basis for testing out drivers which I'd like to be able to port over to PSoC Creator; I did find this article recently that shows how to force PSoC Creator to use C++ as well as C when compiling which, if I can figure it out, would make using the Arduino libraries much easier.
Raj:
--- Quote from: Gandalf_Sr on May 16, 2020, 10:21:02 am ---.
--- End quote ---
Yup..yeet is zoomer term for throwing away in anger...
what are you making that requires so much processing power?
Gandalf_Sr:
I know it sounds like overkill but the dual core processor is pretty cheap and, what I love about it is that you can keep on adding code and never run out of space, I've done projects on the PSoC 4000 and ran out of flash space. Having 2 cores also allows you to have a real time system like a power supply PID control and then have the second processor core handle all the communications.
I have several projects in mind but some sort of autopilot system for a smallish boat is one, a triple bench power supply is another.
Navigation
[0] Message Index
Go to full version