Extra inputs for Devo Tx's

More
14 Sep 2015 00:07 #37737 by davidwyl
Replied by davidwyl on topic Extra inputs for Devo Tx's

Epyon wrote: Just tried setting up one of my Arduino-connected 3-ways for dual rate. In the 0 position it fluttered between mid & low.
davidwyl, have you tried the code that split the 3-ways into six 2-ways? You'll end up with PPM3,4, & 5 as the 3 positions of one switch. Just set Mid to PPM3 or 5, and Low to PPM5 or 3. The middle, PPM4 won't be used. Well, you could set PPM4 as a switch for something you want active along with High rates.

I tried that code. Work fine. :)
Just try to figure out see is there a way to use ppm -100,0,+100 switch to set 3different rate (out of curiosity :P ).

Epyon wrote: Excellent point, Deal57. Yeah I've got a lot of cleaning up/simplifying to do. Thanks.


Tried that code u gave I do get fluttered result once in a while sometime I get like -345,0,+345. Sometimes when I flip switch on ppm3, ppm4 result also fluttered randomly.

Hopefully your simplified code will get rid of the fluttered result. :cheer:

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

More
14 Sep 2015 00:32 #37739 by Epyon
Replied by Epyon on topic Extra inputs for Devo Tx's

davidwyl wrote: I tried that code. Work fine. :)
Just try to figure out see is there a way to use ppm -100,0,+100 switch to set 3different rate (out of curiosity :P ).


Like MWM said, a 0 value doesn't register as a switch state. No different than a pot being centered. There should definitely be a way to do it with a virtual channel, but I can't visualize it at the moment.

davidwyl wrote:

Epyon wrote: Excellent point, Deal57. Yeah I've got a lot of cleaning up/simplifying to do. Thanks.


Tried that code u gave I do get fluttered result once in a while sometime I get like -345,0,+345. Sometimes when I flip switch on ppm3, ppm4 result also fluttered randomly.

Hopefully your simplified code will get rid of the fluttered result. :cheer:

Do you get flutter at the end points, the middle, or both? Originally on mine, I had some flutter at the high side. Changing the PPM Delta to 390 got rid of it. My values stay put now.

I still need to add in debounce to the sketch, especially for my 6-way switch.


Deal57, I tried your simplification. I couldn't figure out how to keep my piezo beeps though.


Also, here's some OLED action! Sorry for quality.

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

More
14 Sep 2015 01:17 #37741 by davidwyl
Replied by davidwyl on topic Extra inputs for Devo Tx's

Epyon wrote: Do you get flutter at the end points, the middle, or both? Originally on mine, I had some flutter at the high side. Changing the PPM Delta to 390 got rid of it. My values stay put now.

If I recall correctly the the middle position is fine. ..

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

More
14 Sep 2015 01:34 #37742 by Deal57
Replied by Deal57 on topic Extra inputs for Devo Tx's
For the beeps, I might consider putting them all into a separate subroutine, and either call each one individually (e.g Beep3(), Beep4(), etc.) or pass a parameter (e.g. Beeps(Beep3) or Beeps(Beep4), whatever...). I think I can see what you're doing, basically beeping feedback for each switch setting but only when it changes, right?

I don't have a beeper myself, so I'll rig up an LED simulator or maybe the MP3 board I just picked up. I really like the sound feedback I get from Mission Planner, so getting additional feedback from my TX will be a bonus.

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
14 Sep 2015 03:50 - 14 Sep 2015 05:56 #37748 by Epyon
Replied by Epyon on topic Extra inputs for Devo Tx's

Deal57 wrote: For the beeps, I might consider putting them all into a separate subroutine, and either call each one individually (e.g Beep3(), Beep4(), etc.) or pass a parameter (e.g. Beeps(Beep3) or Beeps(Beep4), whatever...). I think I can see what you're doing, basically beeping feedback for each switch setting but only when it changes, right?

I don't have a beeper myself, so I'll rig up an LED simulator or maybe the MP3 board I just picked up. I really like the sound feedback I get from Mission Planner, so getting additional feedback from my TX will be a bonus.


MP3 board? oooooh. Which one did you get? Hopefully yours works.

But yeah, only beeps on change. I can't believe there isn't an easier way to do it than with variables. I've tried numerous different Tone libraries. None of them will simply play the tone once until a different one is called. Instead you get the beep every freakin time through the loop.
Every piece of my sketch that I try to refine breaks another. It works great as is, but could definitely be better. Especially once I get all the different modules going (real time clock, voltage/current sensor, sound board).
Last edit: 14 Sep 2015 05:56 by Epyon.

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

