 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Total Units Connected: 1168 |
|
Getting Started with an SPE
This document is intended to help new users get up and running
with a Harvest Serial Port Extender (SPE).
The idea is to set up the network and an SPE, simulate a remote
device by sending serial data, and then have the SPE send that
data back to your own computer via the GPRS network.
What You Need
- A Harvest SPE with a power supply
(5–30V DC for a standard SPE), antenna, and
debug cable. This document assumes you have one of our newer g20/g24
SPEs, but an older g18 SPE will work just as well.
- A SIM card. Usually you can get a SIM card
from your GSM network operator. The SIM must have GPRS enabled
and be set up with an internet APN (Access
Point Name). Some providers can also set up private
APNs—especially useful if you need static IP (internet
protocol) addresses or more secure communication. Various
international providers and their APN names can be found in this
handy table.
- A PC with a serial port and a DE9 (9-pin D-connector)
serial cable. Many desktop PCs have built-in RS-232 serial ports
(e.g., COM1), but if not, you can easily use a USB-to-serial
converter.
- A terminal program, used to simulate a
remote serial device, e.g., a data logger. Harvest's SPE-friendly
terminal program works nicely, and it's available as an
executable or a
zip file. HyperTerminal, which comes
with Windows, also works, but it's usually harder to set up and
use.
- Our UDPTerm program, available as an
executable or a
zip file. Among other things,
UDPTerm displays the packetised data from the SPE, and
allows you to talk back to the remote device (in our case,
the terminal program).
Network Setup
- Check IP data path. You need to make sure
you have an IP data path from the internet (and therefore the
SPE) back to your PC. The SPE communicates using UDP (User
Datagram Protocol) and, by default, ports 7777 and 7778. Usually
this is not a problem if you use a dial-up modem, but a broadband
router or a larger company may have a firewall to block these
ports. You'll either have to unblock these UDP ports or try to get
your IT department to forward the ports through to your computer.
Failing that, try using a dial-up modem.
- Dial up. If you're using a dial-up modem
or a VPN (Virtual Private Network with your own APN name),
connect now.
- Find your computer's IP. In Windows, you
can get your computer's IP address by pulling up a command prompt
(go to the Start menu, select Run, then type cmd)
and typing ipconfig. Now read off the appropriate
IP address. If you're using an external router, you'll have to find
the router's IP address (which may change each time you connect).
Or, if you're part of a company network, you'll have to ask your
IT department what your external static IP address is.
SPE Setup
- Insert the SIM card. On g20/g24 SPEs, the SIM
carrier next to the g20/g24 module flips up to allow insertion. On
g18 units you must slide the SIM under the g18 module, contacts-up,
in the orientation outlined on the SPE board.
- Connect the antenna. On most SPEs, the
antenna connector is on the end opposite the green and red LEDs.
- Connect the power. The power connector is
located between the LEDs and the RS-232 serial connector. Just
after you connect the power, both LEDs should light up for about
five seconds.
- Talk to the SPE. Run Harvest's terminal
program. If you're using COM1 you can just double-click on
terminal.exe. If not (say a USB-to-serial
converter using COM4), you'll have to pull up a command prompt
and type terminal COM4. Pressing
Alt-H will send an SPE hangup sequence,
ensuring you can send commands to it (see note below). You should
soon see a string of characters including AT^HESC and ending with OK.
Try typing AT^HSN to ask the SPE to
give you its Harvest serial number. (Note that you must press
Enter after each command. Successful commands
respond with OK.)
- Set the APN and remote IP. First set the SPE's
APN name by typing
AT^HAPN="name", where
name is the name of your provider's internet APN, e.g.,
AT^HAPN="www.vodafone.net.nz".
Then set the remote IP by typing
AT^HRIP="address",7777,
where address is the IP address of your computer
as above, e.g.,
AT^HRIP="210.55.68.147",7777.
If you receive OK after entering both commands, your
SPE is ready to go.
- Set username and password if needed. Some
providers require a username and password with certain APNs. If
you need them, use the
AT^HUSER="username" and
AT^HPASS="password"
commands.
Note: If you're using another terminal program such as
HyperTerminal, you'll have to set the baud rate to 9600, and
you may have to enter the SPE escape sequence before you can
talk to it. You do this by typing
AT^HESC (all caps, no spaces).
Your First Call
- Setup UDPTerm. Start
udpterm.exe and go to Options menu and then
Settings. The default settings should be fine, but check to
make sure: Local IP address set to 0.0.0.0, "automatic
remote IP and port numbers" boxes ticked, and local data and
control ports set to 7777 and 7778, respectively. Note: If
you have multiple network connections (like dial-up and
local area network) you may need to set UDPTerm's local IP
field to your computer's local IP address.
- Make a call. Go back to the terminal
program and type ATD499 to ask
the SPE to connect to the GPRS network. You should see
CONNECT almost immediately, and once it's connected, you
should see COM, as well as the green light. If it
doesn't work, you won't see COM and you might get a red
light—check the SIM card, the antenna and coverage,
and ensure the APN was set correctly above.
- Send some data. Once you see COM, type
any string, e.g., Hello world! The SPE should
convert this string to IP packets and send them to your PC
via the GPRS network. If all is well, you'll now see
"Hello world!" appear in UDPTerm's Data Port window.
If the data doesn't come through, check that you're connected
to the internet and make sure your firewall isn't blocking port
7777. You might also check that the remote IP address was set
correctly above.
- Send data back. To send data back to the
SPE, simply type something in UDPTerm's Data Port window.
The data should go via the SPE to the "remote device",
that is, it should appear in the terminal program. On most
GPRS networks, you must not wait too long before sending data
back (Vodafone New Zealand has a timeout of 60 seconds).
- Try an SPE command remotely. Type
AT^HVER in UDPTerm's Command Port
window. Data typed here goes not through the SPE but to the SPE
as a command. You should soon receive the SPE's software version
and OK in response.
What Next?
Now that you have a basic SPE setup working, you'll want to
tailor it to suit your needs. Here are some of the
SPE commands you're likely to
use:
- AT^HBPS to set the bit
rate and character format the SPE will use to talk to the
serial device (the DTE).
- AT^HPFC and
AT^HPTO to tell the SPE
how and when to assemble data from the DTE into packets.
- AT^HPOC to get the
SPE to automatically connect whenever DTR is asserted (e.g.,
whenever the DTE has data to send).
- AT^HASE and
AT^HAFS if you want to
send a custom announcement whenever the SPE makes a call.
- AT^HSCO and
AT^HSCT to configure when
the SPE will make calls.
- AT^HLPM to turn on
low power mode for battery-powered applications.
- AT^HVER to read
the SPE's software version,
AT^HSN to read its
Harvest serial number,
AT^HSAS to show all
its settings, or
AT^HRST to reset all
settings to their factory defaults.
For more information, see our other SPE
technical information. If you get
stuck, don't hesitate to
contact us.
Debugging
If at any point something doesn't work, you can often
get more information from the SPE's debug port. This is the
boxed three-pin connector next to the lithium coin cell.
Simply connect the debug-to-DE9 cable we provide to a spare
serial port on your PC (if you don't have a spare serial port,
you'll have to use a USB-to-serial device). Then run another
copy of your terminal program with the correct COM port at
9600 bps (e.g., terminal COM4).
Plug in the debug cable, run the terminal program, then
power up the SPE. You should see a bunch of
debugging messages when the SPE
turns on as well as when it tries to connect.
Note: On older, g18 SPEs you'll need one of our programming
adaptor boards, but you can use the terminal program in
the same way.
|