- Posts: 26
Extra inputs for Devo Tx's
- davidwyl
- Offline
I tried that code. Work fine.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.
Just try to figure out see is there a way to use ppm -100,0,+100 switch to set 3different rate (out of curiosity ).
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.
Please Log in or Create an account to join the conversation.
- Epyon
- Offline
- Posts: 57
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 ).
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.
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.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.
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.
- davidwyl
- Offline
- Posts: 26
If I recall correctly the the middle position is fine. ..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.
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
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.
- Epyon
- Offline
- Posts: 57
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).
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
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!!
Please Log in or Create an account to join the conversation.
- RoGuE_StreaK
- Offline
- Posts: 486
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.
Please Log in or Create an account to join the conversation.
- mwm
- Topic Author
- Offline
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.
- RoGuE_StreaK
- Offline
- Posts: 486
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)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.
Please Log in or Create an account to join the conversation.
- Epyon
- Offline
- Posts: 57
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
Liking the Sugru mounts
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.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)
Please Log in or Create an account to join the conversation.
- Epyon
- Offline
- Posts: 57
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.
Please Log in or Create an account to join the conversation.
- davidwyl
- Offline
- Posts: 26
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
Please Log in or Create an account to join the conversation.
- Epyon
- Offline
- Posts: 57
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.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
My Devo 8 is coming along nicely.
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.
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.
Please Log in or Create an account to join the conversation.
- Deal57
- Offline
- Posts: 857
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!!
Please Log in or Create an account to join the conversation.
- Arakon
- Offline
- Posts: 305
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.
- Deal57
- Offline
- Posts: 857
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.
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.
- Arakon
- Offline
- Posts: 305
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.
Please Log in or Create an account to join the conversation.
- Epyon
- Offline
- Posts: 57
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.
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
Please Log in or Create an account to join the conversation.
- mwm
- Topic Author
- Offline
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.
- mwm
- Topic Author
- Offline
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.
- Home
- Forum
- Development
- Development
- Extra inputs for Devo Tx's