ESP32 Bluetooth command to take a picture

Post here to discuss any new features, components, chips, etc, that you would like to see in Flowcode.
stefan.erni
Valued Contributor
Posts: 758
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

ESP32 Bluetooth command to take a picture

Post 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 1879 times

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 509 times

Re: ESP32 Bluetooth command to take a picture

Post 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

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 Bluetooth command to take a picture

Post 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

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 509 times

Re: ESP32 Bluetooth command to take a picture

Post 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

chipfryer27
Valued Contributor
Posts: 1147
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 285 times
Been thanked: 412 times

Re: ESP32 Bluetooth command to take a picture

Post 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

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 509 times

Re: ESP32 Bluetooth command to take a picture

Post 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 58 times
Makefile.zip
(43 KiB) Downloaded 47 times
Martin

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 509 times

Re: ESP32 Bluetooth command to take a picture

Post by mnfisher »

Just tested with a phone - sending a RETURN (keycode 40) - every 10s does indeed take a picture :)

Martin

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 509 times

Re: ESP32 Bluetooth command to take a picture

Post 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

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 Bluetooth command to take a picture

Post 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

mnfisher
Valued Contributor
Posts: 955
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 509 times

Re: ESP32 Bluetooth command to take a picture

Post by mnfisher »

Let us know how you get on.

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

Martin

Post Reply