Remote bluetooth camera trigger for phone
Asked Answered
W

3

12

I would like to build a camera trigger for my phone by simulating a BLE keyboard that sends the Volume Up key to the phone connected by Bluetooth. I want this because I want to trigger the native Camera app, and not an embedded camera view.

I'm agnostic about technology used but ideally for simplicity I'd like it to be a command line utility in my Macbook, with something like Go or Node.js.

I've looked into Noble for Node.js, which doesn't seem to be oriented at emitting, and found projects for arduino, and found a couple of StackOverflow questions asking the same, but nothing definitive yet.

Apparently the Bleno project for Node.js could be better suited, but apparently it's very outdated.

Would someone please point me in the right direction?

Thank you

Edit

I was able to use Bleno to emit 0xEA and 0xE9 (Volume Up and Volume Down apparently), and using the LightBlue app I'm able to inspect that receive those messages, however, connecting to the MacBook through the phone's bluetooth does not increase/decrease volume.

Edit Found this outdated project written in Swift 3 for reference

Edit Apparently the pybluez project looks like it could be a good option

Waterage answered 20/6, 2020 at 13:41 Comment(1)
HID requires bonding. However bleno doesn't really support bonding properly.Eolian
W
0

You should be able to use the terminal for that. Eg. in Windows, you can start the camera app using start microsoft.windows:camera

Something similar should be available even in Mac. Try that out. Otherwise, go to the root directory where the camera app is stored. And then trigger that from code.

Willey answered 29/6, 2020 at 6:48 Comment(1)
I'm sorry but this is nowhere near what I askedWaterage
M
0

You need to create a Bluetooth HID (or HID over GATT) peripheral that your phone can connect to and will receive the key commands from.

There is a project here that did it with a Raspberry Pi:

https://gist.github.com/ukBaz/a47e71e7b87fbc851b27cde7d1c0fcf0#gistcomment-2997623

Unfornately the underlaying Bluetooth library will not move across to your Mac Book.

The HID protocol is documented here: https://github.com/jpbrucker/BLE_HID/blob/master/doc/HID.md

Magnien answered 13/7, 2020 at 11:59 Comment(0)
E
0

In summary, I think what your saying is that you want to make an cli application which is on your laptop/desktop connect to your phone via Bluetooth and simulate a volume key from your laptop/desktop keyboard.

Android:

To do this you will need:

  • Python 3.5 or above
  • PyBluez
  • Keyboard(Python module/API)
  • Android Studio
  • Java Development Kit 8 (preferably 11 or 14)
  • Android BLE

So in order to do this I would create a cli application with python3 and I would record the key presses on the laptop/desktop machine by using the keyboard module this then gets transmitted(bluetooth) via the PyBluez module to your phone. Your phone then accepts the bluetooth data via Android BLE and then simulates the volume button press.

DISCLAIMER: This only works when the phone is already paired to your pc and only work on android phones 4.4.4 and above.

Some Links That Could Help You: Bluetooth lib for python 3 , detect key press in python? , Create a socket for 4.0 bluetooth transmission

IOS:

To do this you will need:

  • Python 3.5 or above
  • PyBluez
  • Keyboard(Python module/API)
  • XCode
  • Swift
  • Core Bluetooth Module

So in order to do this I would create a cli application with python3 and I would record the key presses on the laptop/desktop machine by using the keyboard module this then gets transmitted(bluetooth) via the PyBluez module to your phone. Your phone then accepts the bluetooth data via Core Blutooth Module in swift and then simulates the volume button press.

DISCLAIMER: The phone and laptop/desktop must be paired before it runs this might sound obvious but some people might ignore this.

Some Links That Could Help You: iOS use the volume buttons as input , https://developer.apple.com/documentation/corebluetooth/transferring_data_between_bluetooth_low_energy_devices

Esbenshade answered 14/7, 2020 at 17:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.