How to Add Web Access to Your Smart Device

“Originally appeared in Sensors Magazine, (C)2002 Advanstar Publications”

You can turn your product into an Internet appliance with an embedded modem.

Perry S. Marshall, Perry S. Marshall & Associates

Your Options
  • Traditional hardware modems
  • Win modems
  • Embedded modems

A vending machine transmits a refill request for 7 UP cans. A postage meter debits the customer’s account remotely. The refrigeration system in a convenience store reports low lubricant levels to an outsourced maintenance crew. An electric submeter tracks energy consumption and transmits a usage profile to the utility every night.

In the old days, you might have done those jobs with two modems – one in the device to send the data, the other at the home office to receive it. There was no connection to the Internet, just two devices talking to each other over the phone lines. But what if you’ve got 1000 postage meters, convenience stores, or utility customers? Do you need a boatload of modems at headquarters and a staggered access schedule? Not anymore.

Click for larger image

Figure 1. Internet-enabled modems require added internal complexity but make possible worldwide communication via local Internet service providers.

An Internet modem combines familiar modem circuitry with built-in Internet protocols, so the listening end can be a Web server, via your local Internet service provider (ISP), instead of another modem. The device opens up a world of possibilities for reYote data acquisition while minimizing cost with mature modem technology (see Figure 1).

If you produce smart devices, you can now drop an Internet modem into your design for under $100, and perhaps a lot less. It won’t tie up your processor’s bandwidth, and you don’t have to learn a bunch of network protocols.

What Kind of Device Needs to Use the Web?

The consumer market offers a growing list of Internet appliances, such as e-mail readers, Web radios, and the ever-popular TiVo (a video recorder, with an embedded PC, hard drive, and Linux operating system, that can simultaneously play a program and record another). But any device that must send data to a remote location occasionally or sporadically and that stays in place long enough to be plugged into a phone line is a candidate for an Internet modem.

Appliances can request periodic maintenance or report emergencies, service machines can bill customers and send usage statistics, credit card terminals can batch the day’s transactions, and blood analyzers can report abnormal readings. Bar-code readers can access faraway databases, and industrial controllers can download updated programs. Could your product be next?

Why Complicate Things with the Internet?

Modems have been around for years, but Internet modems are a new breed that adds a layer of complexity – the Transmission Control Protocol/Internet Protocol (TCP/IP) and the Point-to-Point Protocol (PPP) – to the design. Why bother?

Internet modems simplify your life and invite the use of standardized data formats. Two modems talking to each other over a long-distance phone link often use poorly documented, proprietary data formats to send data. With Internet protocols, however, smart devices can send e-mail messages or serve up Web pages, making life much easier for your customers.

The Web Is More Reliable

On the morning of September 11, telephone switchboards in New York were jammed, but e-mails were still going through, even at ground zero. Why? Telephone connections devote exclusive bandwidth to each conversation, but the Internet breaks data into pieces. It divides available bandwidth more or less equally among all contenders.

When many devices have data to transmit, a single point-to-point connection has finite capacity. TCP/IP packet switching is more flexible – rather than one device getting wide-open access, many devices share small slices. A smart product that dials a local ISP not only has easier access to the host server but also sidesteps long-distance charges.

Make vs. Buy

Because Internet modem technology is not the least bit bleeding edge, many engineers will be sorely tempted to roll their own solution. There’s no question that you could do it yourself, but do you really want to?

“Modems are not something you really want to design from scratch,” says John Rinaldi of Real Time Automation, an embedded network design firm in Milwaukee, WI. “The technology has been pretty well researched. They’ve wrung the cost and bugs out of modem design selling millions of PCs. Testing and certifying a modem can also be costly. So at this point, it’s better to use an existing solution.”

The hardware design is a cookbook process, but programming the software, incorporating the PPP modem protocol, and linking the software and protocol to a TCP/IP stack can easily consume a person-year or more. Engineering time costs money, but possibly more significant is the opportunity cost””how much money does your company lose by not having the hot new product available?

When you’re planning to add a relatively mature, stable technology to your product, outsourcing is almost always better than reinventing the wheel. Focus your engineering efforts on your core competencies, and leave the rest to someone else.

Hardware, Win Modems, and Embedded Modems

A modem in a PC has a luxury that an embedded modem does not: a Pentium processor nearby. In the past three years or so, most modems have taken advantage of this fact and omitted a number of expensive circuit-board components (e.g., DSP chips) and replaced them with software that runs on the host processors. These are called Win modems, in contrast to traditional hardware modems, which offer better performance at a higher price.

These days, you can purchase a Win modem for your PC for about $30; a true hardware modem costs close to $100 at retail. This price difference has implications for embedded product design because smart devices normally aren’t endowed with a Pentium-class processor.

You can process signals and run TCP/IP software on the existing processor and interface directly to a modem chip. Or you can reach the same end by using a coprocessor and simply sending it commands and data via serial or parallel ports. In some cases, using the existing processor is less expensive, but it certainly incurs more development cost and imposes significant demands on your processor.

Because most embedded devices don’t have lots of extra processor power lying around, many designers opt for a modular design, which performs modem and TCP/ IP functions in separate components.

