DIY Receiver Controlled Switch (Cheap and Easy)

29K6522

Intro: DIY Receiver Controlled Switch (Cheap and Easy)

I ran into a small problem one day while I was building my first quadcopter! I wanted to have lights on it but I didn't want them to always be on, like while I was flying during the day. Now of course there is always the option of buying one, but I didn't want to wait for one to come snailmail! So I set about building one. All it takes are a few parts any DIYer should have laying around and the circuit is very versatile! This circuit is small enough to fit on your quads or planes, and is powerful enough to drive almost 8 meters of 12 volt LED strips. *

Difficulty level: Breezy: Easy: Medium: Time-Consuming: Hard: Expert: Master:

*refer to your own LED strips datasheet to see how many amps they draw.

STEP 1: Ingredients:

  • Arduino (optional, see video)
  • ATtiny 13,45, 85 or similar
  • TIP120 transistor or equivalent, or any N-Channel MOSFET
  • 1kΩ resistor
  • 8 pin DIP socket
  • 2 pin screw terminal
  • 90 degree pin headers, 3 in a row, and 4 in a row
  • Breadboard
  • Jumper wires
  • Perfboard
  • LED strip

You will need a few more parts but I'm already assuming you have a quadcopter/plane built, or have parts needed to build one. Just in case here's what you'll need from your quad/plane.

  • 3 cell LiPo
  • RX/TX
  • ESC (to power the receiver)

NOTE:

If you are going to use a TIP120 transistor know your limits! This transistor can only handle 5A of continuous current. Refer to the datasheet of your specific transistor to find the limits. For a 12 volt LED strip of about 1 meter 5A max is plenty! My LED strip draws about .6A for 1 meter, so testing yours with a multimeter would be a good idea.

STEP 2: Code and Schematics

STEP 3: Watch the Video


STEP 4: Taking It Further

The code I gave you was quite simple! Using the same device I changed the code up a bit so that the higher the throttle input there is the brighter the LEDs get. You can check out that code here.

Hopefully soon I will have a PCB version of this project. That way you can keep everything neat and tidy and there would be less soldering to do. All you'd have to do is make/buy the PCB, pop the parts in, and solder them down! All the connections would be already made. But, that's for another day!

Thank you very much for watching the video/reading this instructable. If
you have any bright ideas, questions or comments please PM me or leave them in the box below!

~AJ

19 Comments

Hello. Thanks for this informative post.
Based on your project, I am trying to implement this project with Arduino Nano. Here is what I need in my project:
When I open the button on the remote, when the "number" value rises above 1500, the D8 output will open, but even if the button remains open, D8 must be turned off after 2 seconds.
So even if the remote control button is on, it should turn off the light itself after 2 seconds.
Is there anyone who can help with this? How should I change the codes given here?
Ask this in stack exchange, make sure to include code
The codes are all the codes you use.

// Code by HavocRC.
// AJ Robinson
int RXin = 7; //Arduino Nano Input Pin
int AUXout = 8; //Arduino Nano Output Pin

unsigned long number;
int signal = 0;
void setup()
{
pinMode(RXin, INPUT);
pinMode(AUXout, OUTPUT);
}
void loop()
{
number = pulseIn(RXin, HIGH);
if (number > 1500)
{
digitalWrite(AUXout, HIGH);
// Here, when the lights turn on, I want it to turn itself off after 2 seconds.
}
}
hello can sombody help me with the coding... i want to use the (dimmable version for 2 outputs), i use 2 tip120 and 2 resistors of 1k.

// Code by HavocRC.
// AJ Robinson
int RXin = 2;
int RXin1 = 3;
int AUXout = 0;
int AUXout1 = 1;
unsigned long number;
unsigned long variable;
int signal = 0;
void setup()
{
pinMode(RXin, INPUT);
pinMode(RXin1, INPUT);
pinMode(AUXout, OUTPUT);
pinMode(AUXout1, OUTPUT);
}
void loop()
{
number = pulseIn(RXin, HIGH);
variable = map(number, 975, 2005, 0, 235);
number = pulseIn(RXin1, HIGH);
variable = map(number, 975, 2005, 0, 235);
if (number < 1100)
{
digitalWrite(AUXout, LOW);
digitalWrite(AUXout1, LOW);
}
else
{
analogWrite(AUXout, variable);
analogWrite(AUXout1, variable);
}
delay(100);
}



i have 2 outputs working with this but i don not have 2 seperate inputs.
does somebody know what mistake i make.

iam not a pro iam a hobby guy :D

Thank You.
I can't test this obvi but it should work fine! Once you copy it into the Arduino IDE, select everything and then go to Tools > Autoformat. This will indent everything properly as this comment box can't. Let me know how it works!

// Code by AJ Smoothie

int RXin1 = 2; // rx input
int RXin2 = 3; // rx input 2
int auxPin1 = 0; // pwm output pin 1
int auxPin2 = 1; // pwm output pin 2
int rawVal1 = 0; // raw value from radio
int rawVal2 = 0; // raw value from radio
int auxVal1 = 0; // mapped value 1
int auxVal2 = 0; // mapped value 2
void setup() // performs this once
{
pinMode(RXin1, INPUT);
pinMode(RXin2, INPUT);
pinMode(auxPin1, OUTPUT);
pinMode(auxPin2, OUTPUT);
}
void loop()
{
rawVal1 = pulseIn(RXin1, HIGH);
auxVal1 = map(auxVal1, 975, 2005, 0, 235);
rawVal2 = pulseIn(RXin2, HIGH);
auxVal2 = map(auxVal2, 975, 2005, 0, 235);
if (rawVal1 < 1100)
{
digitalWrite(auxPin1, LOW);
}
else
{
analogWrite(auxPin1, auxVal1);
}
/////////////////////for input # 2/////////////
if (rawVal2 < 1100)
{
digitalWrite(auxPin2, LOW);
}
else
{
analogWrite(auxPin2, auxVal2);
}
}
i have it working :D Look this is what i Modified,

// Code by HavocRC.
// AJ Robinson
// Modified By
// Darksnake
int RXin = 2;
int RXin1 = 3;
int AUXout = 0;
int AUXout1 = 1;
int variable = 0;
int variable1 = 0;
int number = 0;
int number1 = 0;
void setup()
{
pinMode(RXin, INPUT);
pinMode(RXin1, INPUT);
pinMode(AUXout, OUTPUT);
pinMode(AUXout1, OUTPUT);
}
void loop()
{
number = pulseIn(RXin, HIGH);
variable = map(number, 975, 2005, 0, 235);
number1 = pulseIn(RXin1, HIGH);
variable1 = map(number1, 975, 2005, 0, 235);
if (number < 1100)
{
digitalWrite(AUXout, LOW);
}
else
{
analogWrite(AUXout, variable);
}
/////////////////////Input #2/////////////////////
if (number1 < 1100)
{
digitalWrite(AUXout1, LOW);
}
else
{
analogWrite(AUXout1, variable1);
}
delay(100);
}
Hello HavocRC,

i tried the code you send me but i can only turn lights on/off. they are not dimmable.

i appreciate your help.

sorry for my bad english.
Nice little project! Unfortunatelly compiling the code in the Arduino IDE doesn't work for me.
I get this error message:


Arduino: 1.8.12 (Windows 10), Board: "ATtiny13, 9.6 MHz internal osc., EEPROM retained, BOD 2.7V, Micros disabled"

C:\TEMP\arduino_modified_sketch_897497\2-Kanal_DIY_Receiver_Controlled_Switch_bb-layout.ino: In function 'void loop()':

2-Kanal_DIY_Receiver_Controlled_Switch_bb-layout:19:30: error: too few arguments to function 'uint32_t pulseIn(uint8_t, uint8_t, uint32_t)'

number = pulseIn(RXin, HIGH);

^

In file included from sketch\2-Kanal_DIY_Receiver_Controlled_Switch_bb-layout.ino.cpp:1:0:

D:\file_Elektronik\Mikrocontroller\Arduino\Software\arduino-1.8.12-windows\arduino-1.8.12\hardware\MicroCore-master\avr\cores\microcore/Arduino.h:109:12: note: declared here

uint32_t pulseIn(uint8_t pin, uint8_t state, uint32_t timeout);

^~~~~~~

exit status 1
too few arguments to function 'uint32_t pulseIn(uint8_t, uint8_t, uint32_t)'


What's wrong here? I'm a beginner in programming, the problem is not to solve for me without your help.
Thank you in advance!
Hey buddy! You can't use an ATtiny13 for this project. You'll need a better chop with more features. If your looking for setting small, a Ardunio Nano or Pro Micro will work great!
Hi, thank you for response!
But now I'm a little bit confused - you wrote in the description (ingredients and schematic) above that a Attiny13 is right to do this work.
Your design isn't a Nano or something else, too. So I'm really interested to find out, why the Attiny13 isn't the right choice for me. Could you explain it to me?
Thanks a lot!
I'm looking to find a switch, in this case probably build one, that will power one 5mm diode for landing light on my fixed wing aircraft. What changes (resistor I imagine) would be made to power just one LED running off of 6.6v receiver battery?
Simply replace the TIP120 MOSFET with a 2n2222A transistor or a 3904. You can keep the 1K resistor on the base of the transistor. Google "transistor as switch" if you need help.
Hey thank you for the response. I am illiterate when it comes to circuitry. So solder it all in place as you described only using the 2n2222A Transistor?
Exactly. Look up a schematic of a 2n2222A. The base of the transistor will connect to the base 1K resistor, the emitter will connect to ground, and the collector will AUX out.

Thanks again, like you I am starting to self teach and just bought an arduino.

I'm going to try this, thanks, but one question I have is why the arduino?? Are you using the arduino to program the at tiny?

Yeah I'm using the Arduino to program the attiny. You don't have to use an Arduino you can use an either FTDI or a USBasp (I forgot which one) to program the attiny. Or you can buy a specific attiny programmer from like adafruit or ebay.

Nice Instructable! I cleaned up the schematic and designed a board. I used your user name here under the CC-SA license as the original designer. Wanted to ask permission to share the files, of course with your name. I will also release it under the Non-Commercial (CC-NC) license as well. I will not sell this board to make a profit. But I think people would enjoy this project on their own RC. I will be using it on my F450 Quad.

Thanks again,

Trevor

Hi! I'm glad you enjoyed my i'ble.

May I ask where this content will be published?

According to the (CC) BY-NC-SA license if you remix or adapt the original content you must keep the original license.

As long as you follow the correct licensing guidelines you are free to do what it allows.

http://creativecommons.org/licenses/by-nc-sa/2.5/