Cameras compatible with the spark

Hi,

im looking for a camera which is simple to use with the spark, i just need to take pictures.

At the moment which cameras would you suggest?

Thanks

Hey @Clorofilla! Jeff here from the Spark team. I found a couple of other threads that may be useful to you:

Read closer to the bottom of the thread on this one. Seems like the consensus is to use a UART camera to be able to snap photos and upload them to the cloud. Someone mentions this Grove camera specifically as an option:

Here’s another thread that has some code/troubleshooting of a LinkSprite camera with TTL Serial:

Looks like either would be a good option. Hope this helps!

right now I am trying to set up the spark core with my GoPro hero 3. theoretically it should work but atm I can’t get it to connect to the go pro’s network. I think this might be because the network is not connected to the cloud.

I had used my Spark Core as a GoPro remote over the summer. Yes, you must turn off cloud access on your core with the Advanced Mode settings: http://docs.spark.io/firmware/#advanced-system-modes

This is the sketch I used to snap pictures and start video capture, it works fine:

TCPClient client;
byte server[] = { 10, 5, 5, 9 }; // Google

//System.mode(AUTOMATIC);

void setup() {
    pinMode(D7, INPUT_PULLUP);
}

void loop() {
    if (digitalRead(D7) == LOW) {
        if (client.connect(server, 80))
        {
            Serial.println("connected");
            client.println("GET /bacpac/SH?t=<GoPro Password>&p=%01 HTTP/1.0");
            client.println("Host: 10.5.5.9");
            client.println("Content-Length: 0");
            client.println();
          }
          else
          {
            Serial.println("connection failed");
          }
    }
}

THANKS EELY how did you get into the advanced settings though? I can’t even connect my spark to the cloud on the local network

also how did you flash the spark? The arduino ide does not want to connect to it

I had done this over the summer when the Advanced System Modes were still in Beta, and I don’t think I have used this since, but this is essentially what I did if I remember correctly:

  1. Add SYSTEM_MODE(MANUAL); to the top of your sketch and load it to the Core from the Web IDE (while still being online)
  2. Change the Wifi settings to connect to your GoPro over USB (http://docs.spark.io/connect/). It should connect with the proper SSID and Password, and since the cloud is now turned off in your Core, it should just run and not wait for Cloud connection. The Core should breathe Green in this state, not Cyan.
  3. Pull pin D7 Low to trigger the camera

Again, it has been a while since I have done this, and I think I actually compiled locally when I did it, but I think the above steps should work. Someone can comment if I missed anything as I am thinking about this off the top of my head.

Of course, your Core will not connect to the Cloud anymore, so you will have to add more to do that (by by adding code to force connection when you press a button, for example), or you will have to factory reset or flash your core locally to get it to connect back to the cloud.

so you loaded the sketch up before connecting it to the go pro?
if that is what you did then how did you edit it afterwards if the spark is in manual?

Well, you could do it locally as well, you don’t have to load this up via the Web IDE, I just thought that was easier.

You could add code that when a certain button is pressed, it then calls Spark.connect() and sets a flag. The loop() should check if the flag is set, and if it is, then it will call Spark.process() as well.

However, you will never be able to connect to the Cloud through GoPro, it just doesn’t work that way. So even if you did the above, you would still have to change the Wifi settings through the USB option to get back onto a “live” network. I am not sure if you can change your connected Wifi network programmatically while the Core is running, but you could do that if it is available to avoid the USB change.

I was fine simply reflashing locally or just doing a factory reset when I was done. There are lots of options.

how did you reflach locally?

There is a guide on how to download and build the code locally: https://github.com/spark/firmware

Or, you can use the cloud and the CLI to compile a folder/file for you and then it downloads a firmware binary with the ‘spark compile’ command. This would allow you to avoid getting the gcc toolchain and other necessary dependencies. I have never used this before, so I am just summarizing this from the docs: http://docs.spark.io/cli/

If you went with the second option, you would still need dfu-util to load the firmware binary onto the Core using the ‘spark flash --usb’ option.

Hope that helps, let me know if you need anything else.

Nicely written! I’m sure @silashowe isn’t the only person to wonder about these things - sounds like we could use a forum topic/zendesk post that provides an entry into the different ways of writing code, compiling it, getting that on to the core. cc: @tavares

3 Likes

that code does not work. I am using a button that is hooked up to d7 and it has an led built in which is connected to D2. I am not sure whether the issue is with the button initiating things, what the code just straight up not running, or if it is having trouble connecting to the go pro server. if the last one is the case, it would also mean there is some sort of issue going on with the code because I have that blink D7 in there if it does not connect yet that never initiates.

TCPClient client;
byte server[] = { 10, 5, 5, 9 }; // Google

SYSTEM_MODE (MANUAL);

int buttonState = 0;


void setup() {
    pinMode(D7, INPUT_PULLUP);
    pinMode(D2, OUTPUT);
    Serial.begin(9600);
}

void loop() {
  if (ButtonPress (D7)){
    if(buttonState == 0){
        if (client.connect(server, 80))
        {
            digitalWrite(D2, 1);
            Serial.println("connected");
            client.println("GET /camera/PW?t=<silasgopro>&p=%01 HTTP/1.0");
            client.println("Host: 10.5.5.9");
            client.println("Content-Length: 0");
            client.println();
            buttonState = 1;

          }

          else{
            Serial.println("connection failed");
            digitalWrite(D7, HIGH);
            delay (500);
            digitalWrite(D7, LOW);
            delay (500);
            digitalWrite(D7, HIGH);
          }
    }
    else{
      if (client.connect(server, 80)){
        digitalWrite(D2, 0);
        Serial.println("connected");
        client.println("GET /camera/PW?t=<silasgopro>&p=%00 HTTP/1.0");
        client.println("Host: 10.5.5.9");
        client.println("Content-Length: 0");
        client.println();
        buttonState = 0;

        }
      }
    }
  }


int ButtonPress (int button){
  if (digitalRead (button) == 0){
      digitalWrite (D2, 1);
    while (digitalRead (button) == 0){}
        digitalWrite (D2, 0);
    return (1);
  }
  else return (0);
}

Hmmm… I think first you need to remove the <> around your password in the URL. Sorry, I had that in my code and was trying to indicate that the password should go there, but the <> is not necessary. So try removing that and see if it works.

The way I debug the camera is to connect to it’s wifi from something else (smartphone, tablet, etc), then type this into a browser:
http://10.5.5.9/camera/PW?t=silasgopro&p= HTTP/1.0

It should take a picture. If it doesn’t, you will see a 404 error code in your browser and there is something wrong with the GoPro setup. If it does, then you should be fine to do it from Spark as well, as long as the code there is working.

Unfortunately, I do not have this stuff with me to test your code. I think if you remove the <> it should work by looking at it, so let me know.