Software Components

As with most embedded systems, the hardware in this application is relatively straightforward. On the other hand, you can agonize endlessly over software details. In addition to standard modem functions, an Internet modem has two major software components, TCP/IP and PPP.

TCP/IP is the basis of Internet communications, the mechanism that ensures that data on the Web reach their destination complete and intact. TCP/IP is not a single protocol but actually an extensive family of protocols, such as Hypertext Transfer Protocol (http) for Web pages, File Transfer Protocol (FTP), Simple Mail Transfer Protocol (SMTP) for sending e-mail, and Post Office Protocol (POP) for retrieving it.

TCP/IP is quite complex, and although it’s available in Windows and open-source versions (e.g., Linux), porting it to a small microprocessor involves considerable effort – or else licensing fees.

The Internet Modem Module (IMM), a modem on a circuit board (see the sidebar “A Tale of Two Modems”), takes a different approach. It uses Seiko’s iChip, which implements TCP/IP in a hardware-based state machine rather than in software running on a microprocessor. Chips of this kind started appearing about a year ago, and they offer several advantages to the traditional hardware/software scenario. They consume less power, operate at line speed with no processing delays, require no external memory, and free you from the need to do any programming.

PPP is a protocol for communication between two computers using a serial interface, typically a personal computer connected by phone line to a server. PPP is implemented as a subset of TCP/IP and allows simultaneous communication in both directions.

Certification

A key issue when designing a modem is obtaining certification from the FCC. All modems must pass FCC Part 68 before they can be sold.

The test is strict, and designing a modem from scratch invites the distinct possibility of spending months reworking the circuit until the test is passed. Using an off-the-shelf design, which has already been certified, all but guarantees that your product will pass the first time.

Choosing an ISP for Your Smart Device

If you want Internet access for your smart device, you don’t have to use MSN or AOL and pay $20 per month or more. You can contact small and mid-size local ISPs for dial-up accounts with a few hours’ usage per month, and if you are deploying hundreds or thousands of smart devices, you can negotiate low-volume prices.

The price of dial-up service certainly factors into the cost of ownership of an Internet appliance. Fortunately, there are services designed for appliances that connect for only a few minutes per day. Internet modem manufacturer Cermetek offers dial-up service across North America by contracting with the same facilities that are used by large ISPs. Cermetek charges $2 per month and offers text-to-voice conversion and call forwarding for an additional per-call charge. That means your device can dial up the ISP and e-mail an emergency text message or send a cellular phone message that notifies your maintenance manager of a problem. Other companies, such as Ziplink, function solely as ISPs and cater to manufacturers of smart devices and resellers of Internet service.

Independent ISP connections require only a phone number, user name, and password from a connecting device. At that point, the kind of device dialing in, PC or otherwise, makes no difference.

An Internet appliance can share a phone line with other devices (including telephones) as long as it’s acceptable if the line is busy at times. The Internet appliance can share the dial-up account with other smart devices as long as only one unit is dialing in at any one time.

Encrypting Your Data

The traditional telephone connection to the home office is appealing because of the built-in security, but the security problem can be solved on the Internet with a virtual private network (VPN).

A VPN uses encryption at each access point to keep data secure, despite its use of publicly available communication channels (e.g., the Internet). Certainly some smart devices will need data security, and there’s nothing to prevent you from encrypting your data at both ends and creating a VPN yourself.

International Modem Standards

Vendors who sell internationally will generally have no problem with technical standards in Asia and South America, as long as they conform to FCC Part 68. Europe can be troublesome, though, because some European countries follow a standard called TBR21, which involves different impedance terminations than the U.S. standards. Spotty performance sometimes results if the modem is not expressly designed for this purpose.

Changes to the data-access-arrangement circuitry solve this problem. The larger issue, however, is import regulations because TBR21 is used as a trade barrier by some countries. In any case, checking with your vendor and gaining full understanding of these issues is a good idea.

SIDEBAR:

A Tale of Two Modems
photo

Photo 1. This tiny modem, which can be embedded in a smart appliance, dials a local Internet service provider and handles TCP/IP Internet protocols. It enables your device to send and receive e-mail and transfer files via simple commands through a serial port. The design is available as a drop-in daughterboard or as a complete schematic that can be pasted into your hardware design, complete with downloadable firmware.

Seiko, iReady, and TDK collaborated to develop the Internet Modem Module (IMM), a modem that can be purchased either as a plug-in daughterboard or as a component-level design that can be incorporated into customers’ products by using off-the-shelf parts (see Photo 1). The modem runs at 300-2400 baud (bits per second) and plugs into the Conexant Socket Modem format, an industry-standard footprint for embedded modems. Unlike most modems with this form factor, the IMM has TCP/IP built in. The unit also has field-upgradable firmware and nonvolatile memory for parameter and script storage. The circuit board is only 27 by 65 mm (1.1 by 2.6 in.) and is available as a complete board assembly. You can download the reference design and software from Seiko at no charge. The modem works with 3.3 and 5 V circuitry.

