ruscoe.org is the personal website of Dan Ruscoe, a software developer in Los Angeles, California.
Controlling a Robotic Arm with an Arduino Board
A while ago, I bought the Edge robotic arm kit with the intention of modifying it to be controlled by an Arduino board. The Internet being what it is, there was already this in-depth guide to doing exactly what I planned.
What I couldn’t find was a good breadboard diagram to use as a reference, so I created one using software from Fritzing.
Follow this guide for assembly directions and the code required to program your Arduino to control the arm’s motors.
A few things to be aware of if attempting this project:
- The wires included with the robotic arm kit are stranded and not much use for breadboarding. Solder some headers onto them for best results.
- The arm uses DC motors, so there’s no feedback on the arm’s current position. This makes automating tasks tricky.
- There’s nothing in place to stop the motors when the arm reaches the limits of its range of motion. The gears will just start to slip and make a really unhealthy noise.
The finished product looks like this:

An Open Source Unity Experiment
I started working on a prototype game in Unity a few weeks ago. It’s a really simple town simulator that currently features characters randomly visiting different shops on a single street.

I’m planning on adding some interesting game mechanics that allow users to interact with the town, but the project is still in its infancy.
I wanted to try something new with this project, so I open sourced it right from the start. The Unity project can be found on GitHub.
All the progress I make on the game will be public and, if anybody is interested, there’s the option to fork the git repository and take the game in any direction they like.
This is the first time I’ve open sourced a project before it was at least mostly complete. Let me know if you do something interesting with it.
Programming the Adafruit TIMESQUARE Watch
I bought a TIMESQUARE watch while picking up some other bits and pieces from Adafruit because I really liked the idea of playing with a programmable watch.
The watch runs on an ATmega328P microcontroller, so it’s Arduino-compatible. Writing a program to run on the watch is easy if you’ve ever written code for an Arduino project.
This is a guide to getting started programming for the TIMESQUARE watch. I’ve tried to cover as much detail as needed without making things too lengthy.

First, Some Assembly is Required
The watch comes as a kit, so some assembly is required before jumping into the code. It’s an easy soldering job, with just a few tight spaces to negotiate when attaching the LED matrix.
The Adafruit website provides some great assembly directions with pictures.
I had to diverge from the directions slightly as the LED matrix wouldn’t sit flush with the PCB while the microcontroller pins were still attached. I snipped them off and everything fit perfectly.
The rubber watch strap that comes with the kit has been repurposed from some other watch. I didn’t have high expectations for the strap, but it’s actually of a decent quality. It’s comfortable to wear and the fastener is solid.
Programming the Watch
Once the watch is fully assembled, the development environment must be set up. If you don’t already have it, download the Arduino environment.
Libraries
These libraries are required to write code for the watch and you’ll need to use git to make a local copy of them. Installation varies by operating system. If you’re using Windows, GitHub for Windows is pretty good. If you’re using Linux, git may be installed from your package manager.
With the above libraries cloned locally, install them into your Arduino environment. See the Arduino documentation on installing libraries.
With the libraries installed, run the Arduino environment and open the Watch example sketch. It can be found via the File / Examples menu.
Save the example sketch to a new location to start work on your own custom watch code.
You’ll see the sketch contains multiple files, which are displayed as tabs. The tab named “Watch” is the base program, containing the loop the program runs in. The other tabs, such as “Marquee” and “Binary,” represent the different watch modes.
You can add a new tab to create a new watch mode or edit an existing one. I recommend modifying one of the modes slightly to see how your changes affect the watch.
Adding a new Watch Mode
In the Arduino environment, add a new tab to your Watch sketch. Name it “CustomMode”
To create a very simple new watch mode, paste the following code into the new CustomMode tab:
#define LED_ON 255
void mode_custom(uint8_t action) {
if(action != ACTION_NONE) {
watch.setTimeout(fps * 8);
}
watch.fillScreen(BACKGROUND);
watch.drawPixel(3, 3, LED_ON);
watch.drawPixel(3, 4, LED_ON);
watch.drawPixel(4, 3, LED_ON);
watch.drawPixel(4, 4, LED_ON);
}
Switch to the Watch tab and look for this block of code, near the top of the file:
#define MODE_SET 0
#define MODE_MARQUEE 1
#define MODE_BINARY 2
#define MODE_MOON 3
#define MODE_BATTERY 4
Add a line below that block and add:
#define MODE_CUSTOM 5
This defines a constant for your new watch mode.
Just below that block, find this block of code:
void (*modeFunc[])(uint8_t) = {
mode_set,
mode_marquee,
mode_binary,
mode_moon,
mode_battery
};
Add to that block so it looks like this:
void (*modeFunc[])(uint8_t) = {
mode_set,
mode_marquee,
mode_binary,
mode_moon,
mode_battery,
mode_custom
};
Now you’ve added the function name you created earlier to the list of available watch modes. At this point, you can push your sketch to your watch and cycle through the modes. When you reach your new custom mode, you’ll see four LEDs lit in the center of the matrix.
Inside your CustomMode tab, you’ll find calls to the function watch.drawPixel(). These function calls control which LEDs are lit in the LED matrix. Try altering the parameters to turn on other LEDs.
I’m using this very simple piece of code to demonstrate a quick, easy new watch mode. I highly recommend reading through the default watch modes to learn how to dim brightness when power is low, control the timeout delay and detect input from the watch’s buttons.
Pushing Code to the Watch
Pushing code to the watch can be done easily with a USB cable if you pick up an FTDI Friend from Adafruit. See the official directions for use.

That’s all you need to get started programming for the TIMESQUARE watch. You’re only limited to 64 LEDs, two buttons and your own imagination.
I wrote a simple bat and ball game just to see if it would work. Here’s the example video I made:
My fork of the watch code, including the bat and ball game, is available here on GitHub.
More posts in the full blog archive.
