Loading...
  Show Posts
Pages: 1 ... 4 5 [6]
76  Forum 2005-2010 (read only) / Exhibition / Re: Arduino-Controlled RC Transmitter on: March 30, 2010, 06:46:01 am
Hi Ian,

The missing timer file would certainly explain why is wasn't working!

If your code works then it isn't a hack, it's a solution! smiley-grin

I have re-uploaded my code if you want to give it another go. This is the version that is currently working for me.

http://www.miselph.co.uk/arduino/Version_0_2.zip
77  Forum 2005-2010 (read only) / Exhibition / Re: Arduino-Controlled RC Transmitter on: March 28, 2010, 10:39:12 am
The output should be on pin 10.
Make sure that you have set pinMode(10, OUTPUT); or it won't work.

The chip should be the same, just a different package.

Try running this:

Code:

void setup()
{
   setup_timer();
}


void setup_timer()
{
   TCCR1A = B00110001; // Compare register B used in mode '3'
   TCCR1B = B00010010; // WGM13 and CS11 set to 1
   TCCR1C = B00000000; // All set to 0
   TIMSK1 = B00000010; // Interrupt on compare B
   TIFR1  = B00000010; // Interrupt on compare B
   OCR1A = 20000;
   OCR1B = 10000;

   pinMode(10, OUTPUT);
}

void loop()
{

}

I haven't tested it, but that should output a nice square waveform at 50hz. If it doesn't work then there is an issue with how I have set the timers. The normal way to set the timers is by using statements like:
Code:
TCCR1B = _BV(WGM13) | _BV(CS11);
which allow portability across different chips where the registeres might be slightly different, but according to the data sheet our processors are the same.

Let me know how you get on.
78  Forum 2005-2010 (read only) / Exhibition / Re: Arduino-Controlled RC Transmitter on: March 27, 2010, 06:05:30 pm
Hi Ian,

Hardware mapping:

If you open the sketch and look at the sticks_include.h tab and look at line 21 you sould find:

Code:
int stick_inputs[4] = {0,1,2,3}; //input ports for the sticks

and in switches_include.h on line 6

Code:
int switch_pins[number_of_switches] = {11,12,13,8};

The stick ranges are set in the sticks_include.h file, right at the top.
Code:
const int stick_limits[4][3] = { //stick limits, given as top, center and bottom
  {
    604, 501, 396            }
  ,
  {
    620, 501, 396            }
  ,
  {
    617, 511, 398            }
  ,
  {
    649, 480, 368            }
};

I have also changed the PPM generation timings slightly, they should be:

Code:
#define OUTPUT_TOP 2000 - timer_pause
#define OUTPUT_CENTER 1500 - timer_pause
#define OUTPUT_BOTTOM 1000 - timer_pause
in the output_include.h file

Does that help?
79  Forum 2005-2010 (read only) / Exhibition / Re: Arduino-Controlled RC Transmitter on: March 25, 2010, 02:50:40 pm
Hi Ian,

If you want to use the 16 x 2 LCD as I have you might like the library I have written to control it via a shift register (so it uses less pins smiley ).
All the info, including vero-board layout and library can be found on my blog:

http://cjparish.blogspot.com/

Let me know how you get one with it!

Chris
80  Forum 2005-2010 (read only) / Exhibition / Re: Arduino-Controlled RC Transmitter on: March 25, 2010, 12:54:42 pm
Hi guys!
Thanks for the positive comments.

CrashingDuchman:
The code already includes both dual rates and exponential smiley-grin The exponential isn't brilliant, I need to find a better equation, but it does work.
The sticks are connected to analog pins 0,1,2 and 3 and the switches are connected to pins 8,11,12 and 13 (I didn't use 9 or 10 because they are the output pins from timer1)
As the code stands, switches 0 and 1 are set up to activate the rates on the ailerons and elevators.

Here is a piccit:


In this picture the yellow wires are the switches (my farnell order only arrived this morning, and I haven't got tound to wiring them up) and connecting any one of them to ground changes the switch state. The green leads trailing off to the right are the connection points for the oscilloscope.

I am using the original RF board from the Micron transmitter, which is a sub-board attached to the base of the antenna. However, this required me to use a FET attached to the pulse output pin (pin 10) to create a transistor NOT gate so as to facillitate switching of a higher voltage as the RF board runs at 9.5v

My long(er) term goals for this project include an on-transmitter (or plug in, as my tx case is quite small) lcd display and buttons for changing settings without having to reload the firmware, and upgrading the RF section to 2.4gHz.

I am planning on building this into my Mircon transmitter case, and when I do I will post more pics and upload the eagle schematics.

Chris
81  Forum 2005-2010 (read only) / Exhibition / Re: Arduino-Controlled RC Transmitter on: March 25, 2010, 02:21:10 am
Hi Folks,

I know this is quite an old thread, but I thought you might be interested in this.

I decided to replace the PPM encoder board in my old Micron transmitter that I built from a kit some 15+ years ago with an arduino based solution.

This solution reads the four sticks, along with four switches and encodes them into the appropreate PPM pulse train. I have also included code for v-tail, differential and delta mixing.

The way my code differs from yours is in the way I generate the pulse train: I have used the 16bit timer (timer 1) set to phase and frequency correct PWM to generate the pulse train from an array of values.

The timer settings are:
Code:
  TCCR1A = B00110001; // Compare register B used in mode '3'
   TCCR1B = B00010010; // WGM13 and CS11 set to 1
   TCCR1C = B00000000; // All set to 0
   TIMSK1 = B00000010; // Interrupt on compare B
   TIFR1  = B00000010; // Interrupt on compare B
   OCR1A = timer_framelength;
   OCR1B = timer_pause;

and the ISR code is:

Code:
ISR(TIMER1_COMPA_vect)
{
  if (timer_ptr == number_of_outputs) {
    timer_ptr = 0;  //reset the pointer to 0
    OCR1A = timer_framelength - (timer_accumulator * timer_correction_factor); //calculate the padding
    timer_accumulator = 0;  //set the accumulator to 0
  }
  else {
    OCR1A = (pulses[timer_ptr] + timer_pause) * timer_correction_factor; //set the pulse length
    timer_accumulator += pulses[timer_ptr] + timer_pause; //add the pulse length to the accumulator
    timer_ptr++;  //increment the pointer
  }
}

and the required variables and constants are:

Code:
#define timer_correction_factor 1.09                        //timer correction factor. This is needed if your arduino is too fast or slow, like mine. :(
#define timer_framelength 20000 * timer_correction_factor   //Maximum framelength in counter ticks
#define timer_pause 300 * timer_correction_factor           //Pause between pluses in counter ticks

int timer_accumulator = 0;         //accumulator. Used to calculate the frame padding
int timer_ptr = 0;                 //timer array pointer
int pulses[7];

To generate the pulse train, enter values into the array corrisponding to the channel pulse in micro seconds, so for a 2000 micro seconds pulse enter 2000. The frame padding is calculated automatically.

If anyone would like to take a look at the complete source code, feel free to download it; it's just too big to post here:
http://www.miselph.co.uk/arduino/Version_0_2.zip

I hope this can be of use to someone. When I have finished the project I will post the details on this forum.

If anyone needs any help with timers, I have become quite adept at dealing with them and would be more than happy to help

Chris
82  Forum 2005-2010 (read only) / Exhibition / Re: Arduino RC Transmitter on: April 14, 2010, 05:32:07 am
Ah.... looks like a permissions problem! I'll chmod the files to 777 and re-upload!
83  Forum 2005-2010 (read only) / Exhibition / Arduino RC Transmitter on: April 11, 2010, 06:28:55 pm
Hi Folks,

I have posted bits about this project on here before, but now version 1 is complete I figured it could be added to the exhibition.

I have built a seven channel RC transmitter by creating a new PPM board for my old 35mHz transmitter.




I haven't yet flown with it as I don't currently have a flight worthy aircraft, but I am working on it!

The firmware currently caters for:

    * Four sticks mapped to 4 output channels according to the 'mode' that the flyer uses.
    * Dual rates on elevator and ailerons activated by two of the switches
    * Exponential available (but I am not currently using it)
    * V-tail mixer for coupling elevator and rudder on vtail models
    * Differential ailerons
    * Delta mixing with differential ailerons.
    * Battery voltage sensing with visual level representation using two LED's (red and green)
    * Test mode that sweeps one output channel. Good for range testing on your own!
    * Ability to save the current settings to EEPROM and load them again (not in use yet, but will be soon)
    * Servo reversing
    * Servo center point and end point adjustment

The code can be downloaded here:
http://www.gaffertapeandcableties.co.uk/downloads/Version_1.zip

I have written a blog article on the whole thing is you want to know more
http://www.gaffertapeandcableties.co.uk/?p=4

Chris
Pages: 1 ... 4 5 [6]