Many designers will incorporate the circuit into their own circuit board rather than use a plug-in daughterboard. Seiko facilitates this by providing a complete hardware design and bill of materials with downloadable firmware. According to George Ho, technical marketing manager at Seiko Electronic Components, good hardware engineers can have this circuit incorporated into their designs in 30 days or less. He notes that use of a different modem IC permits operation up to 56 K baud.

The IMM has a standard serial port and a parallel port. Any device capable of emulating terminal commands with a serial port can be linked to the Internet with this modem, whether it’s a PC or a small device, such as a thermostat.

All devices on the Internet must have an IP address, a 32-bit number written in the following form: 192.168.112.255. You can program the IMM with a fixed IP address, or it can accept an IP address from the host via the dynamic host configuration protocol (DHCP). DHCP is a way of temporarily assigning an IP address to a device each time it dials onto the Internet.

Applications send data over TCP/IP by opening and closing designated ports and sending or receiving data. The modem receives standard AT Modem commands from the device and can dial up, send a user name and password, and initiate communications.

The following text is an example of how an Internet appliance talks to the IMM via its serial port:

    ATDT14085554565
    CONNECT
    IRC1 username,password
    CONNECT
    IRT0 mycal.net:25
    CONNECT
    220 mycal.com ESMTP Sendmail 8.9.3/8.9.3; Tue, 6 Aug 2001 15:27:02
    -0800
    HELO remotedevice.iready.org
    250 OK
    MAIL FROM:
    250 OK - mail from < [email protected]>
    RCPT TO:
    250 OK - Recipient
    DATA
    354 Send data.  End with CRLF.CRLF
    Subject: Hello Sensors Magazine Readers

This is the body of the e-mail. There could be lots of data here or even a base 64 encoded binary file or other mime encoded data.

    250 OK
    QUIT
    221 closing connection
    NO CARRIER
    IRD
    OK

If you ever dialed up a bulletin board service in the days before the Internet, you probably saw AT terminal commands that looked similar to this.

From the phone line to the appliance, the signal path looks like this: After the analog telephone signals pass through an isolation circuit, the modem chip translates them into digital data. The modem chip interfaces to Seiko’s iChip, which implements TCP/IP in hardware instead of software. Thus, it can perform a complex task without using an expensive processor, RAM and ROM, or a complex software stack. Data are then passed to an 8-bit microcontroller with built-in FLASH memory. This chip greatly simplifies the interface to the iChip, so instead of reading and writing to dozens of specific registers, all you have to do is send simple terminal commands.

These three chips, together with passive components (e.g., transformers, crystals, and resistors), complete the circuit design (see Figure 2).

figure

Figure 2. The Internet modem controller is omitted in a standard-type modem, and its function of supporting TCP/IP can be handled by the host instead. On the other hand, Win modems omit the modem chip and replace it with software. But this is practical only in a PC.

List price for the complete modem assembly is $99, with discounts available for volume buyers. The bill of materials cost for the components in the reference design is about $35. Further information is available at www.iready.com and www.seiko-usa-esd.com.

Cermetek makes a family of standard and Internet embedded modems from 300 to 56 K baud. Their 2160 is designed for harsh environments, with an option for extended temperature range (-40 C to 85 C), and it is epoxy potted for environmental resistance. This unit has TCP/IP capability built in, and in 1000-unit quantities costs $70. A version without TCP/IP, the 2156, costs $65. A unit that handles up to only 2400 baud is considerably less expensive at $40. These units are entirely self-contained and as such allow you to bypass FCC certification. Dimensions are 50 by 36 by 14 mm (1.97 by 1.40 by 0.54 in.).

SIDEBAR:

Web-Enabling Your Device Without Dialing Up
photo

Photo 2. The CoBox Micro, an embedded device server from Lantronix, fits inside any product that has a serial port and converts data to Ethernet and TCP/IP formats.

Sometimes a telephone line is not your best option. These days, most businesses have an Ethernet local area network with high-speed Internet access. If there’s an Ethernet jack on the wall, then a Device Server (a trademark of Lantronix, Inc.) will most likely provide faster data transfer and easier connectivity than a modem will””and you needn’t bother with ISPs.

Many of these devices are available from such companies as Lantronix, FieldServer Technologies, Equinox, and Moxa (see Photo 2). They are simply small circuit boards or black boxes with an RJ-45 Ethernet jack on one side and an RS-232 port (9-pin D shell) on the other. Your embedded device handshakes over the serial port, and the device server puts the data into TCP/IP packets and sends them via Ethernet.

This approach has several advantages, compared with Internet modems. First of all, your device doesn’t usually have to be specifically programmed to talk to the device server. As long as your product can talk to a standard COM port on a PC, then a device server extends that connection transparently through the Internet. The device thinks it’s connected directly to a PC’s serial port even though the PC is physically on the other side of the world (see Figure 3).

figure

Figure 3. Device Servers enable common devices with RS-232, RS-422, or RS-485 ports (e.g., data loggers) to send their data over Ethernet or the Internet. They can take the form of external black boxes or embedded circuitry in the product itself.

If the device doesn’t support COM ports, it can be programmed to open and close communication sockets according to the device server’s specific programming interface.