Loading...

 We have over 700 end of line + a few over stocked items available at discounted prices whilst stocks last. Look out for the them as you browse, download a complete PDF list or visit this page.


RC Switch by Alan Bond

 

RC Switch

RC SWITCH

This PICAXE based project was designed for the on/off control of motors (eg bilge bumps, bow thrusters, fire hose pumps etc) or lighting on radio controlled model boats, but will doubtless find application in other radio control projects. The PICAXE chip decodes the receiver signal and at a pre-set pulsewidth switches on a power MOSFET to drive the load. A small amount of hysteresis about the trip-point is included to prevent switch jitter and a user selectable link programs either momentary or latching operation of the switch. The trip point can be set by potentiometer anywhere within the range of the radio control joystick. This allows the unit to be adjusted to operate when some other device controlled by the same receiver channel reaches a certain critical point in its travel.

Unlike RC switches utilising relays, the switch "contacts" are not floating to be assigned as you wish - the 'hot side' of the load *must* be wired to the +ve of its power source  - and the 'cold' side of the load is switched to 0v by the MOSFET. This is taken care of in the attached layout if up connected as shown. The design is easily adapted to utilise a relay if preferred. 

A transistor buffer is used to condition the signal from the receiver. The output voltage swing of some receivers (especially 2.4Ghz types) has been found to be insufficient to trigger the PICAXE 08M (Schmitt Trigger type) input.

An LED is also connected to the gate of the MOSFET to indicate the on/off state of the switch. R4 holds an input port of U1 high unless it is shorted to ground by the jumper link - the state of this port is used to determine whether the switch is to be momentary or latching.  R6 serves to reference the source ('earthy' end) of the FET to the PICAXE 0v rail so it may be turned on and off by the chip, but prevents large motor earth return currents flowing in the radio control earth system and forces them to return directly to the battery (via SKT2). D1 protects the MOSFET from high flyback voltage spikes caused by switching inductive loads (like motors).

A *logic-level* N-Channel enhancement power MOSFET must be used if it is to be fully turned on by the 5v swing from the PICAXE chip. No heatsink is shown in the layout and it is instructive for the user to calculate the current capability of the switch. Use the Rds(on) quoted on the spec sheet of the device and calculate i-squared-r watts and look at the device's free-air power dissipation capability at its maximum case temperature. As specified it's quite a few amps! For higher currents a lower Rds(on) device can be used and/or a heatsink employed.


The following guidance is given for those who wish to try developing the PICAXE program for themselves. The values relate to (standard) operation at 4Mhz.

First I sample the potentiometer ('readadc' command) and scale the (0 to 255) result to yield a variable in the range 105 to 195 - this is to set my trip points between 1.05mSec to 1.95mSec. (note: 10uSec pulsewidth reading resolution at 4Mhz). Next I sample the rc signal ('pulsin' command - note the buffer has inverted the input signal so be sure to measure *negative* going pulses) and determine which side of neutral (1.5mSec = 150) it lies. This is because the program logic and hysteresis conditions either side of neutral are different. For ease of understanding I will first describe operation in the 150 to 195 region. Let us assume the trip point is set to 1.7mSec (=170)

For momentary switch operation it is simply a matter of determining if the input signal is greater than 170. If so the output pin driving the FET is set high ('high 0'). On further iterations round the loop, the output pin continues to be set high each time until such time as the input signal is determined to have reduced below 165 (5x10=50uSec of hysteresis) in which case the drive to the FET is now asserted low ('low 0')

Similar logic applies to operation in the 105 to 149 region, except that this time (for e.g. a 1.3mSec trip point) you need to check if the input signal is *less* than 130 to switch on the FET and *greater* than 135 to switch it off again.

For latching operation (as determined by the state of the link) you will need to set a 'flag' to remember which state the switch is in and toggle it accordingly.

RC Switch Layout

 

As can be seen from the pictures, the unit is easily constructed on stripboard and a 200mm servo lead is soldered in and strain-relieved with a tie-wrap to provide the input interface.  No provision has been made for programming the PICAXE chip in situ, so this must be done elsewhere in a slave rig.

The layout diagram shows the (potentially) heavy current carrying parts of the stripboard track that would benefit from thickening up by running a bead of solder along them

All the parts are available from Technobots of course!

PARTS
R1 - resistor 47k  #2008-047
R2 - resistor 1M  #2009-010
R3 - resistor 4k7 #2007-407
R4 - resistor 47k #2008-047
R5 - resistor 220R #2006-220
R6 - resistor 220R #2006-220

C1 - capacitor 100nF disc ceramic #2013-100

Q1 - transistor BC337-16 #2300-412
Q2 - power MOSFET STP36NF06L  #2300-850 or better

U1 - integrated circuit PICAXE08M #3803-111 pre-programmed chip

IC Socket for U1 #2700-008

D1 - diode 1N4001 #2100-001

LED1 - 3mm light emitting diode, red - #2110-300

RV1 - preset potentiometer 4K7 #2000-405

LK1 - PCB Header 3 way #2700-081
LK1 - PCB Jumper Link #2700-070

SKT1 - 200mm servo lead #3601-008
SKT2 - 16A 2 way terminal block #1208-002
SKT3 - 16A 2 way terminal block #1208-002

stripboard 95x64  #2700-110

 

Comments

07/01/2013, 19:11

"Declan,

Sorry but the code is not available due to royalty rights."

06/01/2013, 18:34

"Hi..

Is the code available for the Pic in order to evaluate/improve/update

Many thanks

Declan Barry
dpbarry@barryweb.co.uk"

20/11/2012, 10:05

"This was resolved at the time of query as Richard had also contacted me directly by e-mail and I was unaware of this posting duplicating his question. In short he was pointed at my Dual Channel RC Relay #3400-042. I have since visted Richard and seen them installed in his fine model. "

12/07/2012, 12:10

"Hi Alan

Don't suppose you've got a veroboard layout for your dual common RC Switch have you? Or even a twin version of the microprocessor switch?

Having finished the big lifeboat and converted to 2.5Ghz I'm now refitting all of my tugs which used to run on the Robbe Navy system with the associated switch modules and drivers.

I've got a wonderful new Spektrum DX10 with loads of switched channels but am having to build lots of switch modules to drive from the receivers. Several of the Tx switches are two way, i.e. in one position will swing a servo full left and in t'other full right. Similarly in one position it can be made to activate one of your MP switches and with a slight tweak of the switch pot it can be made to operate in the second tx switch position. Rather than have to build two switch units per channel I wondered if a two way version might be possible with two pots linked to two outputs?

Hope all goes well with you and look forward to seeing you down at Falmouth one day

Best wishes


Richard Clarke
"

10/12/2010, 10:15

"It depends what you mean by 6v!

(1) The user circuit switched by the power MOSFET can have any supply voltage you like from zero upwards to the maximum rating of the MOSFET but leave some headroom for comfort - say 24v to 36v (12v was a 'nominal' label) - so yes, 6v is ok.

(2) The PICAXE chip receives its power from the receiver and most R/C systems run on a 5v BEC from the speed controller. The maximum rating of the PICAXE chip is 5.5v - so anyone using a battery pack comprising four primary cells of 1.5v each (6v) should insert a 1N4001 diode in series with the chip's positive supply pin (pin 1) - ie the red wire of the servo lead.
"

08/12/2010, 20:45

"Will this switch work from a 6V supply?"

New Question or Review

Type the characters you see in the picture below.

 

Just a few of the companies Technobots are an official distributor for:
       Manufacturers