Notifications
Clear all

Running CameraWebServer on Elegoo esp32 with camera fails, returns error

31 Posts
3 Users
16 Likes
3,135 Views
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2524
 

@zander @leonardo1123

I think there's still a (small) chance that it's just under-powered, the camera takes a lot of juice.

Anything seems possible when you don't know what you're talking about.


   
Leonardo1123 reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6954
 

@will Good point but I thought he was using a laptop, that's plenty powerful enough, No?

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
Leonardo1123 reacted
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2524
 

@zander @leonardo1123

Yes, the laptop should be an adequate supply, but it is running through the USB interface which has a limited draw. That limit may be preventing his circuitry from getting enough current to run the camera and it may therefore be browning out at a critical time.

I know it's a (maybe very) long shot, but I think it'd be worth trying before discarding the module. I'll shut up about it now 🙂

Anything seems possible when you don't know what you're talking about.


   
Leonardo1123 reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6954
 

@leonardo1123 Do you have a board similar to this one or just a 'normal' ESP32 (NO camera on board)?

"https://www.amazon.ca/gp/product/B09M83D2NX/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1"

NOTE change domain to your country domain.

VERY IMPORTANT: Is the board you are playing with equipped with a built-in camera?

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
Leonardo1123 reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6954
 

I have to go out for a Dr appointment soon, but when I get back I will hook up one of my boards and show you what the serial output looks like, then disconnect the board from the laptop and show it working.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
Leonardo1123 reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6954
 

@will @leonardo1123 NO, don't. It is possible although slight. In my case I am connected to Thunderbolt 4 so have something like a 100 watts or maybe more available, not sure what he has.

His concern is that once he unplugs the laptop he can't see his serial log anymore. My point is simply that a non damaged board of a recognized type like AI-Thinker ESP32-CAM will work, no need to see the serial at all. I am quite sure his board is the problem since it is a knock off and not an approved board. I tyhink he has proper boards on order already.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
Leonardo1123 reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6954
 
Posted by: @leonardo1123

@will Gotcha! Yeah, right now I'm just powering it from my laptop. Unfortunately, I don't have a great way of supplying better power without unplugging it from my laptop, and then I'll lose the serial information like the IP of the webpage. 

Maybe I'll try Bluetooth serial...

Remember, once the sketch is uploaded you can disconnect from the laptop, plug in a better power supply and click the reset switch. Now just browse to the IP it is using as determined by an ip scanner of your choice (it is likely the same as before) and if it was a power problem you will see the MotionOS opening screen. If you don't see the screen and you can ping the IP then the board is bad or non-compliant, get a better name brand board. You can also quickly add WiFiManager so you don't need an ip, just an SSID IIRC. Check Bill's video on WiFiManager, I modified my camera, maybe 5 lines of code or less.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
Leonardo1123 reacted
ReplyQuote
(@leonardo1123)
Tinkerer
Joined: 3 years ago
Posts: 56
Topic starter  
Posted by: @zander

@leonardo1123 Do you have a board similar to this one or just a 'normal' ESP32 (NO camera on board)?

"https://www.amazon.ca/gp/product/B09M83D2NX/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1"

NOTE change domain to your country domain.

VERY IMPORTANT: Is the board you are playing with equipped with a built-in camera?

Hey @zander, sorry for the delay, took a nap then went off to work. 

Here's some pictures of the board that came with the kit:

image
image

 The camera does work, as I have tested it with the stock code that came with the robot. 

In running my own code on the board, I've managed to utilize the WiFi features of the board, but not the camera. To be clear, it did come with the camera, and I've done nothing to it to reasonably expect it to have broken between testing it with the stock code, and trying to get it to work with mine. 

When I get home, I'll try the proper power suggestion. I'm still confused as to the meaning of the two errors. It seems the error I referred to as "no cam" implied that I shouldn't be using that definition at all. 

The malloc errors seemed to suggest that it was the correct board, but I was not interfacing with it correctly. 

So, either this board is subtly different from the other definitions in the list, or it is that power options. Because am I correct in assuming that the SimpleCameraServer example sketch should work with an esp32 with a camera on at least one of the board definitions? 

Very new to esp32, thanks for any and all help. 

Fortune Favors the Bold


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6954
 

