For my model aircraft I needed a remote controlled switch for aircraft lighting, and other functions.
The aircraft lights consist of 12V LED strips.
This switch allows 2 groups of LED's to be controlled independent.
The switch uses an 08M2 to convert the PWM RC input signal and drive the power switches.
There are 2 jumpers in the circuit, that allow programming the switch detection levels (PWM level that turns on the particular switch).
Installation:
connect the circuit to the receiver channel (i.e. the GEAR switch)
put JP1 on (if there is a LED strip attached, it will light up if 12V is connected)
Turn on the receiver and transmitter in the required setting for this function.
The 08M2 will (after 1 second) start measuring the PWM , and store it in internam memory.
Repeat this for JP2 (remove JP1).
Remove both JP1 and JP2. The circuit is ready for use.
Attached are photo's of the prototype, and the circuit diagram.
The power FET's can switch significant current, more than needed for LED strips, to also cover other applications.
The aircraft lights consist of 12V LED strips.
This switch allows 2 groups of LED's to be controlled independent.
The switch uses an 08M2 to convert the PWM RC input signal and drive the power switches.
There are 2 jumpers in the circuit, that allow programming the switch detection levels (PWM level that turns on the particular switch).
Installation:
connect the circuit to the receiver channel (i.e. the GEAR switch)
put JP1 on (if there is a LED strip attached, it will light up if 12V is connected)
Turn on the receiver and transmitter in the required setting for this function.
The 08M2 will (after 1 second) start measuring the PWM , and store it in internam memory.
Repeat this for JP2 (remove JP1).
Remove both JP1 and JP2. The circuit is ready for use.
Code:
' ------------------------------------- RC switch -------------------------------------
' Uses 1-2mSec RC PWM signal to trigger 2 power FET's to control auxilliary functions
' in an RC car, boat or airplane. Uses PICAXE 08M2
' OUTL and OUTR have pull down resistors (no accidental firing) and drive N channel
' power FET's. These can be controlled individually from the RC transmitter, for lighting,
' dropoff of sweets, or for launching rockets (fireworks).
' the software has 2 modes
'
' learning mode -----------------------------------------------------------------------------
' at powerup OUTL and OUTR serve as configuration pins. When one of these pins is
' connected to Vcc, then the software reads the PWM value from the RC receiver and
' stores it in EEprom. From now on it will use this value as a trigger for this switch channel.
' method: set controls at RC transmitter in correct setting for channel L. Set OUTL high (jumper).
' Now Power on RC receiver and RC switch. Wait 2 seconds (to learn PWM). switch off receiver
' and RC switch. Repeat procedure for channel R.
' please be aware that during learning mode the power FET's will be ON.
' operating mode ---------------------------------------------------------------------------
' in this mode the RC switch listens to the PWM signal from the RC receiver.
' When it receives a PWM that is withing +/- 20uSec in pulse width identical to the stored
' value in EEprom, it switches ON the associated power FET (and switches off the other one).
' in all other PWM values both FET's are off.
' PICAXE08M2
' +----_----+
' +5V +1 8+ GND
' NC +2 7+ NC
' POT 4 +3 6+ 1 OUTL
' PWM 3 +4 5+ 2 OUTR
' +---------+
' version control
' 0.1 pwmin, detect at fixed levels
' 0.2 jumpers on out1 and out2 used to program values in eeprom. no jumper = run
' potmeter is not being used anymore, but jumpers
' 0.3 jumpers inverted to prevent accidental firing during initialization with pull ups.
' lost 2 rockets because of this flaw....
Init:
'set outputs OUTL and OUTR to INPUT mode to check if learning mode is required
input 1
input 2
CheckMode:
'check if we need to calibrate, or execute
'the outputs are at this moment still inputs and pulled low (pulldown)
'unless config jumper to Vcc is placed
pause 250 ' time to settle inputs this pause also
' minimizes EEprom writes by slowing
' the read PWM - write EEprom loop.
if pin1=1 then CalPinL ' OUTL is Vcc
if pin2=1 then CalPinR ' OUTR is Vcc
pause 250
low 1 ' both FET's off
low 2
goto RunMode
CalPinL:
pulsin C.3,1,w1 ' get pwm input for L
write 1,b2 ' store value for L in mem 1 (b2 is low byte of w1)
goto CheckMode
CalPinR:
pulsin C.3,1,w1 ' get pwm input for R
write 2,b2 ' store value for R in mem 2 (b2 is low byte of w1)
goto CheckMode
RunMode:
pulsin C.3,1,w1 ' get pwm input
w1 = w1 + 2 ' prepare for jitter window +2 / -2
b4 = 0
read 1, b1 ' compare pwm to value for L with threshold +/- 2
b1 = w1 - b1
if b1 < 4 then
high 1 ' on L
low 2 ' off R
b4 = 1 ' note we fire
end if
read 2, b1 ' compare pwm to value for R with threshold +/- 2
b1 = w1 - b1
if b1 < 4 then
high 2 ' on R
low 1 ' off L
b4 = 1 ' note we fire
end if
if b4 = 0 then ' check if no fire trigger
low 1 ' off L
low 2 ' off R
end if
pause 100 ' here we skip up to 5 PWM cycles, but not critical
' for the application
goto RunMode
Attached are photo's of the prototype, and the circuit diagram.
The power FET's can switch significant current, more than needed for LED strips, to also cover other applications.