
This one is based on another project by forum member HC1969 and here is the link to his project:
viewtopic.php?f=5&t=4611
http://rc-miskolc.emiter.hu/rc-miskolc/ ... Itemid=204
You can refer to his thread for some technical details on how this works. basically the PWM signal present on a receiver channel is converted to a binary system. Then each output is a "bit" that we can turn ON or OFF. But it is better explained on his thread.
He released his project as open source but he does build his switch and sell it on ebay. You can also find the link on his project pages.
As I said my little project is based on his idea, but while he uses a "Pic" microcontroller, I use an ATTiny45 or 85 and can switch 4 outputs. A cheap arduino board such as a pro mini can also be used. I have one of them switching 5 outputs. We could probably have even more, but that is for later

This is very cool as we can switch multiple outputs using only one Channel on the receiver. Normally you would use 4 channels for switching 4 outputs.

So, as many of you might know, I can't really write any code


But Google is our friend and I found some separate bits of code that I managed to put together, and with a great help from Mike I managed to put together some working code. Mike also wrote some of the code and helped me understand the calculation needed to make this work..
Mike, thank you so much for your time helping me on this and other projects. I wouldn't have managed this if it wasn't your great help. So THANK YOU again..
I used the arduino IDE to compile and upload the code to the ATTiny microprocessor.
Support for the ATTiny family can be installed on the arduino IDE but the procedure is slightly different depending on the version of the IDE you have installed on your machine. On recent versions this support can be installed from within the IDE itself. Please use Google to find out how to do it

On this project the ATTiny is configured to work with arduino and at an internal clock speed of 8MHz. The code can be uploaded to the chip using an USBASP programmer for example, but before the bootloader has to be programmed using this same programmer. All can be done from the arduino IDE. Here is a picture of the connections between the ATTiny and the programmer:
I have built this little project on a piece of stripboard. Actually, 2 pieces of stripboard as you can see in the pictures. One is soldered on top of the other and connected using some pins. On the first one we have the ATTiny85 microcontroller, 2 optocouplers that isolate the receiver from the switched voltage, and 2 MOSFET transistors that act as switches. The other board has the other 2 outputs.
each output can be powered by its own battery, or all can be powered by just one battery. This depends on what you need to control, and how you connect things. Its very flexible. You could for example have 2 outputs on one battery and the other 2 on another.. It is really up to you what you connect and how, as long as you respect the maximum ratings of the components you use. That is the optocoupler maximum ratings, and the MOSFET maximum ratings. I used some P-Channel MOSFETS that I had laying around from another cool project that is taking far longer than I thought it would

The MOSFETs should have a low gate/source voltage threshold. The ones I'm using start turning completely on at about 2 Volts. Here is the datasheet.
As I said I used some stripboard and SMD components (mostly 0805). The optocouplers "TLP621" and the ATTiny85 (ATTiny45 can also be used) are through hole components, but are soldered to the copper side of the board, after I trimmed their pins. The MOSFETs are some small SO-8, but can easily be soldered to the stripboard as on one side all the 4 pins are connected together and on the other side 3 of the pins are connected together and one (Gate) must be soldered separately.
Here are the schematics, single battery and multiple battery setups:
And here is how to connect some N-Channel MOSFETs instead

Now some pictures showing where all components are placed on both boards and where we must cut the copper strips.
Component placement on the copper side of both boards. Please note the little components named "SHUNT". That means that the tracks must be soldered together. Connect them with a solder bridge or a little piece of wire.
the next picture shows the jumper wires on the other side of both boards and the pins that must be soldered ONLY to one of them.
Now some pictures of my boards:
And here is the arduino code. Just compile it for the ATTiny you are using ( ATTiny 85 of 45 running at 8Mhz) using the arduino IDE.
Here is an example of how it should be programmed on your radio, Er9x/ERsky9x in this case:
Choose a channel. Here I have CH5..
CH5 0% HALF
+ 3% HALF (Switch) RUD
+ 6% HALF (Switch) ELE
+ 12% HALF (Switch) AIL
+ 24% HALF (Switch) GEA
These are all "ADD" mixes
You can assign any switch you want to the mixes, but the weight (%) and source (HALF) must remain unchanged.
Now go to the LIMITS menu, scroll down to CH5 and change the "SubTrim" to -100
If you are using radios with other firmware than Er9x/Ersky9x or even OpenTX You might need to find a way of doing the same programming so the radio sends exactly the same pulses.
Also a little video of it working.. Enjoy it.


João
https://www.youtube.com/watch?v=9Y41eYw-NGk
Disclaimer: Build this project at your own risk. It works for me



