Page 1 of 2

ESP32 Bluetooth command to take a picture

Posted: Fri Oct 21, 2022 4:27 pm
by stefan.erni
Hi to All

I am looking for commands to control an Android or Iphone with an ESP32 via Bluetooth.
There are already small cheap devices that do that.
But I would like to fire two additional flashing LEDs with the ESP32. These LEDs are small and very bright for a short time.

Does anyone know this Bluetooth command code?

regards


Stefan

Sample small device.
BT Command_2022-10-21_17-16-11.png
BT Command_2022-10-21_17-16-11.png (271.47 KiB) Viewed 6619 times

Re: ESP32 Bluetooth command to take a picture

Posted: Sun Oct 23, 2022 2:49 pm
by mnfisher
Hi Stefan,

I guess you would need a small app running on the phone - I've thought about this for photography and have seen the remote shutter switches. I'm also trying to think of a way to interface a bike radar to an esp32 - rather than having my phone strapped to the handlebars.

It might be possible to look at the Bluetooth traffic and see what data is being transferred. It would be fairly easy if can connect to a PC not so easy if it's BT LE?

Martin

Re: ESP32 Bluetooth command to take a picture

Posted: Wed Oct 26, 2022 8:42 am
by stefan.erni
Hi Martin

It's not using an app. Just connect to the Iphone or android phone. You have to open the camera and thats all.
If you press the button it's focus and take the picture. If you press the button long it's take a video.

I don't know if it's a remote profile or SPP, but not BLE
I'll keep looking and keep you informed.

For your bike radar I can recommend that to you:

https://www.mouser.ch/ProductDetail/M5S ... 52BQ%3D%3D

I used it and post a Demo. It's include a akku, screen, USB C , Bluetooth and many many accessories such as holders or straps
and very easy to use with Flowcode

https://flowcode.co.uk/forums/viewtopic ... f=5&t=1452


regards

Stefan

Re: ESP32 Bluetooth command to take a picture

Posted: Wed Oct 26, 2022 6:13 pm
by mnfisher
Looks like the Bluetooth 'clickers' act a small BT keyboard - with 'Enter' as the (only) key to take a photo.

See https://stackoverflow.com/questions/267 ... 20Marc%20B

Thanks for the pointer on to the M5Stack - looks ideal (if it's 'reasonably' waterproof) - I was thinking of just a couple of multicolour LEDS (off clear, yellow car at distance - red (and sound) close)

Martin

Re: ESP32 Bluetooth command to take a picture

Posted: Wed Oct 26, 2022 9:03 pm
by chipfryer27
Hi

About six or seven years ago, one Christmas I bought a book "App Inventor for Android" which was published around a decade or so ago. The book detailed how to create android "apps" to interact with pretty much anything. It used "code blocks" so no actual programming knowledge was needed, a bit like Flowcode I suppose.

It documented how to use App Inventor (originally a google product, now MIT) and took you through examples. Didn't take me long to create "apps" and was well worth the purchase price as it kept me from being bored. It covered how to do a fair amount but being fair it isn't designed to take you to expert level but did cover Bluetooth. I created a few "apps" that interacted with a web page I hosted on my laptop using my phone, but it could easily have "talked" with a microcontroller running suitable code.

Maybe it or MIT App Inventor(google) might be of help?

Regards

Re: ESP32 Bluetooth command to take a picture

Posted: Sun Nov 06, 2022 5:50 pm
by mnfisher
So - using the techniques I mentioned in the esp32 Bluetooth Mesh topic - I added a simple BT keyboard to esp32.

This connects to a PC (you need to pair it) and here has a very (very) simple keycode generator - it takes a string (only handles capital letters and space) - and outputs it as lowercase letters (need to add a 'shift') and (relevant to this topic) a return character (which should (!) fire the shutter) Way back I did a more detailed version for Arduino HID and I'll look this up rather than recreate it.

It required a little extra tweaking compared to the Bluetooth mesh example - so rather than try and post all my steps again (needed a little more modification of the demo file) I've posted my entire directory as a zip. Note that as mentioned before - you'll need to compile and upload outside FC (using 'idf.py build' and 'idf.py -p COMn flash') - you'll need to compile the fcfx file to create the directories (in FC) then paste in the contents of the zip file then use idf.py commands.

The (simple) demo file - outputs Hello World(return) once - it needs a trigger (button / timer whatever) - simply outputting multiple strings makes thinks difficult on the PC.

There is no delay after the chars - depending on your PC it might need say 10ms??
Keyboard.fcfx
(9.44 KiB) Downloaded 553 times
Makefile.zip
(43 KiB) Downloaded 479 times
Martin

Re: ESP32 Bluetooth command to take a picture

Posted: Sun Nov 06, 2022 8:22 pm
by mnfisher
Just tested with a phone - sending a RETURN (keycode 40) - every 10s does indeed take a picture :)

Martin

Re: ESP32 Bluetooth command to take a picture

Posted: Mon Nov 07, 2022 11:45 am
by mnfisher
Several brave souls have downloaded - but the FC file doesn't do much on it's own - you'll need both to get it to work!

Martin

Re: ESP32 Bluetooth command to take a picture

Posted: Mon Nov 07, 2022 2:30 pm
by stefan.erni
Hi Martin, Hi Lain

Very good thanks Martin. Gladly I will try this.
Thank you too, Lain. I've used MIT App Inventor for various projects but less since Flowcode AppDevelopper exists.

regards

Stefan

Re: ESP32 Bluetooth command to take a picture

Posted: Tue Nov 08, 2022 8:12 am
by mnfisher
Let us know how you get on.

Any questions and/or problems getting it to compile too...

Martin