Communicating Directly with a Claw - Getting Started


I’ve got a Spark core from the Kickstarter project and have been following the progress of ever since. I really have no idea what I’m doing, but the idea of making things I can connect to is awesome.

I wanted to use my Spark Core to control a claw. I’ve found what looks like a good one…

In that tutorial they use a Arduino Uno microcontroller to communicate with the claw/servo. I’d like to do the same, but with my core. I have no idea how XD!

I’ve fired up my core and used the android app to make things flash, that’ is about it. The next step… to start communicate written commands from the core to control electronic components is something I really have no idea where to get started.

If anyone has any good resources on what I need to read/do next in my quest to understand how to make things with my core, so that I can continue toward my goal of controlling the claw, I would greatly appreciate it.

Many thanks!

I would suggest that the first thing you get working is simply opening and closing the claw with the Core. You can pretty much follow the Sparkfun tutorial but instead of being in the Arduino IDE you’ll be in the SparkCore IDE. Once you get it opening, closing, and anywhere in between (look into the MAP function if the tutorial doesn’t already use it) report back and we’ll go from there.

Also, what android device do you have and would you be interested in a android app to open/close the claw?


Here’s the code for the servo sweep example:

// Sweep
// by BARRAGAN <> 
// This example code is in the public domain.

#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
int pos = 0;    // variable to store the servo position 
void setup() 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
void loop() 
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 

Hi Harrison,

Thanks so much, just the direction I needed! I’ve ordered the servo and claw, as soon as it gets here I’ll see if I can get it closing and opening and report back.

The Android device I’m using is Sharp SH530. The app I used I got from the play store. An app to specifically close and open the claw would be great, especially if it was open source - I plan on adding wheels to my construction eventually, so would love to extend the app.


Hello again,

I have my servo now (no claw yet).
The tutorial says to connect the brown wire to GND, the red to 5v and the orange to digital pin 9.

I can only find GND on the core , nothing else.

I feel like I do not understand the core enough, is there somewhere I can read about what the different pins mean?


Found this. …

So I’m guessing for the 5V pin in the instructions I should use either of the 3v3 pins?

And the digital 9 pin i should just use any of the digital pins available?

All assumptions and probably incorrect :smiley:

Your servo is going to be much happier with 5V instead of 3.3V. If you use the USB cable for power, then that is available on the core Vin pin shown here:

With arrow labelled 3.6V to 6V. Eventually you may want a separate battery or power supply for the servo (especially if you have more than one servo).

1 Like

Thanks very much bko. Do you know what filtered output means?

3V3*: This is a separate low-noise regulated 3.3V power rail designed for analog circuitry that may be susceptible to noise from the digital components. If you’re using any sensitive analog sensors, power them from 3V3* instead of from 3V3.

Lots of information here: for other stuff that you might be curious about! :slight_smile:

With regards to the Android application for opening/closing and just generally controlling the claw I would suggest you look into MIT App Inventor. I recently discovered it and have been using it to quickly develop apps for the SparkCore.