This is only a preview of the February 2008 issue of Silicon Chip. You can view 34 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "UHF Remote-Controlled Mains Switch":
Items relevant to "UHF Remote Mains Switch Transmitter":
Items relevant to "Shift Indicator & Rev Limiter For Cars":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
UHF Remote
Mains Switch
Transmitter
Designed to control the UHF Remote
Mains Switch, this hand-held
transmitter can operate over a 200m
range. It’s based on a PIC micro and
a pre-assembled transmitter module,
making it easy to build and get going.
By JOHN CLARKE
I
the UHF
Remote Mains Switch in a standalone application, then you need to
also build this UHF transmitter. As
shown in the photos, it’s housed in
a plastic case with two pushbutton
switches for on/off switching. Press
the On button and power is applied to
the mains socket on the UHF Remote
Mains Switch. Alternatively, press the
Off button and the power turns off.
What could be easier?
The front panel also provides access
to a small rotary switch. This selects
one of 10 “identities” which means
that the transmitter can control up
to 10 separate UHF Remote Mains
Switches. This rotary switch is adjusted using a small blade screwdriver.
Immediately above the “On” button
is a “transmit indicator” LED. This
briefly lights each time a transmission
is sent (ie, when ever the On or Off
buttons are pressed). However, if there
is an error, this LED will flash three
times in a 1.5-second period.
Typically, an error will be indicated
if both switches are pressed simultaf you want to control
34 Silicon Chip
neously or if a switch is pressed too
briefly. In either case, it’s simply a
matter of pressing the desired switch
again to send the control signal.
How it works
Refer now to Fig.1 for the circuit
details. As previously stated, it’s based
on a PIC microcontroller (IC1) and a
433MHz transmitter module.
Under normal conditions (ie, when
no signal is being transmitted), no
power is applied to the circuit. This
means that battery usage is kept to an
absolute minimum.
Pressing either switch S1 (On) or
switch S2 (Off) connects the battery’s
positive terminal to regulator REG1
via diode D1 or D2. A 10W resistor is
included between the battery and the
switches to limit the initial charge
current to the 10mF bypass capacitor
at REG1’s input. This minimises wear
on the switch contacts.
As soon as power is applied to
REG1’s input, its output delivers a
+5V rail to pin 14 (Vdd) of IC1. As a
result, the program within IC1 starts
running. One of the first things it does
is to check which switch was pressed
and this happens after a short delay to
ensure that the switch is fully closed.
In operation, S1 is monitored via a
10kW resistor at the RA2 input, while
S2 is monitored via a 10kW resistor
at the RA4 input. The program first
checks to see if S1 is closed and it does
this as follows.
Initially, RA2 (pin 1) is set as an
output with this pin at 0V. RA2 is
then set as an input and its voltage
checked to see if it is still at 0V or if
has been pulled to +5V. If it is at +5V,
then S1 (On) is closed and the battery
voltage is being applied to REG1 via
diode D1.
The 10kW resistor in series with RA2
is included to limit the current into
this input when its internal clamping
diode conducts. This diode prevents
RA2 from going more than 0.6V above
the +5V supply, thereby protecting this
input from damage.
Next, the program checks to see if
S2 is closed. In this case, RA4 (pin 3)
is initially held low (0V) as an output.
siliconchip.com.au
Q1 BC327
REG1 78L05
C
E
10k
D3
D1
A
10
RA1
10k
1
10k
Q2
BC549
C
3
10k
B
16
E
1
S3
S4
4 C 1
4 C 1
8 9A
67
BC D
➡
23
34 5
2 C 8
012
901
➡
COM
EF
78
456
9V
BATTERY
2 C 8
Vdd
MCLR
A
S2 (OFF)
14
4
D2
S1 (ON)
A
100 F
16V
100nF
10k
100nF
K
K
K
GND
10 F
16V
B
1k
OUT
IN
2
4
8
S3
IDENTITY (0–9)
8
6
7
9
LED1
1k
18
K
ANTENNA
A
Vcc
RA2
RA0
RA4
17
DATA
IC1
PIC16F88-I/P
433MHz
TRANSMITTER
MODULE
RA7
ANT
GND
RB2
RB4
RB0
RB6
RB1
RB7
RB3
RB5
10
12
13
11
Vss
5
1
2
COM
4
433MHz Tx MODULE
8
ANT
Vcc
DATA
GND
S4
ENCODE (0-F)
D1– D3: 1N4148
A
SC
2008
LED
K
UHF REMOTE MAINS SWITCH TRANSMITTER
78L05
BC337, BC549
K
COM
B
E
A
C
IN
OUT
Fig.1: the transmitter circuit uses PIC microcontroller IC1 to generate a data signal whenever switch S1 (On) or S2
(Off) is pressed. This data is then fed via IC1’s RA0 output to a 433MHz transmitter module. BCD switches S3 & S4
set the identity and encode values & must be set to match settings in the UHF Remote Mains Switch.
RA4 is then set as an input and its voltage checked. A high voltage means that
S2 is closed and that voltage is being
applied to REG1 via diode D2.
Diodes D1 and D2 provide reverse
polarity protection for REG1 if the
battery is connected the wrong way
around. They also isolate the switch
actions, so that RA2 will only go high
if S1 is pressed and RA4 will only go
high if S2 is pressed.
As well as detecting which switch
was pressed, IC1’s firmware also
detects whether both switches were
pressed simultaneously (as indicated
by a high at both RA2 & RA4). It also
detects if neither switch is pressed.
In the latter case, this would mean
that one of the switches was pressed
but then released before the program
had a chance to check which switch
it was.
Next, the program sets RA7 (pin 16)
of IC1 high and this drives the base of
transistor Q2 via a 10kW resistor. As a
result, Q2 turns on and supplies base
current to Q1 which also turns on.
As a result, supply current can now
siliconchip.com.au
flow through D3 and Q1 to REG1,
which means that power to REG1 is
maintained even if switch S1 or S2 is
released. This supply latching is necessary to allow time for the on or off
code to be transmitted in its entirety
without supply interruption.
Diode D3 is there simply to protect
the circuit from reverse battery connection.
RA1 (pin 18) is the transmit indicator output. This output goes low during code transmission and turns on
LED1 via a 1kW resistor. However, if
the program detects that both switches
were pressed or if it detects that neither
switch was pressed (ie, the press was
too brief), the LED flashes three times
to indicate an error.
BCD switches
Now let’s take a look at the two
binary coded decimal (BCD) switches
(S3 & S4) that are connected to the
microcontroller.
First, BCD switch S3 sets the identity. It’s connected to IC1’s RB0-RB3
inputs and individually connects these
Main Features
•
Controls the UHF Remote
Mains Switch
•
Up to 10 UHF Remote Mains
Switch units can be controlled
•
•
•
•
•
•
•
16 encoder selections
200m range
On/off switching
Handheld operation
9V battery supply
Transmit indicator
Transmit error indication
inputs to ground when its 2, 4, 1 & 8
switches are closed respectively.
Basically, S3 is arranged as a rotary
switch with 10 settings ranging from
0-9. For the “0” setting, all switches
are open, while and for the other
numbers, different combinations of
switches are open and closed. For
February 2008 35
170mm OF 1mm ENAMELLED
COPPER WIRE
K
10 F 100 F
4148
10k
➡
BC DE
4 C 1
78 9
A
23
Q2
2 C 8
4 C 1
78
➡
2 C 8
456
100nF
10k
4148
45
23 6
10k
D2
IC1 PIC16F88-I/P
LIE ON SIDE
S2
OFF
901
S4
S3
–
433MHz Tx
MODULE
1k
D1
10k
10k
S1
ON
F0 1
18020151
REG1
ANT
Vcc
LED1
A
DATA
GND
RETTIMSNART WS SNIAM ETOMER
100nF
+
4148
D3
10
Q1
1k
9V BATTERY
CJ
Fig.2: follow this diagram to install the parts on the PC board
and complete the battery wiring. Note that BCD switch S3 is
installed in a socket to raise it up off the PC board (see text), to
make it easier to access. The view at right shows the completed
PC board mounted inside the handheld case.
example, a “1” position ties the RB2
input to ground.
Conversely, the RB0-RB3 inputs are
pulled to the +5V supply rail when
their corresponding switch is open.
That’s because each input has an internal pull-up resistor of about 20kW.
In operation, S3’s settings can be read
by microcontroller IC1 because a low
voltage on one of the inputs means
that its corresponding switch is closed
while a high voltage means that the
switch is open.
BCD switch S4 sets the encode
number and is monitored in a similar
way. However, this switch has six extra
positions labelled A-F, giving it a total
of 16 positions.
The settings for S3 & S4 are sent
as part of the on/off code that’s fed
from RA0 to the 433MHz transmitter
module. Basically, the UHF transmitter transmits a modulated signal when
data is applied to its data input. A
¼-wave dipole antenna is connected
to the transmitter’s output.
In practice, IC1’s RA0 output can
generate on/off signals for up to 10
UHF Remote Mains Switches, depending on the setting of S3 (identity).
Initially, a 50ms transmission is sent
to set up the receiver so that it is ready
to accept data. A 16ms locking signal
is then sent, followed by 4-bit encode
and 4-bit identity numbers.
Next, an 8-bit on/off signal is sent
– either a value of 162 for “On” or a
value of 150 for “Off”. An 8-bit stop
code with a value of 204 completes
the data transmission.
Once this data has been sent, IC1’s
RA7 output is set low to switch off
transistors Q2 & Q1. This ensures that
the supply to REG1 turns off (assuming
that switches S1 & S2 are both open).
Resistor Colour Codes
o
o
o
o
No.
4
2
1
36 Silicon Chip
Value
10kW
1kW
10W
4-Band Code (1%)
brown black orange brown
brown black red brown
brown black black brown
5-Band Code (1%)
brown black black red brown
brown black black brown brown
brown black black gold brown
siliconchip.com.au
In addition, the RA1 output is taken
to +5V to switch off LED1.
Finally, note that there are several
decoupling capacitors at the output
of REG1. These filter the supply rails
for IC1 and the 433MHz transmitter
module.
Construction
The assembly is straightforward
with all parts mounted on a PC board
coded 10202081 and measuring 86
x 64mm. This is housed in a remote
control case that measures 135 x 70
x 24mm.
Fig.2 shows the parts layout. Begin
by checking the PC board for any defects such as shorted tracks or breaks
in the copper. That done, check the
hole sizes. The four corner mounting
holes should be 3mm in diameter, as
should the two holes used to anchor
the battery snap leads.
Now for the assembly. Install the
resistors first, taking care to place each
in its correct position. Table 1 shows
the resistor colour codes but it’s also
a good idea to use a DMM to check
each resistor before installing it on
the board.
Next, install PC stakes for the battery
snap leads and for the antenna connection near the 433MHz transmitter
module. That done, install diodes D1D3, REG1 and transistor Q1 & Q2. Be
sure to orient the diodes and transistors correctly and don’t get Q1 & Q2
mixed up. They may look the same
but Q1 is a BC337 PNP type while Q2
is a BC549 NPN transistor.
The capacitors are next on the list.
Note that the 100nF ceramic capacitor
mounts between Q2 and the transmitter module, while the 100nF polyester
capacitors is located just below IC1. In
addition, the two electrolytic capacitors adjacent to REG1 need to lie on
their side, to clear the lid of the case
– see photo.
Switches S1 & S2 can now go in.
Be sure to mount these with their flat
sides positioned as shown in Fig.2 (ie,
towards the top edge of the PC board).
That done, install an IC socket for IC1
(notched end towards REG1) but don’t
install the IC at this stage.
BCD switch S3 also mounts in an
IC socket, so that it is raised off the
board to make it easier to adjust from
outside the case. One option here is to
fit a cut-down DIP-8 socket, with three
pins on each side. Alternatively, we’ve
provided two extra holes on the PC
siliconchip.com.au
Parts List
1 PC board, code 10202081, 86
x 64mm
1 remote control case, 135 x 70
x 24mm
1 433MHz UHF data transmitter
(Jaycar ZW-3100 or equivalent)
1 9V battery
1 18-pin DIL socket
1 6-pin DIL socket (or 8-pin)
2 click action momentary switches (S1,S2)
1 0-9 BCD DIL PC-mount switch
(S3)
1 0-F BCD DIL PC-mount switch
(S4)
4 M4 x 10mm screws
1 170mm length of 1mm enamelled copper wire
1 9V battery snap connector
3 PC stakes
Semiconductors
1 PIC16F88-I/P microcontroller
programmed with 1020208A.
hex
1 BC327 PNP transistor (Q1)
1 BC549 NPN transistor (Q2)
1 78L05 5V regulator (REG1)
2 1N4148 diodes (D1-D3)
1 3mm red LED (LED1)
Capacitors
1 100mF 16V PC electrolytic
1 10mF 16V PC electrolytic
1 100nF MKT polyester (code
104 or 100n)
1 100nF ceramic (code 104 or
100n)
Resistors (0.25W, 1%)
5 10kW
1 10W
2 1kW
board so that it will accept a standard
8-pin DIP socket.
Once the socket is in place, install
S3 with its orientation dot at bottom
right – see Fig.2 and the photos. If you
have fitted an 8-pin socket, be sure
to plug S3 into the top six pins – the
two pins nearest the battery terminals
are unused.
By contrast, BCD switch S4 mounts
directly on the PC board. Once again,
be sure to mount it with the correct
orientation.
The UHF transmitter can now be
installed. This is done by first placing
it in position, then bending it down so
Helping to put you in Control
Sensors
We have a selection of sensors for
monitoring your processes.
Accelerometers
Accelerometer Breakout boards range
from +/-2G to +/10G. Available as 2
and 3 axis.
From $39+GST
Serial Accelerometer
A 3 axis accelerometer
up to +/-6g with a
simple RS232 serial
interface. Available as
card or enclosed.
From $105+GST
Dual Axis Gyro
This is the first dual-axis
MEMs gyro available. The
IDG-300 is a 3.3V IC
with a smaller profile
than other single axis
gyros. $99+GST
Proximity Switches
Inductive Proximity
switches in both
square and tubular
forms. Detection distances from 4 to 12mm. PNP and
NPN outputs
From $22.50+GST
Photoelectric
Switches
These Photoelectric
switches range from
0.4m to 15m. Available with PNP and NPN outputs
From $44.50+GST
Temperature
and Humidity
Industrial grade.
Wall and Duct
Mount.
From $209+GST
Pressure
High quality Industrial
Pressure Sensors.
Range from 0-0.5 to 0 –
1500 Bar. 4-20mA Output. $399+GST
Contact Ocean Controls
Ph: 03 9782 5882
www.oceancontrols.com.au
February 2008 37
SILICON
CHIP
+
+
On
+
Off
+
Identity
UHF Remote
Mains Switch
Transmitter
Fig.3: this full-size artwork can be
used as a drilling template for the
front panel.
that its top edge is about 8mm above
the top of the main PC board. That
done, check that it is correctly oriented
before soldering its pins.
LED1 must be installed so that the
top of its lens is 14mm above the PC
board (ie, level with the switch top).
Be sure to orient it with its anode lead
(the longer of the two) to the left.
The board assembly can now be
completed by installing the antenna
coil. This is made from a 170mm
length of 1mm enamelled copper wire
(ECW). First, cut the wire to length and
scrape away about 3mm of insulation
at each end, then shape the wire into
a spiral by winding it around an 8mm
mandril. Once that’s done, solder one
end of the antenna coil to the antenna
PC stake and the other end directly to
the PC board.
Final assembly
The final assembly basically involves fitting the board inside the
case.
The first step is to feed the battery
snap leads through from inside the
battery compartment and then down
through the two holes in the PC board
– see Fig.2. That done, solder the
leads to their respective PC stakes,
taking care to ensure that the polarity
is correct.
Now connect the battery and check
that the voltage between pins 14 & 5
of IC1’s socket is close to 5V when S1
is pressed. If this is correct, install IC1
with its notched end towards REG1.
LED1 should now briefly light each
time S1 or S2 is pressed. If it doesn’t,
check the LED’s orientation.
Assuming all is well, the PC board
can now be fitted into the base. It’s
secured to the four integral stand-offs
using M3 x 6mm screws. That done,
set the identity and encode switches
to match those in the UHF Remote
Mains Switch.
Now check that the UHF transmitter controls the UHF Remote Mains
Switch by pressing the On and Off
buttons. The neon indicator below
the mains socket should come on
when the transmitter’s On button is
pressed and go out when the Off button is pressed.
If it doesn’t work, unplug the UHF
Remote Mains Switch from the wall
socket and check the identity and
encode switch settings in the two
units. If it still doesn’t work, go over
the transmitter assembly carefully and
check for errors.
Note also that the transmitter will
not operate the UHF Remote Mains
Switch if they are too close to each
other. The two units must be separated
by at least one metre.
Once everything is working, attach
the lid to the transmitter case. If you
are building the unit from a kit, the lid
will be probably be supplied with all
holes pre-punched and with a screenprinted label. If not, then you will have
to drill the holes yourself.
These holes can be drilled using the
front panel label shown in Fig.3 as a
template. You will need to drill two
10mm holes to clear the switch caps, a
3mm hole for the LED and a 9mm hole
to give access to the Identity switch
(note: the latter is not necessary if you
intend using the transmitter with just
one UHF Remote Mains Switch).
By the way, it’s best to make the
larger holes by first drilling small pilot
holes which can then be further drilled
out to about 5mm. These holes can
then be carefully reamed out to their
correct sizes.
That done, the front-panel artwork
can be downloaded from the SILICON
CHIP website, printed onto photographic paper and attached to the lid
using an even smear of clear silicone
sealant. Alternatively, you can print a
mirror image of the panel onto clear
overhead projector film and attach this
with the print side towards the panel,
again using clear silicone sealant.
That’s it – your UHF Remote Mains
Switch Transmitter is now complete
SC
and ready for action.
Looking for real performance?
Completely NEW projects – the result of two years research
•
•
•
•
160 PAGES
From the publ
ishe rs of
23 CHAPTE
Learn how engine management systems work
RS
Build projects to control nitrous, fuel injection and turbo boost systems
Switch devices on and off on the basis of signal frequency, temperature and voltage
Build test instruments to check fuel injector duty cycle, fuel mixture and brake and coolant
temperatures
Mail order prices: Aust. $A22.50 (incl. GST & P&P); Overseas $A26.00 via airmail.
Order by phoning (02) 9939 3295 & quoting your credit card number; or fax the details
to (02) 9939 2648; or mail your order with cheque or credit card details to Silicon Chip
Publications, PO Box 139, Collaroy, NSW 2097.
38 Silicon Chip
Intelligent
turbo timer
I SBN 09585
2294
9 780958
5229
-4
46
$19.80 (inc GST) NZ
$22.00 (inc GST)
TURBO BOOS
T
& nitrous fue
l controllers
How engin
e
management
works
siliconchip.com.au
|