Connecting Spark Core to GoPro

I recently watched a great video of someone using a GoPro and WiFi enabled Arduino to give high fives. The Arduino would send a command to the GoPro to start recording when his arm was raised. Check it out here http://vimeo.com/89814137

I love the idea of controlling my GoPro with the Spark Core so I’ve started this post to publish my progress and hope to have help from the Spark Community :smile:

Here is what I have so far…

Connecting the Spark Core to GoPro’s WiFi

Set the Spark Core’s Wifi SSID and password to the GoPro via USB and command line.
http://docs.spark.io/#/connect/connecting-your-core-connect-over-usb

Change firmware mode on the Spark Core to DFU

The core will no longer have access to the Spark Cloud and you will not be able to use the online tool Spark Build. Only way to code the core now is via USB and to do this you have to change the firmware mode to DFU
http://docs.spark.io/#/connect/appendix-dfu-mode-device-firmware-upgrade

Program Core with Custom Firmware

Ok now I’m unsure what to do here, I know the firmware is at Https://github.com/spark/core-firmware but not sure what to use to edit it. Arduino IDE? The file to write the gopro program is application.cpp
UPDATE: found this that might help, haven’t tried it yet. http://rlogiacco.wordpress.com/2014/01/25/the-sparkcore-makers-meet-the-cloud/

Sending Commands to the GoPro

The general query structure is : Http://ip/device/app?t=password&p=command

For example:
Http://10.5.5.9/bacpac/PW?t=PASSWORD&p= would turn on the camera
Http://10.5.5.9/bacpac/SH?t=PASSWORD&p= would start recording

This page lists all the commands http://hobbyrobo.com/gopro-url-commands/

Thats all I have so far, any input would greatly be appreciated! :smile:

5 Likes

Thanks for sharing your project @tylerwp, this looks sweet!!!

I’ll try to answer the questions you’ve posed above piece by piece below:

You typically put the core in dfu mode when you want to flash it locally over USB via dfu-util. If you simply tap the reset button and get back to the breathing cyan state, you can flash it via the Web IDE again. You can use either approach. Additionally, if you are into developing code locally, you should check out the Spark CLI tool . It supports the ability to develop in the local IDE of your choosing, use the cloud to compile, and then flash via usb or over wifi. Lots of options–depends on your preferences.

You can use whatever text editor you prefer. For Windows Notepad++ is a good free option, for Mac, TextMate is a good free option. For make to work (and successfully compile a flashable firmware binary over dfu-util), you’ll need to install the build tools documented in the core-firmware.

You probably want to check out the TCPClient library documented here. Provided it’s not https (just http), this should work for you if you want to control the GoPro directly from the core.

Thanks @jgoggins that really helped!

So this is what I tried based on your feedback.
I used Spark Build to write my code and used TCPClient. Tests with TCPClient were successful (to google IP)

When my code was ready and uploaded to my core I used putty to connect to my core and change the wifi settings.
After settings were changed I would get a flashing green light. I tried a few other security settings but still no luck.

I was able to connect to the core again with putty and change the settings back to my wifi so I know it works.
Just can’t figure out why it wont connect to the gopro’s wifi. I’ll keep at it :smile:

I’ve run into a problem when the Spark Core is connected to Wifi with no internet.
This could also be the problem I’m having with the GoPro. So I did a test….

I loaded up the Blinking LED App to my Spark while connected to WiFi with Internet.
The LED blinks fine. I then unplugged the internet from the WiFi router and reset the Spark.
The LED App never runs and I get a flashing error code.

@jgoggins Will the Apps only run if the Spark has access to the internet?

@tylerwp
With the way the :spark: Core is currently configured, it will need an access to the internet (since it needs to connect to the Spark Cloud). Every command you send to the Core goes via the Cloud and then to the Core. If you were running local applications that did not require WiFi connectivity, then is would be possible run them without being connected to the internet.

In your use case, what you are looking for is a WiFi remote control that requires no internet connectivity. I’m afraid this won’t be possible with the Core in its current form. You’ll need to change the firmware significantly to make this work.

Thanks @mohit Does this mean at any point I loose internet connectivity my app is screwed?

There are new include files and functions to turn cloud access on and off and this whole area is under active review by the Spark team. You can turn the cloud requirement off with Spark.disconnect() today.

Have you gotten this to work? I am trying to do about the same thing. If you gotten it to work what is the the code you used for it?