Extra inputs for Devo Tx's

More
08 Dec 2015 14:15 - 08 Dec 2015 14:20 #40688 by Epitaph
Replied by Epitaph on topic Extra inputs for Devo Tx's
A couple of things... first, the USB sharing ports isn't really a problem, as once the board is programmed to one's needs there shouldn't be a need to use the USB again, therefore it's not going to be shared, much like the way the USB shares with Spectrum satellite or the Bluetooth communication port on some multirotor control boards, as long as you don't use them both at the same time, there's no issue, and really, once it's tuned in to your needs, the USB isn't needed any longer. The second thing I should point out is that the digispark "blink" program has 2 outputs for blinking the onboard LED because there seems to be a model A and a model B, where one uses port 1, and the other uses port 0, so this might be something to have in mind when assigning SW1 and the PPM out.
// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(0, OUTPUT); //LED on Model B
  pinMode(1, OUTPUT); //LED on Model A   
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(0, HIGH);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(1, HIGH);
  delay(1000);               // wait for a second
  digitalWrite(0, LOW);    // turn the LED off by making the voltage LOW
  digitalWrite(1, LOW); 
  delay(1000);               // wait for a second
}

In any case, I can't really try much out till the pots arrive, I'm just trying to do a little homework in the mean time heheheh
Last edit: 08 Dec 2015 14:20 by Epitaph.

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

More
08 Dec 2015 14:22 #40689 by Deal57
Replied by Deal57 on topic Extra inputs for Devo Tx's

Cereal_Killer wrote: Hi again Deal, my code it to long to PM you...

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)
...


Hmm... are you sure that the 3-way switch is connecting the center to ground, and the other pins to D6 (swPin_D1) and D7 (swPin_D2)? Can you disconnect the second switch for now, so we can get one working? It sounds like maybe you're reading one pin from each switch, which I think would give you this behavior.

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.

More
08 Dec 2015 14:24 #40690 by Epitaph
Replied by Epitaph on topic Extra inputs for Devo Tx's
Actually, Deal57, when I get a chance, I'll upload this onto the digispark and use the 2 pots from one of the gimbals to see if it works, along with a couple of switches I must have lying around somewhere, and Ill let you know how it goes. Unfortunately I don't have time to do it today, I'll see about tomorrow!!

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

More
08 Dec 2015 14:29 #40691 by Epitaph
Replied by Epitaph on topic Extra inputs for Devo Tx's
I just loaded it into the Arduino IDE a moment to load onto the Digispark as that takes all of 5 seconds to do, and I got this error
sketch_dec08a.ino: In function 'void setup()':
sketch_dec08a:58: error: 'TCCR1A' was not declared in this scope
sketch_dec08a:59: error: 'TCCR1B' was not declared in this scope
sketch_dec08a:60: error: 'TCCR1C' was not declared in this scope
sketch_dec08a:61: error: 'TIMSK1' was not declared in this scope
sketch_dec08a:62: error: 'TIFR1' was not declared in this scope

I tried with other codes, including just the original 2 pot one Epyon made, and i get the same error... seems everything under "// Setup Timer" is giving a problem

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

More
08 Dec 2015 14:33 - 08 Dec 2015 14:34 #40692 by Cereal_Killer
Replied by Cereal_Killer on topic Extra inputs for Devo Tx's

Deal57 wrote:

Cereal_Killer wrote: Hi again Deal, my code it to long to PM you...

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)
...


Hmm... are you sure that the 3-way switch is connecting the center to ground, and the other pins to D6 (swPin_D1) and D7 (swPin_D2)? Can you disconnect the second switch for now, so we can get one working? It sounds like maybe you're reading one pin from each switch, which I think would give you this behavior.


Yes I'm positive, I even have them labeled on the TX body with a sharpy cause I thought the same thing but I will physically disconnect the second switch today (I'm on my way out the door for a back dr appt now).I have also verified with a DMM that the pins are being pulled low when the switches are in the different positions.

Thanks for your help so far, will respond back with results of test this afternoon. I'm also posting on Ian Johnson's forum.


For my clarification, what does "!=" mean in arduino language? I cant find it referenced, I would of thought it should be written as "<=" and ">=".

Taranis X9E | DEVO 10 | Devo U7E | Taranis Q7

What I do in real life: rivergoequestrian.com/
Last edit: 08 Dec 2015 14:34 by Cereal_Killer.

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

More
08 Dec 2015 14:47 #40694 by Deal57
Replied by Deal57 on topic Extra inputs for Devo Tx's
The "!=" is "Not equal". In this case you might be able to use "== 0" instead of "!= 1". It probably works either way.

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.

More
08 Dec 2015 15:29 #40695 by Deal57
Replied by Deal57 on topic Extra inputs for Devo Tx's

Epitaph wrote: I just loaded it into the Arduino IDE a moment to load onto the Digispark as that takes all of 5 seconds to do, and I got this error

