DIY RC switch for my quad lights

Started by SK1701, January 07, 2015, 05:43:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SK1701

I have been planning to light up my quad for a while now. I received LED strips from quadkopters.com yesterday along with a JST harness. The LEDs are impressively bright. I need to rebuild my quad first and check if it flies but meanwhile I have been working on a RC switch for these lights. I was planning to go for a modded servo board but I have a free 3 position switch on my radio so I thought "Why not add a strobe feature too?". I have made the initial prototype, using Arduino. I plan to port it to Attiny to save space. I am using a TIP31C transistor to drive the 12V LEDs. I will be powering the LEDs either from the main battery or a separate one (my plane battery). The circuit will require a common ground so I will have to figure out how to implement that (maybe using the BAT port) with an LM7805 to power the Attiny.
Here is my code (my programming knowledge is very little. This code was made by cobbling together the Blink program as well as a program to read the PWM signals from the receiver by Nick Poole.):
/*
RC PulseIn Joystick
By: Nick Poole
SparkFun Electronics
Date: 5
License: CC-BY SA 3.0 - Creative commons share-alike 3.0
*/

int ch1;
int led = 13;
void setup() {

 pinMode(5, INPUT); // Set our input pins as such
 pinMode(led, OUTPUT);


 Serial.begin(9600); // Pour a bowl of Serial

}

void loop() {

 ch1 = pulseIn(5, HIGH, 25000); // Read the pulse width of
 Serial.print("Switch:"); // Ch2 was y-axis
 Serial.println(map(ch1, 1000,2000,-500,500)); // center at 0


 {
   if(map(ch1, 1000,2000,-500,500)<-25){
     Serial.println("Lights Off");
     digitalWrite(led, LOW);
   };
   {
     if(map(ch1, 1000,2000,-500,500)>-25 && map(ch1, 1000,2000,-500,500)<0){
       Serial.println("Lights On");
       digitalWrite(led, HIGH);
     };
     {
       if(map(ch1, 1000,2000,-500,500)>10){
         Serial.println("Lights Blink");
         digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
         delay(50);               // wait for a second
         digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
         delay(50);               // wait for a second
       };

       delay(1000);// I put this here just to make the terminal
       // window neater
     }


   }
 }
}

Printing to the Serial monitor is unnecessary. It just makes reference easier. I would appreciate any tips, suggestions or advice.


sooraj.palakkad

RC Hobbyist and an Aerial Cinematographer..

ashok baijal

Electronics used to be one of my hobbies amongst others like Amateur Radio ( Call sign VU2AEY). A number of my circuit designs have been published in the 1980s in Electronics For You. However frequent transfers put an end to them. Would like to start with microcontrollers and have gone through books on PIC microcontrollers and  have the  PIC programmer and recently also got a usbasp for avr controllers. Need help in getting a practical start. Can any forum member help me in getting over the initial hump? I am writing on this thread as micro enthusiasts will read this thread.

sooraj.palakkad

well ,so your planning to start in pic and avr.?
the current trend being Arduino - which is such a simplified platform where even novice in electronics can easily lear with a little knowledge in c programs...

For PIC and AVR you have to program in either assembly (Which is tedious) or use C compilers..
RC Hobbyist and an Aerial Cinematographer..

sooraj.palakkad

For PIC microcontrollers, you can download MPLAB IDE, with Integrated C compiler..
RC Hobbyist and an Aerial Cinematographer..

parichya.gautam

quick question, i too have the leds in my quadkopters cart :)
but,

How much reduce in battery life will be there with 4 LED strips ?

and, regarding the connections, does the JST connector go IN the Rx ?
Passion > Financial Constraints

To Contact:
FB: https://www.facebook.com/parichya
Mob: 8375066843
Mail:
-------------------------------------------------------
My Products On Sale Catalogue: ( !!! LOWEST PRICE GUARANTEE ON ALL ITEMS !!! ) https://app.box.com/s/84m5t5ljrwat54rmrldjg74dtie28g44
-------------------------------------
Product Request Form: https://docs.google.com/forms/d/1-OccRCaAQux8hxpuTw_xI4k3Ll9QW9JyOr0XDijzPXA/viewform?us

