Shop our Airplanes Products Shop our Surface Products
comode's blog View Details
Posted by comode | Apr 14, 2014 @ 07:11 AM | 3,031 Views

I made this 6 moth ago :

ppm signal from an arduino and an old joystick (0 min 43 sec)

It was based on an arduino sketch that converted potentiometers positions into PPM signal. Each potentiometer's center pin must be connected to an A0-A5 arduino's pin, one pin on +5v and the last one on ground.

I just rewrited the source code, so i'd like to share it :

#define NB_WAY 6 // number of ways
#define LOW_LENGTH 300 // How long last (in Ás) a low between 2 pulses
#define MIN_PPM_PULSE 1300 // minimum pulse length in Ás
#define PPM_PULSE_LENGTH 700 // how much more Ás will last the max pulse length
#define PACKET_LENGTH 21000 // How long (Ás) last a full trame

// trame length is fixed ! Every trame will make PACKET_LENGTH Ás !
// MUST NO BE MORE THAN 32ms !!! (timer's prescaler constraint)


int way_value[NB_WAY];
int way_pin[NB_WAY];
int way_min[NB_WAY];
int way_max[NB_WAY];

int i = 0;
int p = 0; // temp var for duty cycle calculation
int last_i_timer = 0; // last way's value sent through PPM signal
unsigned long int trame_elapsed_time = 0;
bool output_state = LOW;

void setup() {
  // ppm output :
  digitalWrite(PPM_OUTPUT, output_state);
  // inits arrays
    way_pin[i] = 14 + i;
    pinMode(way_pin[i], INPUT);
    way_value[i] = analogRead(way_pin[i]);
    way_min[i] = way_value[i];
    way_max[i] = way_
...Continue Reading