More
14 Sep 2015 16:00 - 14 Sep 2015 19:34 #37763 by Deal57
Replied by Deal57 on topic Extra inputs for Devo Tx's
Its the cheap MP3 module cuz its going into a Halloween pumpkin! BG has the DFPlayer mini for about $4.40. It doesn't create the tones or have an amp. You have to put the MP3 files onto an SD card and tell it to play, which is perfect for scary sounds! Since we have such limited sounds for Devo, I may tinker a bit, but I have a Halloween deadline!

You can still have the beeps and remove a lot of your code by using just two variables for each physical switch, rather than for each pin. So int pulseAn1, boolean pulseAn1New, int pulseAn2, boolean pulseAn2New, etc. If you want just one tone to play when the physical switch changes, then set that variable as an integer, then assign the frequency value ONLY if the current value is different, and throw the New flag. Then you send the beep parameters just one time for each physical switch. Here's how I would do a 3-way switch; I simulated the beep using the LED on Pin 13.
void loop() {
  // put your main code here, to run repeatedly:
  if (digitalRead(swPin_D1) != 1) { // 3-way Switch 1 in low position
           sw1_uS = pulseMin;
           if (pulseSw1 != 2050) {
            pulseSw1 = 2050; // set tone for low pitch
            pulseSw1New = true;
           }
  } else {
           if (digitalRead(swPin_D2) != 1 ) { // 3-way Switch 1 in high position
            sw1_uS = pulseMax;
            if (pulseSw1 != 2450) {
              pulseSw1 = 2450; // set tone for high pitch
              pulseSw1New = true;
            }
           } else { // 3-way Switch 1 in mid position since neither high nor low
            sw1_uS = pulseMid;
            if (pulseSw1 != 2250) {
              pulseSw1 = 2250; // set tone for center pitch
              pulseSw1New = true;
             }
           }
  }
  if (pulseSw1New == true) {
     TimerFreeTone(pulseSw1,50); //play tone based on switch 1 position
     pulseSw1New = false;
  }
//  Serial.print(pulseSw1);
//  Serial.print(" ");
//  Serial.println(pulseSw1New);
  delay(1000);
}

void TimerFreeTone (int toneFq, int toneLen) {
  // code uses LED to simulate the beep; if you are using a library you won't need this section
    for(int i = 0; i < toneLen; i++) {
      for(int j = 0; j < toneFq; j++)    {
        pinMode (TONE_PIN, OUTPUT);
        digitalWrite (TONE_PIN, HIGH);
      }
     digitalWrite (TONE_PIN, LOW);
  } 
}

I found a piezo buzzer so I wrote the attached sketch just to do it. It works! You'll need to include the attached pitches.h library to use the notes I've used. You'll also need to include the TimerFreeTones() library from the Arduino.cc forum, which your previous example included.

Have fun!

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:
Last edit: 14 Sep 2015 19:34 by Deal57. Reason: Found a piezo buzzer, wrote the code!

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

More
15 Sep 2015 23:45 - 15 Sep 2015 23:46 #37790 by RoGuE_StreaK
Replied by RoGuE_StreaK on topic Extra inputs for Devo Tx's
DIsclaimer 1: I haven't really been following this
Disclaimer 2: I haven't tested the following

I've been doing sound playback with PICs for a while, entirely onboard including sound storage. I just came across this the other day for arduino (TMRpcm), a system for using an arduino to play wav files from an SD card (actually headerless wav, essentially raw PCM), which sounds quite similar to what I have been doing. I reckon with some work you could potentially dump the SD card and store very short 8bit wavs in internal flash, say at 16kHz or maybe less would be prefectly fine for voice. With some prior planning, you could just concatenate playback on the fly, eg. "mode" "1", "gear" "down", "warning" "low", etc.
Major caveat, which I haven't investigated at all, is that for proper sound playback it really needs to be based off a high-speed interrupt, so depending on what else your processor is needing to do it may not actually have enough spare time to do it's "real" job. If that's the case, then you could always just use two arduinos (eg. 328p nanos / minis), one acting as main and the other as a slave audio processor.

On the other side of things, I really have no clue as far as the internal MCU of the devos is concerned, it may even be possible to shoe-horn the entire thing into the internal processing.
Just raising some alternate possibilities as food for thought.
Last edit: 15 Sep 2015 23:46 by RoGuE_StreaK.

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

More
16 Sep 2015 00:03 #37791 by mwm
Replied by mwm on topic Extra inputs for Devo Tx's
Two things: those of you adding extra inputs may find the buttons on this guy's modified Tx's interesting:


As for sound on the internal MCU's, you can certainly do that on anything but the 7E. Flash and program storage are in different places, so there's room to store voice - probably even on the 7E. Program space should be fine on anything but the 7E. The issue is how you control things. Using the interconnections used for the RF modules means you have to get them to play along, and are currently limited to two extra modules. There may be other communications channels (I²C, serial, other?) you could use, but I suspect they'll, require soldering on the µ-controller pins.

