Extra inputs for Devo Tx's
- Cereal_Killer
- Offline
Taranis X9E | DEVO 10 | Devo U7E | Taranis Q7
What I do in real life: rivergoequestrian.com/
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
Deviation Devo7e 3way switch mod, A7105, NRF24L01
Devo6s 2x2 switch mod, trim mod, haptic, multimodule, A7105, NRF24L01, CC2500
Devo12e 4-in-1 with voice mod -- it speaks!!
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
My Arduino-based extra switch box is externally mounted, runs on a single 9v battery and connects to the DSC (trainer) port. I posted the sketch here some time ago. This is set up to provide two potentiometers (PPM1 and PPM2) assigned to my gimbal on channels 6 and 7, one 6-position Flight Mode switch panel (PPM7) assigned to channel 5, and 2-way switches on PPM4, PPM5 and PPM6 assigned to channels 8, 9 and 10. I set aside PPM3 for a 6-way rotary switch but did not use it.
Please let me know if you have any questions.
Deviation Devo7e 3way switch mod, A7105, NRF24L01
Devo6s 2x2 switch mod, trim mod, haptic, multimodule, A7105, NRF24L01, CC2500
Devo12e 4-in-1 with voice mod -- it speaks!!
Please Log in or Create an account to join the conversation.
- Cereal_Killer
- Offline
I'm away from my computer right now but I did take a look at the file on my phone, just curious why the deltaPW is set to 470?
Taranis X9E | DEVO 10 | Devo U7E | Taranis Q7
What I do in real life: rivergoequestrian.com/
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
Deviation Devo7e 3way switch mod, A7105, NRF24L01
Devo6s 2x2 switch mod, trim mod, haptic, multimodule, A7105, NRF24L01, CC2500
Devo12e 4-in-1 with voice mod -- it speaks!!
Please Log in or Create an account to join the conversation.
- Rolf
- Offline
- Devo 6s, Jumper T8SG v2+ carbon
- Posts: 43
my Devo 7e lacks an 'oh shit'-button, as Cerial_Killer mentioned in this thread. If I understand the discussion correct, a hardware-button or -switch, put into the trainer-hole, could be used in the deviation-software initiating the rescue-action.
I would like to buy such a switch/button, because I don't like opening and melting my tx.
Where can I buy it and how can I use it in deviation-software?
Walkera Devo 6s, 7e and 10, Jumper T8SG v2+ lcd, Brain 2, Spektrum satellites and SPM4649T
Please Log in or Create an account to join the conversation.
- mwm
- Topic Author
- Offline
Rolf wrote: Hey,
my Devo 7e lacks an 'oh chit'-button, as Cerial_Killer mentioned in this thread. If I understand the discussion correct, a hardware-button or -switch, put into the trailer-hole, could be used in the deviation-software initiating the rescue-action.
I would like to buy such a switch/button, because I don't like opening and melting my tx.
Where can I buy it and how can I use it in deviation-software?
I haven't searched the thread for this because these forums don't have a thread search function, but if you just want another button/switch, have you considered using one of the Left/Right/Up/Down or throttle trim buttons, or are you using them all?
Alternatively, if you want someone to do the 3x2 mod, check out Jon Barter's thread on rcgroups: www.rcgroups.com/forums/showthread.php?t=2364228
Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.
My remotely piloted vehicle ("drone") is a yacht.
Please Log in or Create an account to join the conversation.
- Cereal_Killer
- Offline
Taranis X9E | DEVO 10 | Devo U7E | Taranis Q7
What I do in real life: rivergoequestrian.com/
Please Log in or Create an account to join the conversation.
- Rolf
- Offline
- Devo 6s, Jumper T8SG v2+ carbon
- Posts: 43
I did as mwm and cereal_killer told: It works for me as proposed. Never noticed this dev-feature.
I even realized a combination of 2 switches for vstabi bank-switching between 4 banks.
Thanks a lot.
Walkera Devo 6s, 7e and 10, Jumper T8SG v2+ lcd, Brain 2, Spektrum satellites and SPM4649T
Please Log in or Create an account to join the conversation.
- Cereal_Killer
- Offline
I have STILL not got this working. I've followed your wiring exactly, I've got the two POT's working (or I should say, using your code they still work, cause they've always worked) but I can not get my two 3-was switches to work.
I've got them wired to D2 3 4 and 5, I've got the middle legs wired to GND (do I need to be using diodes like on the devo built-in switch mod?) but it just doesnt work. PPM3 moves with switch 1 between 103 and 0 and PPM4 moves with switch1 (THE SAME SWITCH) between 0 and -103.
Even since I first got the POT's working I've been trying to figure this out. Can you please help me...
Taranis X9E | DEVO 10 | Devo U7E | Taranis Q7
What I do in real life: rivergoequestrian.com/
Please Log in or Create an account to join the conversation.
- Epitaph
- Offline
- Posts: 291
Please Log in or Create an account to join the conversation.
- Epitaph
- Offline
- Posts: 291
"Real estate" inside the 7E is pretty scarce, and as such, the smaller the controller the better. If the goal for a certain person is JUST a couple of pots, no switches, or maybe a single switch, like just a minimum... would a Digispark be configurable for it? I was just asking because I have a Nano on its way, but I also have a Digispark with no home in a drawer somewhere, and that's nice and small...
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
Cereal_Killer wrote: Deal57,
I have STILL not got this working. I've followed your wiring exactly, I've got the two POT's working (or I should say, using your code they still work, cause they've always worked) but I can not get my two 3-was switches to work.
I've got them wired to D2 3 4 and 5, I've got the middle legs wired to GND (do I need to be using diodes like on the devo built-in switch mod?) but it just doesnt work. PPM3 moves with switch 1 between 103 and 0 and PPM4 moves with switch1 (THE SAME SWITCH) between 0 and -103.
Even since I first got the POT's working I've been trying to figure this out. Can you please help me...
Given the values you mention, I'm guessing you're using sw1_uS AND sw2_uS for the first 3-way. You do not need diodes.
So for the first 3-way, the code should be:
if (digitalRead(swPin_D1) != 1) { // 3-way Switch 1
sw1_uS = pulseMin;
} else {
if (digitalRead(swPin_D2) != 1 ) {
sw1_uS = pulseMax;
} else {
sw1_uS = pulseMid;
}
}
The poles of the switch are each checked to see if the are NOT high (grounded means the switch is on); only one of the poles on a 3-way switch can be grounded at any given time. In the example, one pole of the 3-way is connected to digital pin 2, and one pole to digital pin 3 (for portability I use variables swPin_D1 and swPin_D2). The pulse value (pulseMin, pulseMax, pulseMid) is assigned to the sw1_uS variable (first 3-way), which is in turn used in the output stream for channel 3. A similar section of code would go to sw2_uS on channel 4 for the other 3-way switch.
If this doesn't take care of it, PM me your code.
Deviation Devo7e 3way switch mod, A7105, NRF24L01
Devo6s 2x2 switch mod, trim mod, haptic, multimodule, A7105, NRF24L01, CC2500
Devo12e 4-in-1 with voice mod -- it speaks!!
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
Epitaph wrote: Actually, here's a question...
"Real estate" inside the 7E is pretty scarce, and as such, the smaller the controller the better. If the goal for a certain person is JUST a couple of pots, no switches, or maybe a single switch, like just a minimum... would a Digispark be configurable for it? I was just asking because I have a Nano on its way, but I also have a Digispark with no home in a drawer somewhere, and that's nice and small...
Now that's a thought! It has four analog pins, use two for the pots. Then you need one pin for the PWM output. With the remaining three pins you can put one 3-way and one 2-way, or maybe three 2-ways. It's not much cheaper than a nano, but the space saved is awesome. Gotta get me one of those to try!
Deviation Devo7e 3way switch mod, A7105, NRF24L01
Devo6s 2x2 switch mod, trim mod, haptic, multimodule, A7105, NRF24L01, CC2500
Devo12e 4-in-1 with voice mod -- it speaks!!
Please Log in or Create an account to join the conversation.
- Epitaph
- Offline
- Posts: 291
I originally got it for an LED project on a small plane, but that project got put aside, so it's no great loss if the digispark goes back in the drawer...
But if you can get it going, Deal57, I think it might be an interesting option purely because it's so small, and can even be made smaller once you have it programmed by cutting the USB part off once you don't need it!!
Please Log in or Create an account to join the conversation.
- Epitaph
- Offline
- Posts: 291
Please Log in or Create an account to join the conversation.
- Cereal_Killer
- Offline
Taranis X9E | DEVO 10 | Devo U7E | Taranis Q7
What I do in real life: rivergoequestrian.com/
Please Log in or Create an account to join the conversation.
- Cereal_Killer
- Offline
As of now switch D1 operates as a 2 way moving Ch PPM3 between -108 and 0 (switched from low to mid, switching it up does nothing),The second 3-way does the same thing. This is your code from page 4 with the stuff I dont use removed and the snipit you posted above added in at the end (original DigitalRead lines removed)
// PPM Encoder Analog Add-ons for Devo7e
// For use with Arduino Pro Mini 328P
// J. Diehl 04/08/2015
// Based on a sketch by Ian Johnston 29/04/2010
// modified by Epyon and Cereal_Killer
// Version 2.0
// Low cost way to add extra POT's to any radio that accepts PPM input for <$15
// using an arduino nano and a few POT's, visit DeviationTX.com for info.
// POT's on A1 and A2, optional Thumbwheel on A3, optional switches on D6-D10
// PPM output on D13
// PPM inout to tip of 3.5 stereo, this is the black wire on your Devo 7E
// Ring Shunt on D11 when shorted indicate DSC port in use (e.g. Plug inserted)
// this will stop monitoring the inputs and outputs until these are no longer shorted
//
// Original Sketch uses:
// A1-3 Analog in for Pots 1, 2 and 3
// D6-10 Digital in for up to 5 switches
// D11 - Devo7e DSC Port "Ring Shunt" high; goes low when plug is inserted into DSC
// D13 - PPM Output with LED
int potPin_A1= A1; //Declare potPin_A1 to be analog pin A1
int potPin_A2= A2; //Declare potPin_A2 to be analog pin A2
int AI_Raw_A1; // Analog In raw var - 0->1023
int AI_Raw_A2; // Analog In raw var - 0->1023
int A1_uS = 750; // Analog 1 uS var
int A2_uS = 750; // Analog 2 uS var
int swPin_D1= 6; //Declare swPin_D1 to be Digital pin 6
int swPin_D2= 7; //Declare swPin_D2 to be Digital pin 7
int swPin_D3= 8; //Declare swPin_D3 to be Digital pin 8
int swPin_D4= 9; //Declare swPin_D4 to be Digital pin 9
int sw1_uS = 750; // Switch 1
int sw2_uS = 750; // Switch 2
int sw3_uS = 750; // Switch 3
int sw4_uS = 750; // Switch 4 // not used
int outPinPPM = 13; // Declare ppmPin to be arduino pin 13
int Fixed_uS = 300; // PPM frame fixed LOW phase
int pulseMin = 750; // pulse minimum width minus start in uS
int pulseMax = 1700; // pulse maximum width in uS
int pulseMid = 1180; // pulse midpoint width in uS
ISR(TIMER1_COMPA_vect) {
ppmoutput(); // Jump to ppmoutput subroutine
}
void setup() {
pinMode(potPin_A1, INPUT); //set potPin_A1 to be an input
pinMode(potPin_A2, INPUT); //set potPin_A2 to be an input
pinMode(swPin_D1, INPUT); //set swPin_D1 to be an input
digitalWrite(swPin_D1, HIGH); // turn on pull-up resistor
pinMode(swPin_D2, INPUT); //set swPin_D2 to be an input
digitalWrite(swPin_D2, HIGH); // turn on pull-up resistor
pinMode(swPin_D3, INPUT); //set swPin_D3 to be an input
digitalWrite(swPin_D3, HIGH); // turn on pull-up resistor
pinMode(swPin_D4, INPUT); //set swPin_D4 to be an input
digitalWrite(swPin_D4, HIGH); // turn on pull-up resistor
pinMode(outPinPPM, OUTPUT); //set ppmPin to be an OUTPUT
digitalWrite(outPinPPM, HIGH); // turn on LED
// 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 = 22000; // 22mS PPM output refresh
OCR1B = 1000;
Serial.begin(9600); // turn on Serial Port
}
void ppmoutput() { // PPM output sub
// Channel 1 - Analog 1
digitalWrite(outPinPPM, LOW);
delayMicroseconds(Fixed_uS); // Hold
digitalWrite(outPinPPM, HIGH);
delayMicroseconds(A1_uS); // Hold for A1_uS microseconds
// Channel 2 - Analog 2
digitalWrite(outPinPPM, LOW);
delayMicroseconds(Fixed_uS); // Hold
digitalWrite(outPinPPM, HIGH);
delayMicroseconds(A2_uS); // Hold for A2_uS microseconds
// Channel 3 - Switch 1
digitalWrite(outPinPPM, LOW);
delayMicroseconds(Fixed_uS); // Hold
digitalWrite(outPinPPM, HIGH);
delayMicroseconds(sw1_uS); // Hold for sw1_uS microseconds
// Channel 4 - Switch 3
digitalWrite(outPinPPM, LOW);
delayMicroseconds(Fixed_uS); // Hold
digitalWrite(outPinPPM, HIGH);
delayMicroseconds(sw3_uS); // Hold for sw2_uS microseconds
// Synchro pulse
digitalWrite(outPinPPM, LOW);
delayMicroseconds(Fixed_uS); // Hold
digitalWrite(outPinPPM, HIGH); // Start Synchro pulse
// Serial.println(rshPinStr + rshPinState);
/* Serial.print("You are writing a value of "); //for debugging print your values
Serial.print(A1_uS);
Serial.print(" ");
Serial.print(A2_uS);
Serial.print(" ");
Serial.print(sw1_uS);
Serial.print(" ");
Serial.print(sw2_uS);
Serial.print(" ");
Serial.print(sw3_uS);
Serial.print(" ");
Serial.print(sw4_uS);
Serial.print(" ");
Serial.println(" End");
*/
}
void loop() {
// logic to read each analog input
// Read analog pins
AI_Raw_A1 = analogRead(potPin_A1); // Analog Pot 1
AI_Raw_A2 = analogRead(potPin_A2); // Analog Pot 2
// Map analog inputs to PPM rates for each of the channels
A1_uS = AI_Raw_A1 + pulseMin;
A2_uS = AI_Raw_A2 + pulseMin;
// Check limits
if (A1_uS <= 750) A1_uS = 750; // Min
if (A1_uS >= 1700) A1_uS = 1700; // Max
if (A2_uS <= 750) A2_uS = 750; // Min
if (A2_uS >= 1700) A2_uS = 1700; // Max
if (digitalRead(swPin_D1) != 1) { // 3-way Switch 1
sw1_uS = pulseMin;
} else {
if (digitalRead(swPin_D2) != 1 ) {
sw1_uS = pulseMax;
} else {
sw1_uS = pulseMid;
}
}
if (digitalRead(swPin_D3) != 1) { // 3-way Switch 2
sw3_uS = pulseMin;
} else {
if (digitalRead(swPin_D4) != 1 ) {
sw3_uS = pulseMax;
} else {
sw3_uS = pulseMid;
}
}
}
Taranis X9E | DEVO 10 | Devo U7E | Taranis Q7
What I do in real life: rivergoequestrian.com/
Please Log in or Create an account to join the conversation.
- Epitaph
- Offline
- Posts: 291
From what I've found, pins 0 and 1 are PWM outputs, and 2, 3 and 4 are analogue inputs
// Devo 7e PPM input
// Adapted for Digispark
// Based on sketch by Ian Johnston
// Based on sketch adaption by Epyon for Arduino Nano V3.0
int AI_Pin_A1 = 2; // Analog In 1
int AI_Pin_A2 = 3; // Analog In 2
int AI_Raw_A1; // Analog In raw var - 0->1023
int AI_Raw_A2; // Analog In raw var - 0->1023
int A1_uS = 750; // Analog 1 uS var
int A2_uS = 750; // Analog 2 uS var
int Fixed_uS = 300; // PPM frame fixed LOW phase
int pulseMin = 750; // pulse minimum width minus start in uS
int pulseMax = 1700; // pulse maximum width in uS
int outPinPPM = 0; // PPM out on digital pin 0
ISR(TIMER1_COMPA_vect) {
ppmoutput(); // Jump to ppmoutput subroutine
}
void setup() {
// Serial.begin(9600) ; // Test
pinMode(outPinPPM, OUTPUT); // sets the digital pin as output
// 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 = 22000; // 22mS PPM output refresh
OCR1B = 1000;
}
void ppmoutput() { // PPM output sub
// Channel 1 - Analog 1
digitalWrite(outPinPPM, LOW);
delayMicroseconds(Fixed_uS); // Hold
digitalWrite(outPinPPM, HIGH);
delayMicroseconds(A1_uS); // Hold for A1_uS microseconds
// Channel 2 - Analog 2
digitalWrite(outPinPPM, LOW);
delayMicroseconds(Fixed_uS); // Hold
digitalWrite(outPinPPM, HIGH);
delayMicroseconds(A2_uS); // Hold for A2_uS microseconds
// Synchro pulse
digitalWrite(outPinPPM, LOW);
delayMicroseconds(Fixed_uS); // Hold
digitalWrite(outPinPPM, HIGH); // Start Synchro pulse
}
void loop() { // Main loop
// Read analog pins
AI_Raw_A1 = analogRead(AI_Pin_A1);
AI_Raw_A2 = analogRead(AI_Pin_A2);
// Map analog inputs to PPM rates for each of the channels
A1_uS = AI_Raw_A1 + pulseMin;
A2_uS = AI_Raw_A2 + pulseMin;
// Check limits
if (A1_uS <= 750) A1_uS = 750; // Min
if (A1_uS >= 1700) A1_uS = 1620; // Max
if (A2_uS <= 750) A2_uS = 750; // Min
if (A2_uS >= 1700) A2_uS = 1620; // Max
}
From what I've read, the Digispark has 6kb of memory for coding, and this takes up little more than 2kb, so there's plenty to play with on the code, just a limit on the I/O ports... but of course, that all depends on what you want to use the transmitter for!!
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
Digital 2 is analog (ADC channel) 1
Digital 3 is analog (ADC channel) 3
Digital 4 is analog (ADC channel) 2
Digital 5 is analog (ADC channel) 0
Good reference material is found here.
That being said, it looks to me like we have plenty of I/O. JP3 is the connector and it is numbered 0-5, corresponding to the digital pin number. Here's how I think it goes.
JP3-0 - Digital 0, we can use for one pole of SW1 (3-way)
JP3-1 - Digital 1, we can use for output to PPM, shared by LED
JP3-2 - Analog 1, Input for Pot 1
JP3-3 - Digital 3, used by USB, use for second pole of SW1 (3-way)
JP3-4 - Analog 2, Input for Pot 2
JP3-5 - Digital 5, also NRESET, optional 2-way switch SW2 - can be used as reset for programming
I think the code I attached here has these set up. You're welcome to make whatever changes are needed.
Deviation Devo7e 3way switch mod, A7105, NRF24L01
Devo6s 2x2 switch mod, trim mod, haptic, multimodule, A7105, NRF24L01, CC2500
Devo12e 4-in-1 with voice mod -- it speaks!!
Please Log in or Create an account to join the conversation.
- Home
- Forum
- Development
- Development
- Extra inputs for Devo Tx's