Extra inputs for Devo Tx's

More
22 Aug 2015 00:08 #37111 by Richard96816
Replied by Richard96816 on topic Extra inputs for Devo Tx's

Deal57 wrote: When you are discussing S.bus and SPI, today aren't you really talking about the "output" side of the Transmitter system, that is, how the TX tells our peripherals (RX, voice prompter, etc.) to work? Can we look just at "input"?


You do it all the time with SPI. Transmitter to receiver.

Please Log in or Create an account to join the conversation.

More
22 Aug 2015 00:13 #37113 by mwm
Replied by mwm on topic Extra inputs for Devo Tx's
Actually, no. SPI is what's used for intermodule communications inside the Tx. S.Bus and similar are used for talking between an Rx and other components.

In particular, the PPM that's used as input for the trainer port that we're piggy-backing this on is also used by an Rx to talk to flight controllers. This is how the wireless trainer mod talked about here works. The newer protocols like S.Bus and SRXL can also do all that, except we don't have an S.Bus interface in deviation.

All of these protocols describe a collection of channels as a packet that can be sent over the wire somehow. So you could, in theory, have a "trainer" port that does one of those protocols, and also have an extra inputs box that used them instead of PPM. I'm not sure if you could do it on the PPM port or not, as I haven't looked at the hardware details yet.

As far as I know, nobody is actually doing this. The latest hotness is wireless interfaces using the same protocols that are being used to talk to Rx's, so that way you don't need another rf module in the Tx. The universal module is going to have a bluetooth chip on it, so you could in theory use that to add controls on a phone or table or even a bluetooth game controller.

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.

More
22 Aug 2015 00:32 #37116 by Richard96816
Replied by Richard96816 on topic Extra inputs for Devo Tx's

mwm wrote: Actually, no. SPI is what's used for intermodule communications inside the Tx. S.Bus and similar are used for talking between an Rx and other components.


True. But in this case we've got two modules that both know how to speak SPI. Why put more complexity and delay between them? Especially since we're in control of the software side of the protocols too ...

Please Log in or Create an account to join the conversation.

More
22 Aug 2015 00:42 #37117 by mwm
Replied by mwm on topic Extra inputs for Devo Tx's
For external communications (i.e. - from the Tx to a collection of other devices), you have to have a packet-level protocol somewhere. SPI doesn't provide that. Sure you could build one on top of it, but you'd also have to build all the devices you were going to use.

The advantage of using one of the extant protocols means you can find Rx's to build a wireless trainer module, if nothing else. While CPPM has serious problems, S.Bus and SRXL both have more channels and a shorter frame than any CPPM system I'm aware of, and in general avoid it's problems. I'm not convinced that they are more complex than an SPI protocol would be, but can't really judge because there's no proposed standard for the latter. I suspect they are simpler to use, because you'll find open source libraries to just drop into your code - though I haven't looked for them yet - rather than having to design and code the packet-level protocol from scratch.

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.

More
22 Aug 2015 00:52 #37118 by Richard96816
Replied by Richard96816 on topic Extra inputs for Devo Tx's

mwm wrote: For external communications (i.e. - from the Tx to a collection of other devices), you have to have a packet-level protocol somewhere. SPI doesn't provide that. Sure you could build one on top of it, but you'd also have to build all the devices you were going to use.


'Extra inputs' was about internal communications. The item simply grew a little too large for the Devo case -- it's still closely coupled. Attached, actually. And having closely coupled multiple processors talking to each other is the direction things seem to be going with Deviationtx. I see your points. But I also find possible coupling of STM and Arduino (or other STMs) via SPI to be worth exploring. Or at least discussing ... :-)

Please Log in or Create an account to join the conversation.

More
22 Aug 2015 02:39 #37122 by mwm
Replied by mwm on topic Extra inputs for Devo Tx's
Oh, I agree - the actual location of the hardware is moot, so long as you're close enough for digital signaling to work.

I suspect the determining factor in choice of a protocol for use in a devo 7E is going to be what hardware is available. PPM got used because there was already both hardware and software in place. So what hardware can be used for SPI, or whatever?Is it possible to do one of the async protocols over the current PPM line? That would let you do everything we're doing with PPM: deviation/deviation trainer, wireless trainers with the appropriate Rx, and adding devices - with less delay and more channels than PPM. I think it'd be a win, but it may not be possible.

If you want to do SPI, you need to find an enable line for it, so you'd have to replace one of the RF modules. Possibly using the multi-module code extended to deal with extra input devices. But that buys you less than using one of the serial protocols, because you'd have to figure out how to do trainer mode with it. And I don't think a wireless trainer mode will be possible, because it runs into the same issues as doing it in deviation with the existing hardware does. And while SPI would be faster than any of the serial protocols, I don't think it would matter since we can't send samples faster than an RF channel in any case.

I wonder if anyone has done a Tx that can use one of the serial protocols as a "trainer" protocol, or if there's head tracking gear that does such, or anything similar? This really is "external", so SPI wouldn't be appropriate. Oh dear. Since these are strictly external, why not use the USB port? That ought to be better than bluetooth, which is SOP for video gamers these days.

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.

More
25 Aug 2015 03:16 #37189 by davidwyl
Replied by davidwyl on topic Extra inputs for Devo Tx's
i already added a7105 + NRF + 2x3way swithch on my D7e, so far im very please with the result.
But not i want to add 2 pots, i have near zero knowledge on Arduino.
So from what i understand in this post, i need:
1. ATmega328P Nano V3
2. 2x 5k potentiometer (must be 5k pot? or any value will work?)
what else component do i need?
im interested to add 2 pot into my D7E, so can i use @Cereal_Killer in page2??

Please Log in or Create an account to join the conversation.

More
25 Aug 2015 08:43 #37194 by Epyon
Replied by Epyon on topic Extra inputs for Devo Tx's

davidwyl wrote: So from what i understand in this post, i need:
1. ATmega328P Nano V3
2. 2x 5k potentiometer (must be 5k pot? or any value will work?)
what else component do i need?


Any value pot will do. I'm currently using 10k's, these , but will be switching them out with these as they're smaller and I'm gonna cram as much as I can into my poor 7e.

A couple small capacitors would be a good idea on the power into the Nano & and definitely one on the power out to the pots. It helps with jitter.

If you're anything like me, it won't end at 2 pots. You'll be thinking up all sorts of possible switches and mods. OLED displays, audio boards, real time clock, 9DOF module, etc.

Please Log in or Create an account to join the conversation.

More
25 Aug 2015 09:45 #37195 by davidwyl
Replied by davidwyl on topic Extra inputs for Devo Tx's
thank for that link...
for now i will try settle 2pot first, might add more switches in the future.
can i use code in page2 or any other code u suggesting??
&
so i just follow pin connection diagram in this post ????

Please Log in or Create an account to join the conversation.

More
25 Aug 2015 10:10 #37196 by Epyon
Replied by Epyon on topic Extra inputs for Devo Tx's
Everything posted so far has been based on Ian Johnston's work here

For only 2 pots, this is all you'll need code-wise.
// Devo 7e PPM input
// For use with Arduino Nano V3.0
// Based on sketch by Ian Johnston

int AI_Pin_A1 = 2;    // Analog In 1
int AI_Pin_A2 = 1;    // 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 = 10;       // PPM out on digital pin 10

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 
}

Here's my current code for 2 pots, a 6-way switch, a 3-way switch, and a piezo buzzer.
// Devo 7e PPM input
// For use with Arduino Nano V3.0
// Based on sketch by Ian Johnston