sketch_dec08a.ino: In function 'void setup()':
sketch_dec08a:58: error: 'TCCR1A' was not declared in this scope
sketch_dec08a:59: error: 'TCCR1B' was not declared in this scope
sketch_dec08a:60: error: 'TCCR1C' was not declared in this scope
sketch_dec08a:61: error: 'TIMSK1' was not declared in this scope
sketch_dec08a:62: error: 'TIFR1' was not declared in this scope

I tried with other codes, including just the original 2 pot one Epyon made, and i get the same error... seems everything under "// Setup Timer" is giving a problem


Ouch. Yeah, I was wondering about the interrupt handling. We may just need a library, or it may be a show-stopper :ohmy: . Here's a discussion of the options. Given the nature of PPM I'm not really comfortable with the solution shown there because it's just a loop. It may be OK for our purposes, but I can't mess with it until my digispark gets here.

Off to google some answers...

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.

More
08 Dec 2015 15:38 - 08 Dec 2015 15:40 #40697 by Cereal_Killer
Replied by Cereal_Killer on topic Extra inputs for Devo Tx's

Epitaph wrote: I just loaded it into the Arduino IDE a moment to load onto the Digispark as that takes all of 5 seconds to do, and I got this error

sketch_dec08a.ino: In function 'void setup()':
sketch_dec08a:58: error: 'TCCR1A' was not declared in this scope
sketch_dec08a:59: error: 'TCCR1B' was not declared in this scope
sketch_dec08a:60: error: 'TCCR1C' was not declared in this scope
sketch_dec08a:61: error: 'TIMSK1' was not declared in this scope
sketch_dec08a:62: error: 'TIFR1' was not declared in this scope

I tried with other codes, including just the original 2 pot one Epyon made, and i get the same error... seems everything under "// Setup Timer" is giving a problem


What are your clock setting in the tools pull-down? Is the digispark an actual board option or are you compiling as a raw ATTINY? All of the times will either need adjusted to the clock speed you choose or you'll need a attiny85 include.

Taranis X9E | DEVO 10 | Devo U7E | Taranis Q7

What I do in real life: rivergoequestrian.com/
Last edit: 08 Dec 2015 15:40 by Cereal_Killer.

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

More
08 Dec 2015 15:45 - 08 Dec 2015 15:46 #40698 by Epitaph
Replied by Epitaph on topic Extra inputs for Devo Tx's
The board select is "Digispark (Tiny Core)", and the programmer is down as "Digispark", which is how it has to be set up according to the information I have found on Google. This is under the Arduino 1.0.4 IDE that you can download already set up for Digispark. I have tried with 1.6.6, adding the Digispark to it but was getting nowhere, and also there is no "digispark" to select under the programmer option with this newer version.
Last edit: 08 Dec 2015 15:46 by Epitaph.

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

More
08 Dec 2015 15:57 #40699 by Cereal_Killer
Replied by Cereal_Killer on topic Extra inputs for Devo Tx's

Epitaph wrote: The board select is "Digispark (Tiny Core)", and the programmer is down as "Digispark", which is how it has to be set up according to the information I have found on Google.


I literally just saw that it has its own board type options. Which one specifically are you using? AVR timers are a whole other subject on their own. You definitely don't want to be using the standard option (that runs at 16.5mhz) (point 5, really?! Lol). I'd start trying with the digispark pro running at 16mhz.