I haven't looked at how sounds get played. Possibly you could even play back voice audio instead of a sequence of tones with the existing hardware.

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
16 Sep 2015 00:10 #37793 by RoGuE_StreaK
Replied by RoGuE_StreaK on topic Extra inputs for Devo Tx's

mwm wrote: I haven't looked at how sounds get played. Possibly you could even play back voice audio instead of a sequence of tones with the existing hardware.

That would be my direction of investigation. SImple PWM really, it's just a matter of timing, and what the speaker hardware is (if piezo, not sure if a usable output can be created on it)

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

More
16 Sep 2015 04:08 #37798 by Epyon
Replied by Epyon on topic Extra inputs for Devo Tx's

mwm wrote: Two things: those of you adding extra inputs may find the buttons on this guy's modified Tx's interesting:


He's got 2 more than me :lol:

File Attachment:


Liking the Sugru mounts

RoGuE_StreaK wrote: That would be my direction of investigation. SImple PWM really, it's just a matter of timing, and what the speaker hardware is (if piezo, not sure if a usable output can be created on it)

I planned to use Arduino's PulseIn to read the square wave from the piezo output. As long as the tones are set unique in the sound.ini it shouldn't be a problem to trigger playback off a soundboard. There's the 4 timer alarms (which can be triggered with a switch), the low battery alarm, startup, shutdown, and all the telemetry alarms that could be translated to voice.

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

More
17 Sep 2015 07:35 #37817 by Epyon
Replied by Epyon on topic Extra inputs for Devo Tx's
Got me a cheap Devo 8 to dig into now! Step 1: Deviation - complete. Step 2: S module I've had sitting around forever - complete. Step 3: tear her down and hack her up - in progress.
Already got a 128x32 OLED installed. I just wet sanded the paint off the logo piece. Then framed the display with electrical tape. Some fine scratches, but it actually looks really good in person. Slapped in a rotary encoder w/switch and a couple nice center-detent pots salvaged from an old joystick. I'm sure I'll come up with a handy use for the encoder. There's a lot of space for extra switches. I think I'm gonna go with a Teensy 3.1 as its got more oomph than a Nano.

File Attachment:

File Attachment:

File Attachment:

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

More
21 Sep 2015 09:10 #37919 by davidwyl
Replied by davidwyl on topic Extra inputs for Devo Tx's

Epyon wrote:

davidwyl wrote: Connected 3ways switch to arduino, can see it in my devo but the value -109, 0, 109 in stick input menu... Is that ok?


That's perfectly fine.


tested 2 pot & two 3way switch, all working perfectly . now waiting for my smaller pot to arrive before i put everything into my devo 7e.
btw quick question, i keep getting +109,0,-109. Is that possible to fine tune it to +100,0,-100??
just to make it look batter :lol:

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

More
21 Sep 2015 16:33 - 21 Sep 2015 16:45 #37928 by Epyon
Replied by Epyon on topic Extra inputs for Devo Tx's

davidwyl wrote: tested 2 pot & two 3way switch, all working perfectly . now waiting for my smaller pot to arrive before i put everything into my devo 7e.
btw quick question, i keep getting +109,0,-109. Is that possible to fine tune it to +100,0,-100??
just to make it look batter :lol:

Just change the Delta PW on the Devo PPM settings. Raise it to 430 or so. I'd leave a little buffer, ie +101,0,-101.


My Devo 8 is coming along nicely.

File Attachment:

File Attachment:

Currently added 4 pots, a rotary encoder w/button, and a beautiful mil-spec 10-way rotary switch (set for 8 positions). Also will have a 128x32 OLED, real time clock, and a voltage/current sensor. And I've got the piezo extended off the board waiting for my replacement sound board to arrive. Will snip off the piezo and connect wire to Arduino input.

The extra space in the 8 has made this soooooo much easier than the 7e.

File Attachment:



Also, the lack of haptic may annoy me down the road. I could easily run a vibration motor off the Arduino, but may run it off the Devo (or both).
One question though. The haptic mod described HERE , the "enable-haptic=1" in hardware.ini enables this? Connected to MCU pin 83? Just wanted to make sure it still works with current builds, before I fire up the iron.
Last edit: 21 Sep 2015 16:45 by Epyon.

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

More
21 Sep 2015 16:33 - 21 Sep 2015 16:35 #37929 by Deal57
Replied by Deal57 on topic Extra inputs for Devo Tx's
The quick way to do this is to set the channel Min Limit to -100 and Max Limit to 100. The values coming over the PPM link are dependent on timing and if your Arduino timing is slightly variable, the actual MS sent may be a bit off. I have tinkered a bit with mine and I saw results just slightly different than Epyon's settings for Center PW and Delta PW, but that's not going to affect using a 3-way switch.

