-
Notifications
You must be signed in to change notification settings - Fork 91
Esp32: Add camera module #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for filing this issue. I have a report from another user that they were able to successfully modify the firmware to include the micropython-camera-driver. I'm hoping to get the steps from them and then can apply it. I think the out of the box build is for esp32-cam-mb. I don't have that esp32 board setup but can add as part of this issue. What board are you using? |
Hi @gigwegbe |
Do you have an esp prog board? It's an external jtag board that you can connect to an esp32 board. You can use it with visual studio code to debug on the device. I know the steps to get it and the stm32 st-link connection to work but haven't documented it yet. Actually I know the more complicated steps of letting me run the part that talks to the board in windows while I debug on visual studio code within the windows subsystem for Linux. In this case you see some existing error handler is catching and failing. You may be able to just search for the message to find the handler and then log something extra . |
@mocleiri, |
Personally I only have cheap esp32-cam boards and I use these for my tests. I guess however, that the firmware may also work on different esp32 boards with 4M flash and PSRAM. However, I am not sure. You will have to try. |
@uraich the cmake flag to point at an external/out of tree component is:
I'm looking into #9 to incorporate the accelerated esp tflm kernels and that is how the espressif repo is bringing in esp-camera for the C++ person detection example. We may move the accelerated kernels up into tflm but at least to start with the esp-camera module could be resolved through the esp-camera component coming in from https://github.com/espressif/tflite-micro-esp-examples. |
@gigwegbe I am happy to add additional board configs into the project. All I need is a pointer at the board configuration you are currently using and then I can bring that into the project and adapt it to include the right modules, etc. If you are able to use one of the generic board configs then that would also be useful to know for improving the documentation. i.e. a known to work boards list. Please file a separate ticket. You can include all 3 boards in the same one. That will get things setup so that once this issue resolves there will be a firmware automatically created for your particular board. |
@mocleiri : For the moment I have a working firmware on the esp32-cam with the camera driver included and I tried the person detection example from your repository. Here the result:
|
@uraich those are amazing results! Congratulation on getting it all working. I think the easiest way to fold your changes back into this repo is to file a pull request. I know you have micropython changes so just extract a patch of your changes and include as a file in the branch you make the pull request on. $ cd micropython I'll try my best to incorporate them without needing to modify upstream micropython. However I will if that's what is needed. |
I have still improved the program a little: I now light the flash light, incorporated into the ESP32-cam, when a person is seen and I switch it off when no person is around. This works rather well. I had to use PWM to diminish the light intensity, which is extremely bright otherwise.
|
As desired, I created a pull request. |
I made some adjustments to your pull request and have merged the combined work in e6e2a4b I'm working on getting it to run via a github action. Recent commits have gone into micropython which change how the malloc allocated heap works and they leave 50% of the available space for non micropython purposes. I adjusted the micropython patch to force micropython into the same mode when SPRAM is being allocated using malloc. So we get a 2 MB heap and there is 2MB available for esp32-camera to allocate. |
I got the github action working: https://github.com/mocleiri/tensorflow-micropython-examples/actions/runs/1767505151 I just downloaded and flashed my m5 timer camera and inference still works. @uraich can you download the microlite-spiram-cam firmware from the above action and report back if it still works for you? @gigwegbe I checked all 3 boards you posted and they all have 8 MB SPIRAM and 4MB flash use the ov2640 sensor. Can you try the above firmware and report if they work for you? If it doesn't work I'm happy to add other board configs. I hope there is enough info here on how to run it: https://github.com/mocleiri/tensorflow-micropython-examples/blob/main/examples/person_detection/README.md#running-on-an-esp32-with-a-camera |
@mocleiri : As requested I tried the new version and it works the same way as the version for which I made the pull request. Excellent! I downloaded the binaries but did not know how to flash them (and was too lazy to look it up). I therefore built the firmware from scratch, using the upgraded repository and following the instructions in build_esp32.yml. |
Thanks again for your contributions and testing that I got it right. I can never remember the flash options either. I have them on the README although they are so far down now: https://github.com/mocleiri/tensorflow-micropython-examples#flash-from-windows I´ll correct those extra s´s. |
Thanks for the link. This shows how to do it from Windows but for Linux, just the serial port must be adapted. |
I´m closing this as it has been integrated. @gigwegbe please open new issues if there are any issues with your specific camera boards. I´m happy to add additional board configs. |
Hello @mocleiri,
I recently came across your awesome project and you are doing a great work, I have tried a couple of the example projects. I will want to replicate a similar project but this time with esp32. So far, I cannot find the camera module for esp32, I will appreciate if you can add camera module to your firmware. You can check out micropython-camera-driver. Thanks.
The text was updated successfully, but these errors were encountered: