Go Down

Topic: Gopro wifi control with Arduino (Read 12991 times) previous topic - next topic

elnino54

Hi all,  I'm hoping someone has played with this before but perhaps i'm the first.

I have a GoPro HD2 camera with WiFi attachment - It acts as a wireless access point.

I have paired with this, a wireless AP in Client mode - i.e it's acting like a computer connecting to the camera but connects to the network so i can access it via any 'pc' on the network.

The camera is controlled via HTTP GET requests in the form of http://<ip>/bacpac/PW?t=<password>&p=%01

I can jump on my PC and enter the string above into a browser and it turns the camera on - Beatutiful i think!

I created an arduino sketch to connect to the camera and turn it on:

Code: [Select]

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {  0x00, 0x28, 0x8B, 0x62, 0xC9, 0xED };
byte ip[] = { 10, 5, 5, 110 };
IPAddress server(10,5,5,9); // GoPro

// constants won't change. They're used here to
// set pin numbers:
const int sensorpin = 18;     // the number of the pushbutton pin
const int ledPin =  2;      // the number of the LED pin
const int solenoid = 3;
boolean movement = 0;

EthernetClient client;

void setup() {
 
   Serial.begin(9600);
  // start the Ethernet connection:
  Serial.println("Starting Network");
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    for(;;)
      ;
  }
 
//  Ethernet.begin(mac,ip);
 
  delay(1000);
  Serial.println("Connecting to GoPro");
  // Try to get the status of the gopro
  if (client.connect(server, 80)) {
    Serial.println("connected");
    // Make a HTTP request:
    Serial.println("Powering on GoPro");
    client.println("GET /bacpac/PW?t=blahblah&p=%01 HTTP/1.0");
    client.println();
  }
  else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);     
  pinMode(solenoid, OUTPUT);
  digitalWrite(ledPin, HIGH);
  digitalWrite(solenoid, HIGH);
 
  // initialize the pushbutton pin as an input:
  pinMode(sensorpin, INPUT);   
  digitalWrite(sensorpin, LOW);
}


but it bombs out at the client.connect line i.e can't even open port 80 as if there is no IP or there is no physical connection but from the PC i can ping the Arduino and the camera fine.

I know this is a very specific thing and i'm probably strugling for someone to have an answer off the bat but has anyone tried anything like this before?

elaber

here is mine.....
http://www.youtube.com/watch?v=Uv0XA-TAngQ
using wifi module + digilent duino. (sorry, cant find my mini arduino boards  :D :D :D )
ill try your code once i find my tplink running openwrt.

thanks to the guys here: http://goprouser.freeforums.org/howto-livestream-to-pc-and-view-files-on-pc-smartphone-t9393-150.html
saves me time sniffing on gopro's iOS and android official apps.... 

elaber

i tested your code with arduino + ethernet shield with tplink wifi client router connected to gopro. and it worked without issue. here is the test video:
http://www.youtube.com/watch?v=idDEDDeqCh8

here are some photos of my diy arduino board with ethernet shield on a case



and here is the actual code i used in the video
Code: [Select]

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server(10,5,5,9);

EthernetClient client;

void setup() {
  Serial.begin(9600);
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    for(;;)
      ;
  }
  delay(1000);
  Serial.println("Connecting...");

  if (client.connect(server, 80)) {
    Serial.println("Photo mode:");
    client.println("GET /camera/CM?t=<goprohero>&p=%01 HTTP/1.0");
    client.println();
  }
  else {
    Serial.println("Connection failed");
  }
}

void loop()
{
  if (!client.connected()) {
    Serial.println();
    Serial.println("Connection lost!.");
    client.stop();
    for(;;)
      ;
  } else {
    if (!digitalRead(5)){
      Serial.println("Click!");
      client.println("GET /bacpac/SH?t=<goprohero>&p=%01 HTTP/1.0");
      client.println();
      delay(500);
    }
  }
}

garaving

cool!
I can connect simultaneously to 5 gopro?
using a single wireless card

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy