MAKER: dar_sissau / Translated by: Fun Endless Cherry
In this tutorial, I will show you how to control the GoPro Hero 4 and GoPro Hero Session 5 using an Arduino board. Once you master these skills, you can easily apply them to any model of GoPro, which will be very practical. You can communicate with the GoPro directly using some basic network commands through the Arduino, instead of hacking into the existing controller. You can not only control the functions on the GoPro but also receive updates about the camera’s status. This will become a universal solution for different types of projects, including custom robots and drones.
Materials List
1. GoPro Hero 4 and GoPro Hero Session 5 (also compatible with the latest model GoPro Hero 6. The Hero Session model has a slightly different control method than other models, but we will cover that later.) 2. Arduino MKR1000 or Arduino MKR Zero 3. A USB cable connected to the Arduino 4. A computer running Arduino development software 5. A smartphone with the GoPro application installed
If you don’t have these items or have never used Arduino before, I recommend reading the Arduino basics tutorial before starting this project!
Setting Up the Camera’s WiFi
Turn on the camera and configure the WiFi connection.
For the GoPro Hero 4, the easiest way to connect the WiFi is to follow the instructions in the app to pair the camera with your phone. Once paired, use the app to open the camera settings and set a new name and password for the WiFi network. The same method applies to the GoPro Hero Session 5.
To view the WiFi network name on the camera, check the “Camera Info” under the “Connection Settings” menu.
Finding Your GoPro’s MAC Address
Once WiFi is enabled, you need to determine the camera’s MAC (media access control) address. This address is a great way to provide information when working with traditional Hero series GoPros. If you are using a GoPro Hero Session, this address is essential.
First, connect your computer to the camera’s WiFi network using the network name and password from the previous step.
Second, after logging into the camera’s WiFi network, open any browser on your computer and go to the following URL: http://10.5.5.9/gp/gpControl/info
This URL should display a string of information in your web browser, as follows:
{"model_number":21,"model_name":"HERO5Session","firmware_version":"HD5.03.02.51.00","serial_number":"C3212365684485","board_type":"0x05","ap_mac":"0641631510c4","ap_ssid":"GP54688615","ap_has_default_credentials":"0","capabilities":"16"}
If not, ensure your camera is turned on and check the WiFi connection.
The characters we are interested in are the number characters after “ap_mac:”. This 12-digit string is the MAC address: 0641631510c4.
Once you have the address, format it by separating every two characters as follows: 0x06, 0x41, 0x63, 0x15, 0x10, 0xC4.
Connecting Arduino to GoPro Hero
In order to connect the Arduino to the GoPro Hero series cameras, you need to pair it with a pairing code. To obtain the pairing code, navigate the camera menu on your phone to pair the camera with the app. A 4-digit pairing code will be generated on all later model cameras (Hero 3 and earlier versions have a 6-digit pairing code).
The pairing code lasts only 3 minutes, so timing is crucial.
You need to manually enter the pairing code twice in the code below:
//ENTER YOUR PIN HERE WHERE IT SAYS XXXX
After entering the pairing code, you just need to upload it to the Arduino and connect to the camera within three minutes.
Note, do not forget to enter the GoPro’s WiFi credentials as follows:
//ENTER YOUR WIFI NAME AND PASSWORD HERE
All operations aim to successfully upload the code; once successful, nothing will happen. Even so, you can do the following. If you navigate back to the video screen from the GoPro’s settings menu, you should now be able to send commands (which we will cover later).
If you cannot send commands to the camera in the following steps, please go back and repeat this step. The code to pair the GoPro with the Arduino using the pairing code is:
// Here is a large block of source code. To avoid affecting the reading experience, please click at the end of the article to view the original text.
Connecting Arduino to GoPro Hero Session
The GoPro Session does not have a pairing code available. Its connection method is a bit tricky. As you may have noticed, it will turn off and go into sleep mode as soon as you finish recording or most operations on the camera.
Before sending any commands to the GoPro Hero, you need to wake it up. The easiest way is to manually press the menu button on the back of the camera and send the command within the few seconds window it wakes up. However, annoyingly, this method is not particularly practical.
A better way to wake the GoPro is to use a WOL (Wake-on-Lan) data packet or “magic packet”. This acronym stands for a protocol for remotely waking computers from sleep mode. It requires sending bytes from the Arduino to the GoPro using the UDP protocol to wake it up. It is a bit frustrating because it differs from the protocol you use to send all other control commands. If you are not familiar with programming, the code is also not that great and can be a bit complicated to handle.
However, when it works, it truly feels like magic. Sending commands to wake my camera from the Arduino has never ceased to amaze me!
The WOL command (the camera wake-up function in the code) needs to be sent before most other commands and usually has a delay of 1-2 seconds. Basically, send it when you need to wake the camera (most of the time). After sending the command, pause for a moment to let the camera actually wake up.
Here is the code to wake the camera:
// Here is a large block of source code. To avoid affecting the reading experience, please click at the end of the article to view the original text.
Sending GoPro Commands
In this example, I will demonstrate how to send commands to start and stop video recording.
The same method will be used to demonstrate that you can send commands for every function in the camera. The commands for the GoPro Hero 4 seem to be the standard setup for all subsequent camera models. However, some newer cameras have new features and camera-specific commands worth exploring. You can find camera-specific commands on the Unofficial GoPro WiFi API github page by clicking on the specific camera model link.
Here is an example that records for 5 seconds, stops recording, waits for 5 seconds, and then starts again. If you are using the Hero Session, be sure to comment out the wake-up code line for the GoPro.
Again, do not forget to enter your GoPro’s WiFi credentials and MAC address!
The code for sending start and stop recording commands:
// Here is a large block of source code. To avoid affecting the reading experience, please click at the end of the article to view the original text.
Receiving GoPro Status Updates
You can receive status updates from the GoPro using the following link:http://10.5.5.9/gp/gpControl/status
When using this link, it will provide a JSON object that can be analyzed against the camera status guide.
The easiest way is to connect your computer to the GoPro’s WiFi network and load the above link in a web browser.
Its feedback information is:
{"status":{"1":1,"2":2,"3":0,"4":0,"6":0,"8":0,"9":0,"10":0,"13":0,"14":0,"15":0,"16":0,"17":1,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"26":0,"27":0,"28":82,"29":"","30":"","31":0,"32":0,"33":0,"34":2796,"35":1917,"36":0,"37":1,"38":0,"39":1,"40":"%12%05%13%0C%04%0E","41":0,"42":0,"43":0,"44":0,"45":0,"46":1,"47":1,"48":1,"49":0,"54":15476384,"55":1,"56":0,"57":3927,"58":0,"59":0,"60":500,"61":2,"62":0,"63":0,"64":0,"69":1,"71":12,"72":19,"73":20,"74":0}, "settings":{"1":0,"2":1,"3":8,"4":0,"5":0,"6":1,"7":1,"8":1,"9":0,"10":0,"11":0,"12":0,"13":1,"14":0,"15":4,"16":0,"17":4,"18":1,"19":0,"20":0,"21":1,"22":0,"23":0,"24":0,"25":0,"26":4,"27":0,"28":4,"29":5,"30":0,"31":0,"32":3601,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":4,"40":0,"41":13,"42":8,"43":0,"44":8,"45":8,"46":0,"47":0,"48":0,"52":1,"54":1,"57":0,"58":1,"59":6,"60":8,"61":1,"62":2500000,"63":7,"64":4,"65":0,"66":0,"67":0,"68":0,"69":1,"70":0,"71":0,"73":0,"74":0,"75":3,"76":3,"78":1,"84":0,"85":0,"86":1,"87":40,"89":12,"91":0,"92":12,"95":1,"96":0}}
To be honest, every time I use Arduino, it somehow crashes my GoPro system. Fortunately, I don’t really need this feature, so that’s all I have to say.
http://maker.quwj.com/project/65/
via instructables.com/id/Arduino-GoPro-Wifi-Control/
Links in the text can be clicked to view the original text at the end of the article
More Exciting Content
Raspberry Pi + Flask to Implement Video Streaming WEB Server
Raspberry Pi Based Multi-servo Controlled Positioning Photography Gimbal
Playing with AR Projection Black Technology using Raspberry Pi and IKEA Lamp
How to Install Windows 10 ARM Version on Raspberry Pi 3B
Installing Nginx + PHP7.0 + Pi Dashboard on Raspberry Pi
Comparing the Speed of Raspberry Pi IO Operations in Different Languages
Magical Arduino Series: DIY Gesture Mouse with A4 Paper
Leave a Comment
Your email address will not be published. Required fields are marked *