Probe Droid - Battlefront 2 (Need help with code)

Hi everyone!,

I'm building a probe droid, or ID-10 seeker droid from Star Wars Battlefront 2. A bit of a preface, I'm not new to prop building, but definitely new to coding Arduino. For the last few days I've been trying to see if there were similar examples for what I wanted the droid to do, I've also watched a few hours worth of Youtube tutorials (I really liked Benduino's videos) on arduino to get a feel for the language, but it's quite overwhelming. If any of you recommend a strong set of tutorials, I'm very open to learning more.

Saying that, let me tell you what I would like to do:

Ideally the end result will do the following:

  • Dome will spin randomly with a continuous servo
  • Adafruit sequins lights - they don't blink in the game, so I will just power these normally
  • Sound 1 - I have one track that I would like on loop as a background track - not sure how to play this without it being interrupted by other sounds - is layering sounds possible?
  • Sound 2 - I have other tracks that I would like played randomly overtop the background track
  • IR - I have 3 infrared sensors that I would like to trigger certain sounds and have the servo move to a certain position - so the probe droid is tracking or finding something :wink:


  • Arduino Nano
  • Adafruit mini Sound FX 16mb board
  • Adafruit sequins (red/white)
  • Adafruit MAX98306 amp
  • 2x 4omh3W speakers
  • High torque continuous servo
  • 3x IR sensors - these were ones that I pulled from a BB8 Spinmaster toy, but if they don't work, I'm willing to replace them with proper Arduino PIR sensors. Just thought I could reuse them.

Using a Mac and Arduino IDE

I took a look at Robin's code for SeveralThingsAtTheSameTime as I figured it would be a good starting point for the project. I'm not using lights, but I thought I could just replace the naming of LED with "sound" and adjust accordingly. The biggest thing for me was trying to understand how to run the program without delays and time things properly.


The background track that I want to use is looping, but it's weird because I'm not even calling that particular pin - it's not in the loop or read function. The sound effects do not interrupt the loop.

The servo does move clockwise and counter clockwise, but I'm trying to figure out how to slow it down, and have spacing/delays between the movements - keep in mind it's a continuous servo.

I have not added the IR sensors yet. This will need to be tied in to servo movements and "possibly" some targeted sounds.

There are tutorials like you asked for, in the links provided in the sticky threads at the top of this forum and the Programming forum - also under Resources->Tutorials on this site.

Thanks for the heads up - sorry, I obviously haven’t been around all that much :slight_smile:

A few updates:

My soundboard apparently can only play one track at a time, which is odd, but alas, I’ve simplified the design and mixed both tracks together in a 25 minute loop. So in the end, I only have to play the one looping track. Makes things easy.

I then started looking at Sweep and Random and was able to come up with the following code:

#include <Adafruit_Soundboard.h>
#include <Servo.h>


const int soundLoop = 2;
const int servo = 5;
const int IR = 10;


Servo myservo;  // create servo object to control a servo 
long randomMove;
long randomDelay;

void setup() {
  // put your setup code here, to run once:

pinMode(soundLoop, OUTPUT);
pinMode(IR, INPUT);
pinMode(servo, OUTPUT);

void loop() {

digitalWrite(soundLoop, LOW);



// ======================================

void servoSweep() {

randomMove = random(0,360);

randomDelay = random(500,2500);   // random amount of time moving
delay(randomDelay);               // how long it's moving
myservo.write(90);                // Stop

randomDelay = random(5000,15000); // random amount of time to be stopped
delay(randomDelay);               // how long it's stopped


I will have to do some testing when I install everything into the droid. I might need to just specify a “slow turn” and a “fast turn” rather than giving it a number between 0 and 360 - the dome weight might be too much for a really slow turn.

I haven’t installed the IR sensors yet, but I’m beginning to wonder if they will even be necessary. Pretty cool to try though :slight_smile: