This is only a preview of the April 2009 issue of Silicon Chip. You can view 33 of the 96 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. Articles in this series:
Items relevant to "Multi-Function Remote-Controlled Lamp Dimmer":
Items relevant to "USB Printer Share Switch":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
Half Duplex with
HopeRF “TTL” HM-TR
UHF data transceivers
By STAN SWAN
Our introductory second-generation UHF data transceiver
article in October 2008 showed that using a PICAXE
to drive HopeRF’s HM-TR 433MHz programmable data
transceivers works well. In subsequent months, these
well-priced units have become very popular!
F
OR THOSE WHO have just come
in, these Chinese-made UHF FSK
data transceivers, selling locally for
~$25 (via MicroZed, the Australian
PICAXE distributors) offer tempting
programmable features in a 6-pin SIP
“one-stop” package. They have been
found well-suited to more professional 433MHz ISM applications.
Thanks to a quality-fitted antenna
socket, even the supplied “rubber
ducky” antenna allows line-of-sight
(LOS) ranges of up to 1km, with performance in demanding conditions
superior to cheap classic individual
433.92MHz transmitter/receiver offerings – many of which unfortunately
have insensitive receivers.
Conditions in crowded Asian cities
apparently favour the 433MHz UHF
band for the likes of slow wireless
utility data from water and electrical
SUPPLIED
“RUBBER DUCK”
ANTENNA
CON1
D9 (TO
PC SERIAL
PORT)
6
7
8
9
1
I/O
PINS
(CHANNELS)
2
3
5
10k
SERIAL
PROGRAMMING
LEAD
22k
HOPERF HM-TR
UHF DATA TRANSCEIVER
(TTL VERSION BEST)
ANT
1 2 3 4 5 6
ON
2
1
7
IC1
3
6
PICAXE-08M
4
8
0
ENABLE CONTROL
1
5
DTX
4.5V5V
SUPPLY
DRX
2
330
8
ENABLE
STATUS
LED
4
1
Fig.1: This simple PICAXE-08M circuit gives half duplex control of the HMTR 433MHz data transceiver and has very low hibernation current.
siliconchip.com.au
meters. Microwave level 2.4GHz data
links do not have the necessary punchthrough for numerous obstacles and so
quickly suffer attenuation.
We focused on the more versatile
RS232 versions in the initial SILICON
CHIP article but this month the “barebones” TTL transceiver types will
be considered. These TTL versions
offer very low (µA level) supply current “sleep” benefits and may also be
slightly cheaper, as a MAX232 IC is
not fitted to them.
However, even before “on-air” data
transceiver use, initial set-up configuration of these HM-TR/TTL units
requires logic level conversion and
inversion.
Although still referred to as TTL
(Transistor Transistor Logic), modern
low-power consumption circuitry is
now largely CMOS-based and operates in the logic range of 0V to +5V,
with increasingly +3.3V or even lower
values emerging.
Classic RS-232 signals use negative
voltages (as great as -15V) to represent
a logic high, with logic lows covering
a range to perhaps +15V. However,
many laptops, especially when battery operated, have much lower serial
voltages.
In contrast, TTL assigns 0 to ~1V as
logic low and signals ~2-5V as a high.
True RS232 signal levels are thus far
too great for TTL electronics and the
April 2009 85
Transmitter (TX) frequency deviation and receiver (RX) bandwidths
may especially be worth investigating
– narrow TX and wide RX bandwidths
have shown merit. Power level attenuations (PA) however may be academic,
as at only 5mW the maximum TX
output is hardly going to burn holes
in the ether!
Although data can be fed at a
standard PICAXE 2400 bps, reducing
the “on air” data transmission rates
may also improve communications
under noisy conditions. The modules transparently handle any speed
conversions but buffering issues (just
32 bytes) may arise in some configurations. EXPERIMENT!
Application
Solderless prototyping (with the PICAXE-08M in its now standard breadboard
layout) suits HM-TR evaluation. Add-on transducers, such as a DS18B20 or
LDR, can easily be monitored as well. Two identical set-ups are needed for halfduplex operation.
“high” negative RS232 voltage can’t
be handled at all.
Consequently, TTL serial data requires logic level conversions when
presented to an RS232 interface and
lows and highs also must be inverted,
meaning logic 1 becomes 0 and vice
versa.
RS232-TTL level converting circuits
abound, with TI/Maxim’s purposebuilt MAX232 16-pin dual driver/
receiver IC long recognised as the
standard approach (see Fig.2). However, this high-performance IC can be
an overkill for pedestrian needs such
as ours, especially since we’re only
occasionally dealing with a handful
of settings at 9600 bps.
As only half the MAX232 is needed
for the HM-TR/TTL set-up, Maxim’s
8-pin DS275 line-powered RS232
transceiver IC may appeal instead.
This derives power from the data
line itself and provides a lower cost
and extremely low-power serial port
interface.
Of course, such specialised ICs are
often just the thing that your stockist
will be fresh out of when you want
one!
Rest easy: numerous discrete conversion “poor man’s” workarounds
have evolved, typically using NPN/
PNP transistors or 2N7000 N-FETs.
The simple 2 x NPN discrete approach
86 Silicon Chip
suggested by a fellow Kiwi has shown
itself to be very effective and should
appeal to those on skinflint budgets
(see Fig.3).
Inverting the logic sign can be easily
handled during later PICAXE HopeRF
TTL communications with T2400
“true” style signals (which idle high),
rather than N2400 “inverted” serial.
PICAXE serial code will then be in the
form SEROUT 2,T2400,b0.
Because set-up of the TTL HM-TR’s
may be just an infrequent need, it’s
suggested that a simple dedicated
programming breadboard be used.
Final RF PC board circuitry can have a
6-pin in-line socket fitted for the HMTR, allowing the data transceiver to be
lifted out and configured externally on
this breadboard as needed.
Such a versatile approach additionally allows use of new software that’s
on HopeRF’s menu.
The HM-TR setup program (recently
upgraded to Ver 1.1 and now featuring
English as the default language), can
be downloaded from their website
www.hoperf.com/rf_fsk.asp
Aside from occasional reports of
these HM-TR modules resetting themselves (perhaps due to power supply
removal during data handling) and
thus needing reprogramming anyway,
numerous “cut and try” transceiver
set-up tweaks are available.
Naturally these TTL units could
be just used as a convenient “one
stop” package for either simple data
transmission or reception but their
unified capabilities are better suited
for something more demanding than
such simplex work!
Two transceiver units set up identically can enter into a half duplex relationship, much in the classic two-way
radio, one-at-a-time style of “Hello 1
this is 2, can you hear me, over”.
Abundant scope exists for considerable half-duplex tinkering of course,
just as in the radio analogy where
issues such as band watching, time
scheduling, power supply drain, interference and simultaneous use of
the channel may arise.
The introductory example shown
here, using a popular high-level PIC
AXE-08M microcontroller, involves
sending a simple transmitter beacon,
composed of the usual SEROUT
ASCII “U” (10101010) wake-up and
a qualifier (“ttl”). When the PICAXE
controlled receiver awakens and receives this, an acknowledgement is
sent in return.
At this point, the units swap roles,
with the original transmitter (and
PICAXE) then hibernating at µA
level currents. It’s quite entertaining
to watch the units talking to each
other “ping pong” style like this but
serious data (such as temperatures
from a DS18B20) could instead be sent
and verified.
As the educational PICAXEs have a
non-timed-out SERIN command, the
units could hang up awaiting serial
data. A simple pre-data alert has been
instigated with the PULSIN command,
siliconchip.com.au
as this pulse-measuring command
usefully does time out.
In the code example shown, the
duration is of trivial interest, as it’s the
complete absence of any pulse that’s
being used to cycle the beacon loop.
Only when something is detected
does the program move to SERIN data
reception.
Naturally, the approach is not foolproof as it stands, since 433MHz
channel noise may be interpreted as
a data signal.
Scope may exist to define the PULSIN variables exactly for the nature
of the data. Both units by chance may
just fall into SERIN at the same moment, perhaps if one is moving, thus
uselessly awaiting signals from each
other as well.
Discharging a supply capacitor resistor combination, so that a PICAXE
reset eventually occurs, may help
break out of this. A 1µF capacitor and
1MΩ resistor have a time constant
(CR) of 1s, so after five time constants
(5s) the capacitor will be virtually
discharged – this is explored in a
case study.
As well as such explorations, readers are encouraged to modify the
example with suitable SLEEP and
PAUSE commands, in a quest to perhaps minimise supply current drain.
The exact approach depends on
16
1 F
2
4
1 F
D9 SERIAL
TO PC
RUNNING
HOPE-RF
HM-TR
SETUP
PROGRAM
9
8
7
6
1
2
3
4
C1+
C1–
V2+
MAX232
5
RS-232
+
V+
V–
C2–
1
3
6
4.5V
--5V
SUPPLY
13
12
14
11
7
10
DTX
9
DRX
TTL
CMOS
8
5
ON
1 2 3 4 5 6
1 F
15
Fig.2: initial TTL transceiver set-up requires logic level conversion, readily
handled by a standard MAX232. The normal PICAXE 3-wire programming
lead can be used.
Fig.3: TTL-RS232
level conversion/
inversion can
also be simply
achieved with two
NPN transistors
such as BC547s.
Resistor values are
not critical, with
typical PICAXE
“junk box” values
just used here.
Refer to the
resource website 330
for a breadboard
layout.
SUPPLIED
“RUBBER DUCK”
ANTENNA
ON
HOPE-RF HM-TR
ANT
UHF DATA TRANSCEIVER
TTL VERSION (NO MAX-232)
1 2 3 4 5 6
4.5V
CON1
D9 (TO
PC SERIAL
PORT)
330
10k
B
GP NPN
TRANSISTORS
HopeRF’s upgraded
set-up utility
now has English
default and a
progress panel.
Serial at 2400,8,N,1
with narrow TX
deviation and wide
RX bandwidth
was used but
experimentation
is encouraged!
Slower “on air”
data rates may give
greater range.
siliconchip.com.au
ANT
HOPERF HM-TR
UHF DATA TRANSCEIVER
(TTL VERSION - NO MAX232)
1 F
C
C
E
E
1
2
3
B
10k
4
5
9
8
7
6
SERIAL
PROGRAMMING
LEAD
the application, as a battery-powered
receiver could be hibernating for
many hours, while a mains-powered
transmitter (with no battery concerns
and drawing ~30mA) could be sending
beacons frequently.
Low duty cycles are typical with
wireless telemetry in fact, as temperatures, humidity data or water levels
may only change slowly. Perhaps data
may even be stored in non-volatile
memory for “store and forward” bulk
sending when convenient.
In such a case, receiver batteries
may last years (approximating shelf
life) or a simple solar panel energiser
SC
could be used.
Resources, code and case studies are
hosted at www.picaxe.orconhosting.
net.nz/hoperf.htm
April 2009 87
|