I've done a full 4-channel propo encoder for the DigiSpark. This is a tiny (3/4" square) cheap & cheerful board that works really well, but only has 5 I/O pins as supplied. Some of the 5 DigiSpark pins have USB circuitry which we need to remove as it affects the linearity when those pins are used for joystick inputs - its just four components - two zener diodes, a pull-up resistor, and an LED ballast resistor (or the led, removing either will do). Since the board is all SMT this is easily done by 'flicking' off the unwanted components with a jewellers screwdriver.
This is all covered in some detail in the DigiSpark thread. It sounds much more fiddly than it actually is - in fact it takes a couple of seconds to remove the four components:
Click to expand:
We need four joystick inputs, a calibrate link or button input, and a PPM output, so having freed up all 5 pins, we need one more. The reset pin P5 has a dual purpose, controlled by an internal 'fuse'. It can be 'reset' as required for programming, or it can be another I/O pin which is what we need. The DigiSpark fuse programmer makes this change easy peasy.
Now we have 6 pins, allocated as follows:
P5 (ADC0) Aileron
P4 (ADC2) Rudder
P3 (ADC3) Throttle
P2 (ADC1) Elevator
P1 Calibrate, S/C Button and buzzer (see below)
P0 PPM output
This is a simple, minimal encoder so it doesn't have a colour telemetry display or anything fancy.
What it does have is:
DigiSpark 4ch features:
Four proportional channels, inbuilt stick calibration,
'Soft' throttle lock (has to be closed before it will open) with alarm if invoked
Reversing by powering on with the stick held over, saved to flash (throttle is not reversible for safety)
V-tail or Elevon mixer (60:40 ratio)
Single Channel compound escapement emulation mix with kick-up elevator
Inactivity alarm (should you forget & leave it switched on) also waggles rudder in case Rx has been left on
We've no pins to dedicate to a buzzer, so for the inactivity warning, we multiplex the SC/Calibrate pin so it performs all three tasks - see the diagram. Please note that he button now has to be a 'break' contact.
Of course the encoder needs mechanical stick trims as theres no provision for subtrim.
Theres no expo and no rates. The V-tail/elevon mixer is permanently enabled and appears on 'extra' receiver channels 5 & 6 following on from the usual channels 1 to 4 which are as you'd expect.
Quite a few people are using this encoder in their retro 4-channel sets now, if anyone wants a ready-to-fit encoder I can supply them programmed, prewired & heatshrunk. Just one pointer, if the throttle lock holds at the 'open' position (ie at the 2ms end of travel) then the throttle pot outer wires need swapping over, thats the +5 and neg. Its a safety thing for electric flyers.
I've done a few of the DigiSpark 4ch encoders myself, this is one of the testers which for convenience is mounted on a vero backplane, fitted into a Multiplex Pico. I've left the usb tab on this one, normally I saw it off. (It always amuses me to see the tiny 3/4" square board lost inside a transmitter!)
Cheers
Phil
EDIT 1:
I really like the elevon mixer idea on the two-plus-one where the mixed channels derived from aileron & elevator are permanently on channels 5 & 6, rather than using an 'enable' switch or link. The aileron and elevator channels remain exactly as they were.
I've added this into the DigiSpark-4 and uploaded the revised code below.
There are no hardware changes, its just the content of receiver channels 5 & 6 that has changed.
Its a 60:40 mix which should be a good compromise for flying wings (very pitch sensitive) and V tailers.
The only disadvantage (if it is one) is that a V tailer or flying wing would need a 6ch receiver.
EDIT 2:
Three times now I've left the DigiAce switched on overnight, luckily the big LiFePo4 battery had enough capacity so it wasnt dead when I found it the following morning... though the Hitec RF module was warm!
Its obvious that for sponge-brains like me an inactivity alarm is essential. We dont have any spare pins for a buzzer, so I've multiplexed the button input, which is now used for calibration, S/C emulation, and the inactivity alarm.
We use the usual 5v DC buzzer with its negative tag (the short leg) to wired to battery negative via the S/C button, and its long leg (pos) wired to P1. Please note that he S/C button now has to be a 'break' contact:
To convert from the previous arrangement, remove the purple wire from the button 'make' contact, connect purple to the buzzer pos, and connect the buzzer neg back to the button 'break' tag. The button 'common' is the black wire. The buzzer could be soldered directly onto the microswitch tag to save wires.
The diagram makes it clear (I hope!)
If anyone has used the original code, please update as its had a general tidy-up. I know we always say this, but I think thats a wrap, theres only so much you can do with six I/O pins. If the inactivity timer code looks a little convoluted, its necessary because of the multiplexing - the alarm and the S/C button that can cancel the alarm are one & the same thing!
One extra over the usual inactivity warning - if you've inadvertently left the receiver powered up as well as the transmitter, the inactivity alarm also waggles the rudder to let you know. Cool eh?
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Edit 3:
I've updated this sketch after I found that the Waltron pots were very slightly 'off' electrical centre at neutral stick. In all my previous encoder sketches, the calibration routine learns the full throw in either direction, then assumes that neutral is halfway between these values and until the Waltron this method has given spot-on neutrals.
So the new calibration procedure is to switch on with the S/C button pressed, and keeping it held, waggle
the sticks to their extremes but then (and this wasnt necessary before) to centre the sticks including throttle before releasing the button. The highest & lowest values are saved like before, but additionally the centres are now stored and the encoder now uses a separate map for either direction the stick is moved.
This ensures that even a slightly non-linear stick pot will map accurately.
This ensures that stick-centre is channel centre whilst full travel is equal in both directions. It works great so I will be incorporating this into the 7ch+sc update too. The updated DigiSpark sketch is in the first post.
Updating the DigiAce transmitter was a messy process as the board is soldered up, and I've been using the update in the Multiplex Picoline (which has perfect sticks) and the Waltron (which didnt but does now!)
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Cheers
Phil
Edit 4: The 7ch+s/c encoder update is finished and also uses this calibration method: http://mode-zero.uk/viewtopic.php?f=27&t=844
Here is the final (
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Four proportional channels, inbuilt three-point stick calibration
'Soft' throttle lock (has to be closed before it will open) with alarm if activated
Reversing by powering on with the stick held over, saved to flash (throttle is not reversible for safety)
V-tail or Elevon mixer (60:40 ratio)
Single Channel compound escapement emulation mix with kick-up elevator
Inactivity alarm (should you forget & leave it switched on), also waggles rudder in case Rx has been left on
Edit 5: Tidied up the sketch & doc a bit, no functional code changes.
Edit 6: Added the "Power on with throttle open" warning, which indicates that the soft throttle lock is active - similar to the 7ch encoder.