@leonardo1123 So the ONLY difference is the code? Hmmm, I wonder what the SOURCE of the problem might be???? Sorry, I had to do that. Why so gung ho on rewriting working code? I have over 5 decades of experience and I wouldn't do that unless there was a REALLY good reason, and even then I would only change/rewrite/write what was absolutely required. In fact I did modify the code to implement the WiFiMgr function the way Bill told us about.

The errors you are getting are extremely likely to be as a result of the wrong library being used. The library and ultimately the implementation of various API elements and functions are determined by the #define you choose. My best guess is that the camera you have is NOT one of the supported cameras.

If you are determined to write all the code yourself, you will need to understand EVERY code path through the sketch you are using for every #define in that camera selection group. With over a half century of experience that is not something I would relish unless I was being paid my normal hourly rate with an unlimited budget. 

I don't know how many thousand hours of experience programming you have, but unless you are super new, you should understand that a malloc call is a high level abstraction in the C and C++ language that results in low level assembler that will need to access certain hardware features that may be unique per board (thus the #define) in order to reserve the memory needed for the frame buffer (the place the pictures are temporarily stored).

Since you say the camera worked out of the box we know it is possible. Obviously you don't have the source code they used to build that product otherwise you wouldn't have this problem.

I just took a close look at mine, and they are not AI-Thinker either, but that #define works. When I do a board select I use the AI-Thinker, what do you select for a board in the IDE?

 

Key facts to keep in mind.

The board library used is determined by the board you select under the Tools menu in the IDE

The #define you uncomment MAY have an effect inside other includes via the #if defined method INCLUDING library header or .cpp modules. Remember, the libraries are in source format and are re-compiled as needed.

These are the reasons I would be EXTREMELY reluctant to just go off and try to write a camera sketch from scratch. Not saying it couldn't be done, but WHY?

 

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@leonardo1123)
Tinkerer
Joined: 3 years ago
Posts: 56
Topic starter  

@zander I'd say two main reasons: 

First, that's my MO. I'm the kid who never copied and pasted code, but studied it until I understood it and implemented it myself. I'm not talking about rewriting whole libraries, but when it comes to the high-level communication between all the functions, I want to be solely in charge of that. 

Second, Elegoo makes great, quality products, but have really low offerings in terms of further customizing the code. The reason I didn't post excerpts from the source code is that even after downloading their whole zipped project, it seemed I was missing libraries or something to even get their code back on my esp. 

I'll see if I can make heads or tails of the source code, otherwise the new esps arrive tomorrow. 

Fortune Favors the Bold


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2524
 

@leonardo1123 

IIRC people who have had problems with Elegoo robots in the past have reported here on the forum that their product support was very helpful. When you get truly desperate, you might try asking them about your problem(s).

Anything seems possible when you don't know what you're talking about.


   
Leonardo1123 reacted
ReplyQuote
(@leonardo1123)
Tinkerer
Joined: 3 years ago
Posts: 56
Topic starter  

Fortune Favors the Bold


   
ReplyQuote
(@leonardo1123)
Tinkerer
Joined: 3 years ago
Posts: 56
Topic starter  
Posted by: @will

@leonardo1123 

IIRC people who have had problems with Elegoo robots in the past have reported here on the forum that their product support was very helpful. When you get truly desperate, you might try asking them about your problem(s).

Sounds good! I have a message in to them already, I hope to hear back by morning!

Fortune Favors the Bold


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6954
 

@leonardo1123 Please do not post the entire sketch. Just post the error message that is the first one, and the line of code it refers to plus maybe a half dozen before and after.

If you KNOW the error is caused by missing header files then that is usually caused by not specifying the correct board, or by not including the appropriate libraries. Fix those errors and try again.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
Leonardo1123 reacted
ReplyQuote
(@leonardo1123)
Tinkerer
Joined: 3 years ago
Posts: 56
Topic starter  

@zander After playing around with which board to have selected, I was able to upload the CameraWebServer sketch to the esp. That "headers indicate board issue" tip was very helpful. 

Now, I'm not super familiar with working with cameras, but I'm looking at the web server, so that's way more progress than I was expecting. Now time to figure out how to start a stream beyond hitting "start stream." I've been playing around with resolution thinking that may be the issue. 

 

image

Fortune Favors the Bold


   
Ron reacted
ReplyQuote
Page 2 / 3