sooraj.palakkad

LEDs won't take up much power so that you experience a flight time decrease ...

No the JST don't go to Radio.
RC Hobbyist and an Aerial Cinematographer..

parichya.gautam

ok so in the M6 port ? I have extra power to the Rx cable in the M5 port :P
Passion > Financial Constraints

To Contact:
FB: https://www.facebook.com/parichya
Mob: 8375066843
Mail:
-------------------------------------------------------
My Products On Sale Catalogue: ( !!! LOWEST PRICE GUARANTEE ON ALL ITEMS !!! ) https://app.box.com/s/84m5t5ljrwat54rmrldjg74dtie28g44
-------------------------------------
Product Request Form: https://docs.google.com/forms/d/1-OccRCaAQux8hxpuTw_xI4k3Ll9QW9JyOr0XDijzPXA/viewform?us

sooraj.palakkad

power to LED strip is not from receiver , it is directly fed from Battery - ESC power rail (Assume you are having 12V LRD strips)
RC Hobbyist and an Aerial Cinematographer..

parichya.gautam

from the battery ??? how do i connect it  :?
Passion > Financial Constraints

To Contact:
FB: https://www.facebook.com/parichya
Mob: 8375066843
Mail:
-------------------------------------------------------
My Products On Sale Catalogue: ( !!! LOWEST PRICE GUARANTEE ON ALL ITEMS !!! ) https://app.box.com/s/84m5t5ljrwat54rmrldjg74dtie28g44
-------------------------------------
Product Request Form: https://docs.google.com/forms/d/1-OccRCaAQux8hxpuTw_xI4k3Ll9QW9JyOr0XDijzPXA/viewform?us

SK1701

I haven't installed the LEDs yet so I can't really tell about flight time changes. They should not draw more than 400 mA per meter. I am planning to power them from a separate battery anyway (WolfPack White 900 mAh 25C). To power them from a separate LiPo you will need a harness like this: http://www.quadkopters.com/product/night-flying-accessories/jst-power-breakout-cable-6-jst/
Alternatively, you could power them from the balance leads of the main LiPo using this harness:
http://www.ebay.in/itm/200975726673?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649
I bought the last piece though  >:D

SK1701

Ashok Sir, Arduino is a good way to get into microcontrollers. The language is very simple and there is a large user base, so you will have a lot of code and support available online. The only programming language I know is Python, but I dod not have too much trouble with Arduino. I download programs from the Internet or cobble together my own programs from existing ones. I think PIC microcontrollers are harder to work with though they can be programmed in BASIC. An Arduino Uno costs roughly around  :Rs: 1500 You will also need some accessories like discrete components, a solderless breadboard and jumper wires.

parichya.gautam

DAMN IT !! Any alternative links to the Balance lead harness ?
Passion > Financial Constraints

To Contact:
FB: https://www.facebook.com/parichya
Mob: 8375066843
Mail:
-------------------------------------------------------
My Products On Sale Catalogue: ( !!! LOWEST PRICE GUARANTEE ON ALL ITEMS !!! ) https://app.box.com/s/84m5t5ljrwat54rmrldjg74dtie28g44
-------------------------------------
Product Request Form: https://docs.google.com/forms/d/1-OccRCaAQux8hxpuTw_xI4k3Ll9QW9JyOr0XDijzPXA/viewform?us

parichya.gautam

Passion > Financial Constraints

To Contact:
FB: https://www.facebook.com/parichya
Mob: 8375066843
Mail:
-------------------------------------------------------
My Products On Sale Catalogue: ( !!! LOWEST PRICE GUARANTEE ON ALL ITEMS !!! ) https://app.box.com/s/84m5t5ljrwat54rmrldjg74dtie28g44
-------------------------------------
Product Request Form: https://docs.google.com/forms/d/1-OccRCaAQux8hxpuTw_xI4k3Ll9QW9JyOr0XDijzPXA/viewform?us

sooraj.palakkad

Don't you have a power distribution board onboard ? solder the LED strip terminals to that
RC Hobbyist and an Aerial Cinematographer..

SK1701

Cheaper by 10 bucks. That's an amazing saving!  :giggle: Anyway, you can go for it since you have a big 5000 mAh battery. The only problem is that you will have to unplug it to check your battery voltage. I bought these since I am using a power distribution harness- so much easier.

SK1701

BTW, @ parichya. If you plan to solder the LED strip wires yourself, buy some longer strips from ebay.in. They are much more economical.

parichya.gautam

damn it XD

i need the balance lead for the lipo checker ..

Any other option to how i can connect it ? which doesnt involve soldering :P
Passion > Financial Constraints

To Contact:
FB: https://www.facebook.com/parichya
Mob: 8375066843
Mail:
-------------------------------------------------------
My Products On Sale Catalogue: ( !!! LOWEST PRICE GUARANTEE ON ALL ITEMS !!! ) https://app.box.com/s/84m5t5ljrwat54rmrldjg74dtie28g44
-------------------------------------
Product Request Form: https://docs.google.com/forms/d/1-OccRCaAQux8hxpuTw_xI4k3Ll9QW9JyOr0XDijzPXA/viewform?us

ashok baijal

@SK701. True Arduino is much simpler but C is no problem. I am quite conversant with C as once I was a faculty at SBIICM and C was one of the subjects I used to teach.
@Sooraj. Yes I have all the software/hardware. Was looking for the initial push into this world.
Nevertheless, once a start stumbling, I will take the liberty of contacting you guys for help

sooraj.palakkad

Why don't you guys just remove the JST connectors from LED strip and solder the leads to some where in the power distribution network ???
Why buying another 100 Rupee conundrum, just for blinking some LEDs ?

And another thing guys, these 12V LED strip lights will be available in your local electronic shop for just ~350 Rs for 5 mtrs !!! - buy a pack and cut out as much as you need to light up to tens of Quads  :giggle:
RC Hobbyist and an Aerial Cinematographer..

sooraj.palakkad

Quote from: ashok baijal on January 07, 2015, 08:17:48 PM
@Sooraj. Yes I have all the software/hardware. Was looking for the initial push into this world.
Nevertheless, once a start stumbling, I will take the liberty of contacting you guys for help

An Initial push ? You mean a "Hello world" ?
Which PIC programmer you use ?
RC Hobbyist and an Aerial Cinematographer..

parichya.gautam

Cant I get a balance lead splitter XD ?

Sooraj check mail btw
Passion > Financial Constraints

To Contact:
FB: https://www.facebook.com/parichya
Mob: 8375066843
Mail:
-------------------------------------------------------
My Products On Sale Catalogue: ( !!! LOWEST PRICE GUARANTEE ON ALL ITEMS !!! ) https://app.box.com/s/84m5t5ljrwat54rmrldjg74dtie28g44
-------------------------------------
Product Request Form: https://docs.google.com/forms/d/1-OccRCaAQux8hxpuTw_xI4k3Ll9QW9JyOr0XDijzPXA/viewform?us

ashok baijal

@Sooraj. Yep. Someone to hold my hand when the micro beeps out "Hello World" ;D ;D

sooraj.palakkad

@parichya, for the money you invest in all the connectors, you can get 5 meters of LED strip !!  :giggle:

@Ashok sir , start from anything you like - still a Blinking LED being the most common "Hell-world" for any microcontroller.
Have you been to any other micro controllers in past ?
you were an EFY writer ? awesome !
RC Hobbyist and an Aerial Cinematographer..

parichya.gautam

I actually have some LED strip with me. but how will I power it ?
Passion > Financial Constraints

To Contact:
FB: https://www.facebook.com/parichya
Mob: 8375066843
Mail:
-------------------------------------------------------
My Products On Sale Catalogue: ( !!! LOWEST PRICE GUARANTEE ON ALL ITEMS !!! ) https://app.box.com/s/84m5t5ljrwat54rmrldjg74dtie28g44
-------------------------------------
Product Request Form: https://docs.google.com/forms/d/1-OccRCaAQux8hxpuTw_xI4k3Ll9QW9JyOr0XDijzPXA/viewform?us