M5-Camera A connect with Android App for parking aid
-
I am very new to the M5Stack and the esp32 chip. For a project in university I would like to build a wireless parking aid using the M5-Camera type A. Therefor I would like to have an android app which automatically connects with the esp32 chip´s Wi-Fi. With the video stream in the app I could overlay it with some information or do further operations in open CV.
My thought was a Wi-Fi p2p connection between the esp chip and the android phone. I searched now for quite a while but didn´t found some example projects at google, so I need the help of the M5Stack community.Is there a way to get the stream inside the android app and which data type would it be?
How can I send the desired settings from the phone to the esp32?
Do you know comparable projects where I can find more information?Thanks for helping me out and the understanding for my (I hope not so) noob questions.
-
There are several ways to connect the camera and the Android app each with it's own problems.
But first you should describe how the app will be used in more detail.
Will it be a designated unit or a mobile phone?
Will you start the app manually or do you want the app to start when the car is in reverse, under a speed limit etc?
Connection can be either in AP or ST mode.
Image can be jpeg or consecutive jpeg for http: or mjpg for rtsp: with current example projects.
As for now I'm only aware of 3 base examples, original software , CameraWebServer and micro-rtsp.
Android IDE with the esp32 plugin has a example "CameraWebServer" that sends settings back to the camera by a web interface.
Although not sure why you would like to send the settings as they should be hard coded.As for the Android end an app is not really needed as it can all be done in a browser which might explain that you have not found much in the way of examples.
So basically you open a app with a browser plugin
You could look at some security camera apps or open a app with a Vlc-plugin but then you would probably have to use micro-rtsp.
Using Vlc would also make it easy to do the overlay.This would be good as a project but it can not be used as a parking aid as you would probably not get below 0.5 seconds in delay.
It might be possible to go below that if you rewrite the code to send the picture in raw format if wifi bandwidth allows it. -
@christian_yami We have not provided any cases related to adapting Android applications for the time being. We have a case of reading webcam images on a webpage. If you need it, you can refer this link.
https://github.com/m5stack/m5stack-cam-psram -
Update on my project:
I was able to get the JPEG image from the stream of the esp32 using the Glide library. I did not touch the esp32 because the program provided by M5Stack on it works just fine. I am now able to provide the android app a bitmap and a PNG file for saving on the android phone and further operations like I mentioned in my first post.
Thank you for your help @Net-time. For other people who might be interested in the project I want to answer your questions:
The app will be running on the android phone and no other device besides the esp32 and the camera is needed.
The app will be started manually. If I am able to implement it it will be showing an error message if the car speed (measured by the GPS of the phone) is above a given speed.
The settings should not be hardcoded because every single smartphone has a different performance of the CPU. Therefor some can handle larger images and some not. The fps should not be below 10 or 15 fps so the user has to have the chance to select the image quality.
I would like to have an android app for this project because it is way easier to click on an app icon, then open the web browser and do all things manually. In addition to that i can add sensor values or other things on the screen when other students provide me the information via Bluetooth. Opening an app with a browser plugin slows the whole process down and do not look good for the user.My only problem for now is to send the settings the user wants to the esp32. But this is more of an android programming issue.
-
@christian_yami
As mentioned before the Android IDE with the esp32 plugin has a example "CameraWebServer" that sends settings back to the camera by a web interface.
I did not mention that it also displays the image so if you load that into the esp32 you only need to do the android bit. The JPEG bit is the same and the web page source
should give ample clues to program android.