These things don't have xtals on board do they? They're using the internal oscillator? You may never be able to get a clean PPM stream out of them (not making that claim or trying to put you off, the attiny85 is a really amazing little micro in general but as with all the small attiny's clock speed fluctuates pretty badly depending on temp and just in general from chip to chip)

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.

More
08 Dec 2015 15:59 - 08 Dec 2015 16:02 #40700 by Deal57
Replied by Deal57 on topic Extra inputs for Devo Tx's
Yeah, 16.5! But it's cheap. :huh:

We aren't actually even using the interrupt routines in this code, so you can try it by commenting out that whole section. It compiles just fine... don't know if it works! I found some other timer options so I'll keep plugging away.

I had no problem getting the DS libraries/board definitions loaded into my IDE 1.6.5. Setup process is quick here .

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!!
Last edit: 08 Dec 2015 16:02 by Deal57. Reason: Update URL

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

More
08 Dec 2015 16:01 #40701 by Epitaph
Replied by Epitaph on topic Extra inputs for Devo Tx's
Those options that you are referring to are those that appear on the list on Arduino 1.6.6, but there is no option to choose the Digispark programmer which I had read you have to choose. On Arduino 1.0.4, you have the Digispark (Tiny Core), or other models of ATTiny85 but they all say "no USB". But 1.0.4 allows you to choose Digispark as the programmer, and this is the combination that I got to work for things like the simple "blink" sketch.

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

More
08 Dec 2015 16:02 #40702 by Epitaph
Replied by Epitaph on topic Extra inputs for Devo Tx's
I tried the 16.5 option on 1.6.6, as well as the others, and they all give me the timer error

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

More
08 Dec 2015 16:10 - 08 Dec 2015 16:11 #40703 by Deal57
Replied by Deal57 on topic Extra inputs for Devo Tx's
I'm pretty sure you want to be on IDE 1.6.5 or .6.

Here's code with updated timer setup. The Digispark system uses Timer1 so we have to use Timer0. Several people who sounded much more knowledgeable than I suggest this:
TCCR0A = (1 << WGM01);             //CTC mode
TCCR0B = (2 << CS00);              //div8
OCR0A = F_CPU/8 * 0.000050 - 1;    // 50us compare value -- we need to fix to 22ms next
TIMSK |= (1<<OCIE0A);              //if you want interrupt

Then we can use this:
ISR(TIMER0_COMPA_vect) {
    ppmoutput(); // Jump to ppmoutput subroutine
}

It compiles. Again, don't know if it works.

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!!
Last edit: 08 Dec 2015 16:11 by Deal57.

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

More
08 Dec 2015 16:11 - 08 Dec 2015 16:15 #40704 by Epitaph
Replied by Epitaph on topic Extra inputs for Devo Tx's
OK, this is weird... I tried it in Arduino 1.6.6, with the "USB TinyISP" programmer, and got it to load in 16mhz. Yet it gave the timer error on the default 16.5mhz version... this is the code that Deal57 wrote up at the end of page 11 of this thread

EDIT

I just tried it again a couple more times, and it loads successfully with the 16mhz-default setting using USB TinyISP as the programmer, but gives the timer error with any other combination, including the 16.5mhz-default setting.

Now all I have to do it wire it in and see if it works, but I can't right now...
Last edit: 08 Dec 2015 16:15 by Epitaph.

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

More
08 Dec 2015 16:20 #40705 by Epitaph
Replied by Epitaph on topic Extra inputs for Devo Tx's

Deal57 wrote: I'm pretty sure you want to be on IDE 1.6.5 or .6.

Here's code with updated timer setup. The Digispark system uses Timer1 so we have to use Timer0. Several people who sounded much more knowledgeable than I suggest this:

TCCR0A = (1 << WGM01);             //CTC mode
TCCR0B = (2 << CS00);              //div8
OCR0A = F_CPU/8 * 0.000050 - 1;    // 50us compare value -- we need to fix to 22ms next
TIMSK |= (1<<OCIE0A);              //if you want interrupt

Then we can use this:
ISR(TIMER0_COMPA_vect) {
    ppmoutput(); // Jump to ppmoutput subroutine
}

It compiles. Again, don't know if it works.


I loaded it in no problem under 16mhz without this alteration, but I can't test it right now to see if it actually works...

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

More
08 Dec 2015 18:08 - 08 Dec 2015 18:21 #40706 by Epitaph
Replied by Epitaph on topic Extra inputs for Devo Tx's
I just remembered I had a couple of 10K pots so I've put them on a breadboard with 3 momentary switches to simulate a 2 position and a 3 position switch, fed with 5V and outputting via a mono 3.5mm jack I had put aside for video out on my Devo F4. Give me a little while to put it all together and I'll let you know how it goes, but this way I shouldn't even need to open the transmitter up to test it!!

EDIT

Nothing... no joy whatsoever... no signal on any of the channels at all.

If I need to change the timer code to your revised code, where does it go and what does it replace?
Last edit: 08 Dec 2015 18:21 by Epitaph.

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

More
08 Dec 2015 18:40 #40707 by Cereal_Killer
Replied by Cereal_Killer on topic Extra inputs for Devo Tx's

Deal57 wrote: The "!=" is "Not equal". In this case you might be able to use "== 0" instead of "!= 1". It probably works either way.



Ok I'm home now and have physically removed the second switch, still the same behavior.

I dont understand why it works on yours and not on mine. Or is my thinking incorrect and you actually want your 3-way switches acting to switch two different channels so you dont have to deal with this?

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.

More
08 Dec 2015 19:24 #40708 by Epitaph
Replied by Epitaph on topic Extra inputs for Devo Tx's
I've just tried out sketch on my Uno, adjusting the inputs and outputs obviously, just to make sure that there was nothing faulty with the rest of the hardware like the mono jack lead or the pots, and it works fine with the Uno, I see all the channels working great, so the problem is definitely in the Digispark.

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

More
08 Dec 2015 19:44 #40709 by Deal57
Replied by Deal57 on topic Extra inputs for Devo Tx's

Epitaph wrote: I've just tried out sketch on my Uno, adjusting the inputs and outputs obviously, just to make sure that there was nothing faulty with the rest of the hardware like the mono jack lead or the pots, and it works fine with the Uno, I see all the channels working great, so the problem is definitely in the Digispark.


Try this. I've put the timer and interrupt code into the sketch. Glad to hear the basic code works on the UNO, so that means we need to resolve this timer/interrupt thing.

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.

Time to create page: 0.118 seconds
Powered by Kunena Forum