int AI_Pin_A1 = 2;    // Analog In 1
int AI_Pin_A2 = 1;    // 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 sw1_uS = 750;     // 6-way switch
int sw2_uS = 750;     // 3-way switch

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 = 10;       // PPM out on digital pin 10
int inPinD1 = 2;        // 6-way inputs: digital pin 2
int inPinD2 = 3;        // digital pin 3
int inPinD3 = 4;        // digital pin 4
int inPinD4 = 5;        // digital pin 5
int inPinD5 = 6;        // digital pin 6
int inPinD6 = 7;        // digital pin 7
int inPinD7 = 8;        // 3-way inputs: digital pin 8
int inPinD8 = 9;        // digital pin 9

int piezoPin = 13;        // piezo buzzer on digital pin 13

boolean Beep1 = false;
boolean Beep2 = false;
boolean Beep3 = false;
boolean Beep4 = false;
boolean Beep5 = false;
boolean Beep6 = false;
boolean Beep7 = false;
boolean Beep8 = false;
boolean Beep9 = false;

ISR(TIMER1_COMPA_vect) {
    ppmoutput(); // Jump to ppmoutput subroutine
}

void setup() {

  // Serial.begin(9600) ; // Test

  pinMode(outPinPPM, OUTPUT);   // sets the digital pin as output
  pinMode(inPinD1, INPUT);      // sets the digital pin as input
  digitalWrite(inPinD1, HIGH);  // turn on pull-up resistor
  pinMode(inPinD2, INPUT);
  digitalWrite(inPinD2, HIGH);
  pinMode(inPinD3, INPUT);
  digitalWrite(inPinD3, HIGH);
  pinMode(inPinD4, INPUT);
  digitalWrite(inPinD4, HIGH);
  pinMode(inPinD5, INPUT);
  digitalWrite(inPinD5, HIGH);
  pinMode(inPinD6, INPUT);
  digitalWrite(inPinD6, HIGH);
  pinMode(inPinD7, INPUT);
  digitalWrite(inPinD7, HIGH);
  pinMode(inPinD8, INPUT);
  digitalWrite(inPinD8, HIGH);

   // 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      

// Channel 3 - 6-way switch
  digitalWrite(outPinPPM, LOW);
  delayMicroseconds(Fixed_uS);    // Hold
  digitalWrite(outPinPPM, HIGH);
  delayMicroseconds(sw1_uS);     // Hold for sw1_uS microseconds 

// Channel 4 - 3-way switch
  digitalWrite(outPinPPM, LOW);
  delayMicroseconds(Fixed_uS);    // Hold
  digitalWrite(outPinPPM, HIGH);
  delayMicroseconds(sw2_uS);     // Hold for sw2_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 
  
  if (digitalRead(inPinD1) == 0) { // Switch 1  
           sw1_uS = 750;
      if (Beep1 == false)
       tone(piezoPin, 2450, 50);
       delay(50);
       Beep1 = true;
 } else {
        noTone(piezoPin);
        Beep1 = false;
 }
  if (digitalRead(inPinD2) == 0) { // Switch 2  
           sw1_uS = 910;
      if (Beep2 == false)
       tone(piezoPin, 2550, 50);
       delay(50);
       Beep2 = true;
 } else {
        noTone(piezoPin);
        Beep2 = false;
 }
  if (digitalRead(inPinD3) == 0) { // Switch 3  
           sw1_uS = 1120;
           if (Beep3 == false)
       tone(piezoPin, 2650, 50);
       delay(50);
       Beep3 = true;
 } else {
        noTone(piezoPin);
        Beep3 = false;
 }
  if (digitalRead(inPinD4) == 0) { // Switch 4  
           sw1_uS = 1330;
           if (Beep4 == false)
       tone(piezoPin, 2750, 50);
       delay(50);
       Beep4 = true;
 } else {
        noTone(piezoPin);
        Beep4 = false;
 }
  if (digitalRead(inPinD5) == 0) { // Switch 5  
           sw1_uS = 1540;
           if (Beep5 == false)
       tone(piezoPin, 2850, 50);
       delay(50);
       Beep5 = true;
 } else {
        noTone(piezoPin);
        Beep5 = false;
 }
  if (digitalRead(inPinD6) == 0) { // Switch 6 
           sw1_uS = 1620;
           tone(piezoPin, 2850, 100);
           delay(100);
           tone(piezoPin, 2700, 100);
           delay(100);
           tone(piezoPin, 2600, 100);
           delay(100);
 } 
  if (digitalRead(inPinD7) == 0) { // Switch 7
           sw2_uS = 750;
           if (Beep7 == false)
            tone(piezoPin, 2450, 50);
            delay(50);
            Beep7 = true;    
 } else {
           noTone(piezoPin);
           Beep7 = false;  
 }
  if ((digitalRead(inPinD7) == 1) && (digitalRead(inPinD8) == 1)) { // Switch 8
           sw2_uS = 1190;
           if (Beep8 == false)
            tone(piezoPin, 2250, 50);
            delay(50);
            Beep8 = true;    
 } else {
           noTone(piezoPin);
           Beep8 = false;  
 }
  if (digitalRead(inPinD8) == 0) { // Switch 9
           sw2_uS = 1620;
           if (Beep9 == false)
            tone(piezoPin, 2450, 50);
            delay(50);
            Beep9 = true;    
 } else {
           noTone(piezoPin);
           Beep9 = false;  
 }
}

