This is only a preview of the June 2019 issue of Silicon Chip. You can view 39 of the 112 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 "An AM/FM/CW Scanning HF/VHF RF Signal Generator":
Items relevant to "e-Paper displays: no paper involved!":
Items relevant to "Steering Wheel Audio Button to Infrared Adaptor":
Items relevant to "Very accurate speedo, car clock & auto volume change":
Items relevant to "DSP Active Crossover and 8-channel Parametric Equaliser, part two":
Items relevant to "El Cheapo Modules: Long Range (LoRa) Transceivers":
Purchase a printed copy of this issue for $10.00. |
Using Cheap Asian Electronic Modules by Jim Rowe
434MHz LoRa
Transceivers
This month we’re looking at two LoRa
modules based on the SX1278, a
complete wireless data modem/
transceiver capable of data rates
up to 300kbit over modest distances
in the 434MHz band. These can be
controlled from a micro using an SPI
or UART serial interface.
C
onnecting a couple of computers,
Arduinos, Micromites or other
micros via a UHF wireless data link
is easy if you use a pair of low-cost
modules based on the SX1278 ultralow-power LoRa modem/transceiver
chip. The SX1278 is made by Semtech
Corporation of Camarillo, Southern
California, which acquired the patented LoRa technology from French
firm Cycleo in 2012.
The name “LoRa” is a contraction
of “Long Range”. It is a wireless technology developed to enable low power wide-area networks (LPWANs) for
machine-to-machine (M2M) and Internet of Things (IoT) applications.
The exact details of the technology
are proprietary and closed, but it’s
apparently based on spread-spectrum
modulation.
The SX1278 is designed to operate
in the UHF spectrum between 410 and
525MHz. This makes it suitable for
use in the 433.05-434.79MHz ISM (Industrial, Scientific and Medical) band
which is available for license-free use
in most countries. In Australia, this is
called the LIPD (Low Interference Potential Devices) band.
The SX1278’s data sheet can be
found at siliconchip.com.au/link/aao3
88
Silicon Chip
Note that in Australia, the maximum
transmitter power (EIRP – equivalent
isotropically radiated power) for unlicensed devices in the LIPD band is
25mW or +14dBm. Transceivers with
programmable output power will need
to be configured to stay under this limit
to remain legal.
There are two different SX1278based LoRa modules currently available. One is the RA-02, designed by
AI-THINKER, which is available from
Banggood (siliconchip.com.au/link/
aao7) and various other suppliers for
around $6.60 each. The other is the
E32-TTL-100 from eByte, also available from Banggood (siliconchip.com.
au/link/aao8) and other suppliers for
around $13.50 each.
So the RA-02 is around half the cost
of the E32-TTL-100, and as you can see
from the photos, it’s also much smaller
at just 16.5 x 16 x 3mm compared with
34 x 21 x 4mm for the E32-TTL-100,
not including its SMA RF connector
or its 7-pin SIL header. But the RA-02
has some disadvantages, too.
One of these is that the RA-02 module’s tiny PCB is designed to be surface-mounted on another PCB. So instead of providing a pair of 8-pin SIL
headers with standard 2.54mm pin
Australia’s electronics magazine
spacings for power and control, it has a
row of eight semicircular indentations
along each side, with each one gold
plated to allow soldering to matching
pads underneath.
The spacing of the indentations
is 2mm, so they do not line up with
pads on the common 2.54mm (0.1inch) grid.
Many constructors would therefore
want to solder the module to an adaptor PCB, to bring all of the connections
out to a pair of 8-pin SIL headers.
Another less attractive aspect of
the RA-02 module is that its RF output/input connector is the extremely
small U.FL-R-SMT coaxial type, with
an outer diameter of only 2mm.
You will need a matching U.FL-LP
plug to mate with it, which in most
cases, comes as part of a complete antenna/cable assembly. It would not be
easy to fit such a tiny plug to an existing cable.
So the RA-02 module is probably
best suited for use in commercial type
applications, especially those which
will be assembled using automated
pick-and-place equipment.
On the other hand, the E32-TTL-100
module is more suited for breadboarding, testing and manual assembly.
siliconchip.com.au
Fig.1: block diagram of the SX1276-SX1279 range of LoRa ICs. Even though there’s an upper UHF front end shown in
cyan, the SX1278 only uses the lower band (yellow) from 137-525MHz.
The RF input/output is via an SMA
connector on one end of the module,
with all of the remaining connections
made via a seven-pin SIL header at the
other end.
While we will focus on using the
E32-TTL-100 module, we’ll still provide a quick rundown on using the
RA-02.
Since both modules are based on the
SX1278 chip, let’s start by looking at
the chip itself.
Inside the SX1278
Fig.1, the simplified block diagram,
shows what’s inside that compact (6 x
6mm) 28-pin QFN chip. Note that this
diagram covers all four of the different
devices in Semtech’s SX127X range,
not just the SX1278.
The SX1278 is a single-chip UHF
wireless data transceiver combined
with a data modem capable of modulating and demodulating LoRa spreadspectrum signals.
But it supports other kinds of modulation too, including FSK (frequencyshift keying), GFSK (Gaussian FSK),
MSK (minimum shift keying), GMSK
(Gaussian MSK) and OOK (on-off keying).
The term ‘Gaussian’ in GFSK and
GMSK signifies that the modulating
data is passed through a Gaussian filter to make the transitions smoother
siliconchip.com.au
before modulation. GFSK modulation
was the original type of modulation
used in Bluetooth, and is still used
in BR (basic rate) Bluetooth devices.
Fig.1 shows the SX1278’s SPI interface at far right, which allows it to be
fully configured by a microcontroller.
Although two separate UHF front
ends are shown at far left, one for HF
and one for LF, the SX1278 only uses
the LF front end as its specified frequency range is 137-525MHz. It can
be programmed for a spreading factor of 6-12.
So the main sections of Fig.1 which
are relevant to the SX1278 are the LF
front end at lower left, with its fractional-N PLL (phase-locked loop) driving
the two quadrature (I and Q) mixers,
plus both sections of the fancy modem
at top centre-right.
The modulator section is shown
tinted blue, while the demodulator
section is tinted orange.
The SX1278 can operate at data rates
up to 37.5kb/s, but in the 434MHz
LoRa modules, the maximum recommended rate is 9600 baud, or 2400
baud for maximum reliability.
The transmitter in the SX1278 has
a rated maximum power output of
100mW (+20dBm), but can be programmed to provide lower output
levels: +17dBm (50mW), +14dBm
(25mW) or +10dBm (10mW). For legal
Australia’s electronics magazine
use in Australia, the 25mW and 10mW
settings are possible.
Reception sensitivity of the SX1278’s
RF front end is rated at -148dBm,
which corresponds to about 10nV at
the input. As a result, SX1278-based
modules are often described as having a reliable communication range
of 3km.
However, this assumes that they are
set for an output power of 100mW,
have a 5dBi gain antenna, a clear lineof-sight path between them and are
operating at 2400 baud.
In Australia, with a maximum output power of 25mW (taking into account the antenna gain), this range
drops to around 1.5km. And remember
that this is for a clear line of sight path
with a high-gain antenna and a data
rate of 2400 baud. So in many cases,
you’ll be doing well to get a range of
1km, but that’s still quite useful.
Despite its internal complexity and
multiple functions, the chip is relatively economical in terms of power
consumption. Operating from a 3.3V
DC supply, it draws less than 100mA
in transmit mode (at the 100mW setting), less than 13mA in receive mode
and less than 2mA in standby mode.
eByte’s E32-TTL-100 module
As mentioned earlier, the E32TTL-100 has a UART/USART serial
June 2019 89
The E15-USB-T2 serial port adaptor module connects
to the E32-TTL-100 via a 7-pin female header and lets
you plug the module into a computer and program it
using software such as AccessPort.
interface. This is provided by an STMicro 8L151G 8-bit ultra-low-power
microcontroller that’s inside the 21 x
18 x 2.5mm shield on the top of the
PCB, along with the SX1278 chip.
The result is that it’s somewhat easier to program and use this module, as
we’ll see shortly.
We couldn’t find an internal circuit
diagram for the E32-TTL-100 module,
but there is a 14-page data sheet available for the module which describes
how to program and use it: siliconchip.
com.au/link/aao4
The simplest way to use the E32TTL-100 module is to hook it up directly to a PC via a CP2102-based USBto-UART bridge. eByte makes a custom
bridge module for this job, called the
E15-USB-T2 serial port adaptor.
Measuring just 26 x 20mm, this PCB
has a type-A USB plug at one end and
a 7-pin SIL socket in the centre, into
which the E32-TTL-100 module can
be plugged (see photo above).
The E15-USB-T2 adaptor module is
available from AliExpress, Alibaba and
other suppliers, for less than $3.50. It
has a 3.3V regulator on the underside
plus a 3-pin SIL header on the top to
allow you to select either 5V or 3.3V as
the supply for the E32-TTL-100 module using a jumper shunt.
You can find four page data sheet on
the E15-USB-T2 at www.cdebyte.com/
en/pdf-down.aspx?id=761
There’s also another pair of 2-pin
SIL headers with jumper shunts to allow the voltages on the E32-TTL-100
module’s M0 and M1 mode select
pins to be set to either logic high or
90
Silicon Chip
low. There’s even a pair of tiny SMD
LEDs, indicating its status. Fig.2 shows
how the E32-TTL-100 and E15-USBT2 modules connect together.
Note that if your PC doesn’t have a
VCP (virtual COM port) driver already
installed for CP2102 based bridges,
you’ll need to install one to use this device (Windows 10 usually has this preinstalled). This driver can be downloaded from the Silicon Labs website
(siliconchip.com.au/link/aalb).
You can then program the module and communicate via the LoRa
modules is by using a serial monitoring application like AccessPort 1.37.
This can be downloaded free from
https://accessport.en.lo4d.com/ Once
installed, it provides a very intuitive
way to either send or receive data to/
from the E32-TTL-100 module.
You can communicate using either
hexadecimal numbers or text characters; it’s best to use hex codes during
the initial set-up (with the M0 and M1
jumpers on the E15 bridge module unplugged), and then text characters for
normal airborne communication (with
the M0 and M1 jumpers fitted). Table 1
is a summary of the basic E32-TTL-100
set-up steps.
Once the module is set up, connect
a suitable antenna to the SMA socket
and then fit the M0 and M1 jumper
Fig.2: connection diagram for the E15-USB-T2 and E32-TTL-100 modules.
Attaching only jumper M1 puts the module into power-saving mode (closes
RXD), while only M0 starts wake-up mode (opens RXD).
Australia’s electronics magazine
siliconchip.com.au
Fig.3: connection diagram
for the E32 to an Arduino
Uno or similar.
shunts back to the E15 bridge module,
to switch the E32 module into Mode 0.
You need to do it in that order, because
the E32 module can be damaged if it’s
switched to Mode 0 before an antenna
is connected.
Selecting an antenna
If you’re not aiming for maximum
range, you could use one of the lowcost ‘rubber ducky’ antennas with an
integrated 90° SMA plug on the bottom, as shown in one of the photos. Go
for one of the longer ones if you can.
Alternatively, you could use one
of the longer ‘loaded whip’ antennas
fitted with a magnetic mounting base
and a 1.5m-long cable ending in an
SMA plug. These antennas are around
210mm long including the loading
coil, and are claimed to have an SWR
of less than 1.5 at 433MHz, together
with a gain of 3dBi.
However, this would not be legal to
use with the 25mW output power setting as it would exceed the unlicensed
EIRP limit. You could only use it with
the 10mW power setting, which would
reduce power consumption but also
give you shorter range than the 25mW
setting with a quarter-wave whip.
Loaded whip antennas are available from a few different suppliers on
the web, including Banggood, which
currently has them for about $5. Ensure you get one fitted with a stand-
ard SMA plug, not one with the more
common RP-SMA (reversed polarity)
plugs. The standard plug has a centre
pin to match the centre hole in the
module’s SMA socket.
Connecting it to an Arduino
Using the E32-TTL-100 module
with an Arduino Uno or similar is
fairly straightforward, as you can see
from Fig.3.
An LM1117T-3.3 regulator is used to
derive the module’s 3.3V supply from
the Arduino’s 5V line, because when
it’s transmitting, the module can draw
peak currents of over 100mA, which
is too much for the Arduino’s onboard
3.3V regulator.
Fig.4; connecting the E32 to a Micromite is nearly identical
to an Arduino except it doesn’t require two series 4.7kW
resistors on the RXD and TXD lines.
siliconchip.com.au
Australia’s electronics magazine
June 2019 91
Notice also that the module’s RXD
and TXD lines are connected to Arduino pins D11 and D10 via 4.7kW series
resistors, to prevent any voltage overswing problems.
In terms of software, you’ll find
Arduino libraries as well as self-contained sketches on sites like GitHub
(https://github.com/Bob0505/E32TTL-100). However, I ended up writing
my own self-contained sketch called
“Uno_sketch_for E32_TTL_100_LoRa_
module.ino”, which can be downloaded from the Silicon Chip website.
Using it with a Micromite
Connecting an E32-TTL-100 module up to a Micromite is again fairly
easy, using the connections shown
in Fig.4. Once again we’re using an
LM1117T-3.3 regulator to derive the
module’s 3.3V supply from the Micromite’s +5V line, for the same reason as
stated above.
We’re using a ‘software’ serial port
on the Micromite to communicate
with the module, to prevent any unforeseen interactions with the Micromite’s hardware (UART) serial port,
which is used to communicate with
the PC. That’s why the module’s RXD
and TXD lines connect to pins 9 and
10 of the Micromite, instead of to the
TX and RX pins.
I couldn’t find any pre-written Micromite programs to control and exchange data with the E32-TTL-100
module, so I had to write one. The resulting program is called “E32TTL100
LoRa module driving program.bas”,
and is available for download from
the Silicon Chip website.
Both programs are fairly simple.
They set up the E32-TTL-100 module
for legal use in Australia, then switch
it to Mode 0 for airborne data communications. It should provide a good
starting place for writing fancier programs of your own.
You’re not restricted to using this
program for LoRa communication between two Micromites. Since it sets
up the E32-TTL-100 module in precisely the same way as does the Arduino sketch (or the PC/USB/AccessPort approach, for that matter), all
three versions can communicate with
one another.
This means you can have a module
connected to a Micromite communicating with another connected to an
Arduino, or to another plugged into
the USB port of a computer.
See the E32-TTL-100 tutorial at
siliconchip.com.au/link/aao5
What about the RA-02 module?
As mentioned earlier, while the RA02 LoRa module (siliconchip.com.
au/link/aao6) is significantly lower
in price than the E32-TTL-100, it is
more difficult to solder and also needs
an antenna fitted with a tiny U.FL-P
connector. Also, you have to interface with the RA-02 via SPI as it does
not have an SPI/UART bridge like the
E32-TTL-100.
Regardless, use of the RA-02 with
an Arduino seems to be popular, and
you will find several Arduino libraries and sketches written to support it.
One popular Arduino library is written
by Sandeep Mistry: https://github.com/
sandeepmistry/arduino-LoRa
Before we could try out the RA-02
modules, we had to order some adaptor boards. The module is surface
mounted onto these adaptor boards,
and pin headers can then be soldered
along the edge, so it will plug into a
breadboard or another PCB using two
header sockets.
These adaptor boards are available
at low cost from AliExpress (www.
aliexpress.com/item//32825376146.
html). You can also purchase similar
Above: example screenshot of the output from AccessPort when connected to an
E32-TTL-100.
The RA-02 can be mounted onto a
simple SMD adaptor board so that it
can be easily attached to an Arduino etc.
92
Silicon Chip
Australia’s electronics magazine
siliconchip.com.au
Fig.5: connecting the RA-02 module to
an Arduino.
boards with the RA-02 module already
soldered to them (www.aliexpress.
com/item//32824507293.html).
We didn’t have any luck finding a
suitable 434MHz whip antenna already fitted with a cable ending in a
U.FL-P plug. But we were able to get
hold of a couple of adaptor cables with
an SMA socket on one end and a U.FLP plug on the other (www.aliexpress.
com/item//32467389771.html).
The adaptor cables are sold together with 800MHz whip antennas fitted
with an SMA plug, for around $1 each
(plus $7 delivery to Australia!). After
discarding the useless (to us) 800MHz
whip, we used these adaptor cables to
connect one of the ‘loaded whip’ antennas mentioned earlier to the RA-02
modules. Problem solved!
Fig.5 shows how to connect the
RA-02 to an Arduino Uno while Fig.6
shows the connections for a Micromite. The configuration shown in
Fig.5 suits Sandeep Mistry’s library;
you might need to change it if you’re
using a different library.
In both circuits, the RA-02 module
receives its 3.3V supply from a 3.3V
LDO regulator, fed from the micro’s 5V
output. Although the current drawn by
the RA-02 is significantly lower than
that of the E32-TTL-100, it still draws
enough when transmitting to cause
problems if powered directly from the
micro module’s 3.3V output.
With this arrangement, we made
two Arduinos communicate via RA02 modules using Sandeep Mistry’s
library. However, this does not work if
you replace one of the RA-02 modules
with an E32-TTL-100 module, even
when both have been set to operate at
434MHz. So you need to use the same
type of LoRa module at either end.
Our example sketch is named
“SCLoRaSend_and_Receive.ino” and
this is available for free downloading
from the Silicon Chip website.
We have also written a similar Micromite MMBasic program, called
“RA02 LoRa module checkout prog.
bas”, available on the Silicon Chip
website. Using this, we were able
to get two Micromites to communicate via RA-02 modules, and also exchange data between an Arduino and
a Micromite using two identical RASC
02 modules.
Fig.6: connection diagram for the RA-02
module to a Micromite. Again we’re using
an LM1117 to power the RA-02 because it
might draw more current than the Micromite’s
onboard regulator could possibly supply.
siliconchip.com.au
Australia’s electronics magazine
June 2019 93
|