Once you assign the input, eg. PPM1, to a channel, eg. Channel 8, you click on the channel name in the Mixer menu, and set the values you need.

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: 21 Sep 2015 16:35 by Deal57. Reason: fixing the smilies!

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

More
27 Sep 2015 07:41 #38102 by Arakon
Replied by Arakon on topic Extra inputs for Devo Tx's
I wonder.. is this code usable to turn the arduino into a transmitter control board?
i.e. take the 4 stick pots + some switches and hook the output ppm signal directly to a frsky DHT addon module?
I have that module coming, but no decent transmitter to use as a host, only 4 channels and seemingly no means to extend the amount.
I just want a cheapo spare/leave-in-the-car transmitter with no need for much fanciness.

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

More
27 Sep 2015 11:37 #38107 by Deal57
Replied by Deal57 on topic Extra inputs for Devo Tx's
The code will probably work, but I have concerns about reliability. The key element in this code is the output_ppm routine, which uses an interrupt timer for framing. On my Uno and ProMini, sound routines experience some stuttering, so I am pretty sure the timers are working harder than I would like. As a ppm-input device controlling gimbals and lights, etc. the timing is not fatal, but I don't yet trust it for flight controls, at least not without a bunch more testing and tweaking.

I'd love to hear how it works for you. It may be just great for micro and mini quads.

That 72mhz STM-duino has a lot of advantages, particularly if the current code will run on it. Add in decent sticks and switches, and by that point, well, you could probably get a Devo7e. :huh:

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
27 Sep 2015 17:21 - 27 Sep 2015 17:22 #38116 by Arakon
Replied by Arakon on topic Extra inputs for Devo Tx's
I found another project that specifically aims to use an arduino nano as a transmitter controller with PPM-out and went with that.
www.reseau.org/arduinorc/index.php?n=Main.HomePage
I mainly wanted a basic way to use the parts I already have laying around to make a cheap secondary transmitter that supports either spektrum or frsky, as I have spare receivers for both.
Last edit: 27 Sep 2015 17:22 by Arakon.

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

More
27 Sep 2015 20:09 - 28 Sep 2015 03:35 #38123 by Epyon
Replied by Epyon on topic Extra inputs for Devo Tx's

Arakon wrote: I wonder.. is this code usable to turn the arduino into a transmitter control board?
i.e. take the 4 stick pots + some switches and hook the output ppm signal directly to a frsky DHT addon module?
I have that module coming, but no decent transmitter to use as a host, only 4 channels and seemingly no means to extend the amount.
I just want a cheapo spare/leave-in-the-car transmitter with no need for much fanciness.


That is what Ian Johnston did, but with a 433mhz module www.ianjohnston.com/index.php?option=com...d=3:hobbies&Itemid=8
His code (that we've all been using) even has trim and dual-rate settings.


Deal57 wrote: That 72mhz STM-duino has a lot of advantages, particularly if the current code will run on it. Add in decent sticks and switches, and by that point, well, you could probably get a Devo7e. :huh:


I've had a few of those Maple Mini clone boards sitting around for a while now. When I first got them I spent a few minutes trying to get the Arduino IDE to recognize them to no avail. I didn't feel like getting an updated version,........so there they sit. I'll revisit it at some point as they are powerful little guys. Comparable to a Teensy, but much cheaper.
www.stm32duino.com/viewtopic.php?f=20&t=32
Last edit: 28 Sep 2015 03:35 by Epyon.

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

More
28 Sep 2015 04:42 #38138 by mwm
Replied by mwm on topic Extra inputs for Devo Tx's
Instructions for getting the arduino ide working on the maple mini are in the Arduino_STM32 wiki: github.com/rogerclarkmelbourne/Arduino_STM32/wiki

Those worked for me with the "minimum system development board", which is basically a maple mini with boot jumpers instead of a user button. I've switched to using my deviationTx build environment instead, and am evaluating RTOS choices.

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
28 Sep 2015 05:12 #38140 by mwm
Replied by mwm on topic Extra inputs for Devo Tx's

Deal57 wrote: The code will probably work, but I have concerns about reliability. The key element in this code is the output_ppm routine, which uses an interrupt timer for framing. On my Uno and ProMini, sound routines experience some stuttering, so I am pretty sure the timers are working harder than I would like. As a ppm-input device controlling gimbals and lights, etc. the timing is not fatal, but I don't yet trust it for flight controls, at least not without a bunch more testing and tweaking.


Should work fairly well. The TH9X uses an ATMega64 as the main cpu to feed ppm input to rf modules. But the i think the OpenTX/etc guys gave up on making it play sounds at the same time. Not clear how much tweaking it took to get there.

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.

Time to create page: 0.087 seconds
Powered by Kunena Forum