Please Log in or Create an account to join the conversation.

More
25 Aug 2015 12:40 #37201 by davidwyl
Replied by davidwyl on topic Extra inputs for Devo Tx's

Epyon wrote: e small capacitors would be a good idea on the power into the Nano & and definitely one on the power out to the pots. It helps with jitter.
.


what sort of capacitor value for the nano in and the pot?
just connect in series with the power?

Please Log in or Create an account to join the conversation.

More
25 Aug 2015 16:18 #37203 by Epyon
Replied by Epyon on topic Extra inputs for Devo Tx's
Any size on the Nano power (vin) bigger can't hurt.
For the pot power (5v) use around a 25uf, not much higher.
The caps connect from vin to ground & 5v to ground.

Please Log in or Create an account to join the conversation.

More
26 Aug 2015 10:10 #37213 by davidwyl
Replied by davidwyl on topic Extra inputs for Devo Tx's

Epyon wrote: Any size on the Nano power (vin) bigger can't hurt.
For the pot power (5v) use around a 25uf, not much higher.
The caps connect from vin to ground & 5v to ground.

just look thorough the Nano v3 datasheet, found out that the Vin recommended is 7-12v, but devo 7e doesnt provide voltage higher than 5v,
1.does it mean i have to use external power (ie: 9v battery)??
2.Arduino Pro Mini is a better choice for this mod?? (since it will run on 3.3v / 5v)

Please Log in or Create an account to join the conversation.

More
26 Aug 2015 16:29 #37219 by Epyon
Replied by Epyon on topic Extra inputs for Devo Tx's
You can get Nano clones that run @ 5v www.ebay.com/itm/261892696222?_trksid=p2...e=STRK%3AMEBIDX%3AIT I've got several in use and have been happy with them. I'd stick with a Nano since it's not much bigger than a Pro Mini and includes USB.

Please Log in or Create an account to join the conversation.

More
27 Aug 2015 08:40 #37235 by Richard96816
Replied by Richard96816 on topic Extra inputs for Devo Tx's
Just because your Nano has a regulator doesn't mean you can't inject power after it. Depends what else is going on there, but I think I've powered one with +5 before. It's meant to be a fairly flexible board.

Please Log in or Create an account to join the conversation.

More
27 Aug 2015 11:19 #37240 by aMax
Replied by aMax on topic Extra inputs for Devo Tx's

Epyon wrote: You can get Nano clones that run @ 5v www.ebay.com/itm/261892696222?_trksid=p2...e=STRK%3AMEBIDX%3AIT I've got several in use and have been happy with them. I'd stick with a Nano since it's not much bigger than a Pro Mini and includes USB.

