RC switch with attiny13 Print
Written by jjk   
Friday, 27 March 2015 13:17

I needed a rc switch very qick and i wanted to build it with the material that was available. Also the detection of the pwm input signal from the rc receiver is far the complexed part in software. To come to a quick and easy solution i choosed to program the small attiny13 microcontroller with the arduino ide. This is possible with some small modifications.


Circuit diagram

The circuit diagram is very simple and uses only some components:

  • Attiny 13
  • 100nF ceramic capacitor
  • Power-FET (in my case a IRLML2502)
  • Optional a LED and a 100Ohm resistor

Schaltplan


T1 from the image is the IRLML2502. C1 the 100nF capacitor at supply voltage. Pin2 of the attinyis the PWM servo signal from rc receiver and Pin3 is output to the power fet. The optional LED is also connected to Pin3 with the resistor to GND.

Software

The software, so i mean the Arduino Sketch, is very short:

int duration;
void setup(){
pinMode(3, INPUT);
pinMode(4, OUTPUT);
}

void loop(){
duration = pulseIn(3, HIGH);
digitalWrite(4, LOW);
if (duration > 1900)  {
digitalWrite(4, HIGH);
}
}

It can be downloaded here.

Here is a picture of the completed rc swith:

In the video below the rc switch is connected to a bec with rc receiver and a lipo battery connected to a simple 12v led strip as a load. Also you can see the optional LED. I used a smd led.








Last Updated on Tuesday, 15 May 2018 15:22