Flyduino-A 12 servo controller example

I’ve bought the thing terrible amount of months ago and only recently decided to give that a try.

flyduino-a board image

Overall, the device is neat for my purpose:

  • has I2C so it can make friends with other duds on the wire
  • it is super small so can be fit for smallish robots

FlyDuino-A pin diagram

It’s a challenge (for a newbie at least) in multiple ways:

  • you can’t stick usb into it so you need an adapter (e.g. FOCA)
  • the adapter needs drivers which differ from what my Arduino’s use
  • documentation (e.g. Arduino sketch) is rather outdated: MegaServo library replaced Servo library in Arduino for quite a while ago
  • it is not recognized by the Arduino IDE so the settings are to be guessed

Flyduino-A example sketch

#include <Servo.h>
#define NBR_SERVOS 12  // the number of servos, up to 48 for Mega, 12 for other boards
#define FIRST_SERVO_PIN 2 

Servo Servos[NBR_SERVOS] ; // max servos is 48 for mega, 12 for other boards

int pos = 0;      // variable to store the servo position 
int potPin = 0;   // connect a pot to this pin.

void setup()
{
  Serial.begin(9600);
  for( int i =0; i < NBR_SERVOS; i++)
    Servos[i].attach( FIRST_SERVO_PIN +i, 800, 2200);
}
void loop()
{ 
  
  for (int p=0; p<180; p+=10) {
    for( int i =0; i <NBR_SERVOS; i++) {
      Servos[i].write( p);         
    }
    delay(500);
  }
  for (int p=180; p>0; p-=10) {
    for( int i =0; i <NBR_SERVOS; i++)  {
      Servos[i].write( p);         
    }
    delay(500);
  }
}

 

Arduino IDE setup to upload code to Flyduino-A

  • Board: Arduino Pro or Pro Mini
  • Processor: ATMega328, 3.3V 8MHz

FOCA wiring for code upload to Flyduino-A

foca flyduino-a wiring

FOCA drivers setup for MacOS (Sierra)

  • CP210x
  • sudo nvram boot-args=”kext-dev-mode=1″
  • csrutil enable –with kext (this only works in recovery mode)

Flyduino-A wiring how-to

I’ve basically used Arduino to supply 5V for this test both for Servo and for the board. Don’t do that with multiple servos and prefer other source if you have one available (as that’s cheaper than frying Arduino’s).

flyduino wiring example

As I understand, usually you’ll have a more powerful source for the servos (Power-In) and something smaller for powering the board (Voltage supply).

Important thing for real life setup: you have to have the grounds connected. The board operates at 3.3V which was enough to take care of 5V servos if the ground voltage levels are aligned.

FTDI header is only for the programming.

Troubleshooting

  1. Make sure your FOCA has 3.3v set, programming at 5v will
  2. Try uploading a minimal sketch (to make sure you’ve figured the FOCA setup)
  3. Try uploading a sketch doing some logging over Serial to see if board is somewhat alive
  4. Try uploading blink sketch + using a diode / multimeter to see if you can force the board to do something useful
  5. See if you have voltage on the power pins for the servos
  6. Use oscillograph / logic debugger to see if stuff on your servo control pins looks good