These are nice, but seem to have a drawback, with the CH340G on board they only can work at 12Mhz...or is this wrong?

Devo7e, TaranisQ X7, R9M , 4in1 MM, Futaba FC18plusV3.2 & DFT/FLD-02

Please Log in or Create an account to join the conversation.

More
01 Sep 2015 13:13 - 01 Sep 2015 13:13 #37358 by Goossens
Replied by Goossens on topic Extra inputs for Devo Tx's
This has become a great topic on adding more input options.

I work with Arduino on most of my projects. If you want to add more switches to the board you can use an analog port and some resistors.
You can easily hook 6 switches to 1 analog port.

Here is an example.
www.instructables.com/id/How-to-access-5...-buttons-on-one-pin/
Last edit: 01 Sep 2015 13:13 by Goossens.

Please Log in or Create an account to join the conversation.

More
01 Sep 2015 18:15 #37361 by Deal57
Replied by Deal57 on topic Extra inputs for Devo Tx's
I'm a big fan of using analog input if possible, but it can be a bit, well, unreliable. The actual resistance value may fluctuate a bit with heat and age. This isn't usually much of a problem for us techie types, I guess.

I used this Frsky 6-position rotary switch into an analog port on the Arduino, and it works nicely. There are two ways to use it: you can use it as shipped, with the resistance values of -100, 0, 33, 50, 61 and 100. You can also move a resistor (they're really tiny... like 0403 size!) and get a more linear curve but I used it as shipped. This goes into my Arduino and I convert the resistance to a Flight Mode value, then put that value onto a PPM channel. For example in position 1 Arduino sees 0, position 2 is 450, position 3 is 600, and so on scale of 0-1023). If analog read is 450, FM=2. If FM=2 the PPM period is 1295 microseconds.

It works. I added a bigger knob which makes it easier for my fat fingers. I can send you an Arduino sketch if you want to see an example.

I have another way to do this that I'll write up once I get it built.

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!!
Attachments:

Please Log in or Create an account to join the conversation.

More
03 Sep 2015 13:19 - 03 Sep 2015 13:20 #37399 by Cereal_Killer
Replied by Cereal_Killer on topic Extra inputs for Devo Tx's

aMax wrote:

Epyon wrote: You can get Nano clones that run @ 5v www.ebay.com/itm/261892696222?_trksid=p2...e=STRK%3AMEBIDX%3AIT I've got several in use and have been happy with them. I'd stick with a Nano since it's not much bigger than a Pro Mini and includes USB.

These are nice, but seem to have a drawback, with the CH340G on board they only can work at 12Mhz...or is this wrong?


Definitely incorrect. The clone nano V3's with the CH340G are my favorite arduinos, they for sure run at 16mhz @ 5V. The really cool thing is that the CH340G has a built in 3V3 regulator so you input raw battery (to the Arduino's RAW pin) then you have both 5V (from the on-board LDO) AND you have 3.3V from the LDO built into the CH340G available!

I liked them so much I no have several stand alone CH340G boards for TTL converters that I like more than FDTI's.

Taranis X9E | DEVO 10 | Devo U7E | Taranis Q7

What I do in real life: rivergoequestrian.com/
Last edit: 03 Sep 2015 13:20 by Cereal_Killer.

Please Log in or Create an account to join the conversation.

More
04 Sep 2015 13:30 #37441 by davidwyl
Replied by davidwyl on topic Extra inputs for Devo Tx's
Anyone here know where I can find another spot on the mainboard that is link to SCK pin (2nd pin from left)?
I ripped my sck pin today, so now I cant solder any module to mainboard bcos sck track ripped off.
:(
Hope someone can help.
Attachments:

Please Log in or Create an account to join the conversation.

Time to create page: 0.108 seconds
Powered by Kunena Forum