Introduction: Magic Button 4k: the 20USD BMPCC 4k (or 6k) Wireless Remote Control
Many people have asked me to share some details about my wireless controller for the BMPCC4k. Most questions were about the bluetooth control, so I'll mention a few details about that. I am assuming you are familiar with the ESP32 Arduino environment.
This version of the remote can control the recording, focus and aperture of the camera via bluetooth. Have a look at the video. It's quite easy to add more control functions as per the bluetooth control manual of the BMPCC4k. Basically anything in the camera can be controlled, as far as I've seen.
It would be an easy step to add a LIDAR module to measure the distance of a subject, so you can get some kind of an autofocus system... Though it's questionable if you can get an accurate enough focus onto specific areas such as eyes etc...
UPDATE 2020: I made version 3.0. It's based on a free rotating wheel using a magnetic encoder. It also connects to my follow focus motor, which basically becomes a second bluetooth device (the ESP32 supports multiple bluetooth connections). The new video demonstrates this.
If you would like to order version 3, please have a look on the MagicButton website
Any ESP32 module with wifi and bluetooth. I used the TTGO micro32 because it's tiny:
A focus wheel, any potentiometer would do. I used the following because it's tiny:
This kind has hard stops at the upper and lower boundary. In a future version I'll use a rotary encoder. This way the focus or aperture doesn't "jump" to the current wheel setting when I enter a mode.
A rec/mode button. I used the following:
Other standard components such as resistors, caps, ... (see schematic)
Step 1: The Code
I use the wifi capability of the ESP32 to either connect to a known network in AP mode, or, when I'm in the field, it becomes a station (STA) to which I can connect to. That way I can configure the module. I won't go into detail of the wifi/webpage section, I might add this at a later stage.
The ESP32 connects to the camera and becomes a Bluetooth LE client. The bluetooth code included in Arduino's ESP32 framework doesn't work with the BMPCC4k. Wakwak-koba has fixed it for us. Thank you Wakwak-koba! I used the BLE library from here:
Nevertheless that version of the BLE lib is still under development and the latest version of BLEUUID.cpp doesn't seem to work at this moment, so take the earlier "verified" version of this file.
For the rest, most of my bluetooth code is a lot as per the BLE examples included in the Arduino framework:
Some BLE UUID and variable defines:
The scanning and main loop:
Connecting to the camera:
The connected/disconnected callback:
The pin code part:
In my current version I can enter the pincode via the web interface but these are wifi/webpage details which I might add later.
The camera notifies its BLE clients about any camera changes, including when the camera starts and stops recording. This code toggles my LED when it starts/stops recording.
Step 2: The Code Part 2
This is the part which actually sends the commands to the camera.
The camera expects an 11 bit number, ranging from near to far focus. I do advise to put a filter on your ADC value, otherwise the focus might be nervously jittering.
The camera expects an 11 bit number, ranging from a low to a high aperture value. I do advise to put a filter on your ADC value, otherwise the aperture value might be nervously jittering.
Step 3: The Circuit
I've attached the PDF of my circuit. Some pics of the PCB are also attached.
The board is powered with micro USB.
After receiving the PCB I decided that I wanted to drive an RGB LED, so I connected two WS2812B in series to the "Button Led" output (that needed some wire patches on the PCB). The PCB's were 8USD with OSHPark.com.
You can see some more connections on the PCB such as "adc" which I'm not using and which were removed from the attached schematics. The plan was to use an external focus wheel in the past but I'm currently perfectly happy with the little thumb wheel.
Step 4: Conclusion
I hope this helped.
I have got some future updates in mind, such as using a rotary encoder without hard stops. This will require the controller to get the current value of the focus or aperture from the camera, and continue from there. The "notifyCallback" function needs to be updated for that probably.
The PCB needs an update to provide the signals for the WS2812B RGB LEDs properly.
I spent a lot (a loooot) of time in making this work, especially the BLE part. If this helped you out and you wanna buy me a drink, that's very much appreciated :) This is a Paypal donation link: