Feb. 1st, 2014

rbandrews: (Default)
I made the lights on the quadcopter operate by remote control. Here's how that went:

There were two general problems to solve here: one is, I needed to control 12 volts to the lights, with a 5 volt signal from the receiver. So there's the voltage mismatch. The second is, the signal from the receiver isn't a simple on-off, it's a pulsed signal, so I needed some way to decode that to decide whether the receiver was saying "lights on" or "lights off."

First, the voltage. The usual way to control one signal with another one is a transistor, so that's the first thing I tried, but the normal kind of transistor (that I have a drawer full of) really wants the signals to be the same voltage. If there's too much of a difference between the base voltage (that controls whether the transistor is on or off) and the source voltage (that the transistor allows through, or doesn't) then the source voltage just goes through the base. I burned up a resistor last weekend playing around with this.

The solution to this problem is called a MOSFET: metal oxide semiconductor field-effect transistor. The difference between a normal transistor and a MOSFET is that once a little voltage starts to go through, that sets up a reinforcement effect that lets the rest through. So a small voltage to the base starts this avalanche going, and so a 5 volt signal will turn on or off a 12 volt signal.

Next problem, the pulses. RC aircraft are designed to have a bunch of analog signals to control servos: some level for the throttle, an angle for ailerons or whatever. An on-off signal isn't very useful on an RC plane, so RC equipment isn't really set up to produce it. What happens instead is you get a pulse: if the throttle (say) is at 0, then you get a pulse 1000 microseconds long followed by 1500 microseconds of nothing; if it's at 100% you get a 2000 microsecond pulse followed by 500 microseconds of nothing. But it's never fully on or off: the minimum pulse is 1000 us, the maximum is 2000 us. So I need something to decode that.

There were a few solutions to this: build an analog circuit which will charge a capacitor with the long pulse but the short pulse won't charge it enough, for example. Or buy another component called a speed controller, which is meant as a go-between to translate this kind of signal for an RC aircraft engine (which the copter already has four of). In the end, I cheated, and took a more expandable approach: I used an Arduino.

The Arduino reads the pulses, looks at the width, and either writes (or doesn't) to an output pin, which is connected to the MOSFET. This is kind of cheating since I used a fairly powerful computer where a few cents of passive components would do, but on the other hand now that I have this, I can use the same board do to other things later, like landing gear or control a camera or whatever.

But for now, what I have is, a board sitting on top of my copter that allows me to flip a switch and turn some lights on or off in flight. Which is kinda useless (I know when I take off whether it's dark enough for lights or not) but also kinda cool.

Profile

rbandrews: (Default)
rbandrews

December 2014

S M T W T F S
  123456
78910111213
14151617181920
21222324252627
28293031   

Style Credit

Page generated Aug. 19th, 2017 03:34 am
Powered by Dreamwidth Studios

Expand Cut Tags

No cut tags