Hello, everybody! I’m here to present my own RC key, which I connect to the receiver, so that I can control heavy load. I saw different versions on tiny13 and atmega328, and I realized that a Tiny13 would be too low on memory and it could put me through a lot of nickeling and diming; an Atmega328 would cost me almost as much as an Arduino Nano. I also wanted a simple and familiar Arduino IDE, so I’d be able to quickly reflash it via USB.

I decided to make it open source and give other users an opportunity to build and modify it to suit their needs. I chose a two-dollar Arduino Nano microcontroller, the smallest one.

This is how it works:
It all began with a dummy. I connected a servo tester and large-size field transistors and started to experiment with the firmware. I had to learn how to read the control signal and switched the diodes on and off for the first time.

The hardest part of it was miniaturizing the board and retaining a maximal number of channels. Arduino Nano has 22 pins, which can be used as outputs, and that could well manage the entire extra load. However, because 40mA was not enough, I had to use field transistors. I chose SOT-23 Package, since its transistors can manage 2-5A load and they are very compact in size. After trying several layouts I placed 5 channels on the board without links:


I etched the circuit board using the tone transfer method. I transferred the toner onto Oracle 841 film and used ammonium persulfate. The film transferred the toner ideally, so I wouldn’t have to peel off paper. Because ammonium persulfate is transparent, the etching process could well be observed:

The board turned out to be very compact, and there were two pins at the top for the two receiver channels – they would ensure control signal receipt and program choice:

The bottom side – beneath the microcontroller – features all components. Transistors are located in SOT-23, resistors – in 1206 (I thought I could also fix 0805 without modifying the board).
Initially I decided not to make load connectors as I thought I would solder them to the pads because the microcontroller featured USB, and I could easily switch channels anytime.

Finally I did make connectors using servo extension leads and a JST connector:


I ended up with a miniature key featuring two input and five output channels. It was possible to handle five channels with a load of 1-6S up to 5A. With me it was a 12V LED strip light (3-4S, 4S would give a brighter light) and automobile 12V LED lamps (already featuring a current stabilizer, so 4S would not cause any trouble).

Components:
1 pcs -- Arduino nano microcontroller -- $2
5 pcs -- 1206 resistors 1k (protecting microcontroller outputs)
5 pcs -- 1206 resistors 10k (pull-down resistors that block transistors)
2 pcs -- 1206 resistors 47k ( pull-down resistors that block receiver channels)
5 pcs -- SOT-23 field transistors. All LOGIC transistors can be used. I implemented different ones (scavenged from old boards): IRLML2502TRPBF, IRLML0060TRPBF or SI2302 (AliExpress offers a $1.5 set of 100 pcs ). Here you can also byu resistors and small LED lamps. Buy 100 resistors for $0.5.

The quadcopter features 12V lighting:
12V lamps ($1.5)
LED strip light 5050 -- $7/5m

The program code is not too complicated, and I tried to comment it. Read signal control value every 0.5s and based on the data choose a program:

if (millis() - toRead>500) {
ch1 = pulseIn(pulse1_pin1, HIGH, 25000);
ch2 = pulseIn(pulse1_pin2, HIGH, 25000);

if (ch1 < 1000) { if (prog!=1){led_off(); prog=1; next_step=1;} //off
} else if (ch1 < 1300) { if (prog!=2){led_off(); prog=2; steps=0;}
} else if (ch1 < 1500) { if (prog!=3){led_off(); prog=3; steps=0;}
} else if (ch1 < 1700) { if (prog!=4){led_off(); prog=4; steps=0;}
} else if (ch1 < 1900) { if (prog!=5){led_off(); prog=5; steps=0;}
} else { if (prog!=6){led_off(); prog=6; next_step=1;} // on
}
Serial.print(ch1); Serial.print(" "); Serial.print(ch2); Serial.print(" "); Serial.println(prog);
toRead = millis();
}

You can set signal values yourself according to your switch configuration. I use a knob, so the only thing that limits the number of programs is my microcontroller’s 32kb memory. I don’t use ch2, because I don't really need to. But it can be read and analyzed easily. Once I arm the key, the current knob position value is read and saved as a ‘prog’ parameter value, and initial step is set to zero (steps=0). It defines the program’s operation.

It should be noted that blinking programs do not use Delay. This must be the hardest thing to understand. Progs are defined by the ‘millis’ timer value, as the timer is launched when the microcontroller is loaded. I used this timer’s delta: "delay(500)" is "millis() - toRead>500", where toRead is the previously recorded millis value.

If you do use Delay, there will be a pause before the control signal is read. It will switch only when the delay is over.

Here is a file with the source firmware and the board; this original board has a broken-up power lead. It is up to you to decide how to power the microcontroller. There are two alternatives: either by the incoming load power (it should range from 6V to 18V as stated in the Arduino Nano Specification, and by the VIN pin), or from the receiver (5V). I recommend the receiver option, as the power will come in along with the control signal. Then you’ll have to connect the central input receiver signal leads to the 5V Arduino pin.

The board is simple too. The power supply load is in the top right corner and two receiver inputs are at the bottom (the one closer to the edge is negative). The ‘out’ pads in the middle are nothing less than the channels. The 47k pull-down resistors are in the bottom right corner, I chose not to make pads for them, because I could easily solder the resistors to leads.


"IN+" – the incoming power supply load -- 1-6S (you can omit it and channel power directly to the load)is BROKEN UP! This is to provide an opportunity to supply 5V from the receiver to the microcontroller via a wire lead (I recommend this option). Or you can solder it and supply 6-18V.
"IN-" the integrated load input

"OUT+" is the power supply load connection point (not mandatory)
The five "OUTs" are connection points for the integrated ones for each channel.

Circuit layout:


The firmware and the board:
(01-rc-switch.rar)
This is the translated version. You can read the original Russian article here.