Simple Arduino based Telnet Modem

Jump to: navigation, search


2018-01-20 18.10.27.jpg

The modem was built to allow an Apple II to be connected to a linux cluster but equally be used for accessing Telnet bases Bulletin Board Systems (BBS).

Please Note: Once I had a working modem, development pretty much stopped, as a result, the solution is not as slick as the WiFi modem and similar. However, it works and is shared here in case it is of any use. Feel free to amend and send me a pull request.

The source code (Arduino Sketch) is available at

The modem is based on cloned versions of the Arduino Uno and Ethernet shield. A serial port is attached to the GPIO (6 TX, 7 RX) using a MAX232 breakout board. Total cost for the hardware (excluding a case) was 12GBP (17USD).

The Telnet Modem is designed to interface a full-duplex serial connection to a standard half-duplex Telnet connection and behaves, as far as is possible as a serial modem using a set of Hayes type ́AT ́ commands with the Telnet connection and negotiation process being handled by the modem.

For example to connect to a Telnet server the ATD (Dial) command can be used as follows.


or if a non standard port is needed the following an be used


an IP address can also be used


The modem operates at a serial port speed of 19200 baud and uses DHCP for network configuration.

2018-01-20 18.10.38 300.jpg

CR and LF Handling

Telnet by default is a half-duplex connection and the modem supports this by transmitting data on a line by line basis. Not requiring the remote end to echo each character typed, helps reduce the network bandwith used. However, the terminal emulation software can operate in full-duplex mode without local echo as the modem will buffer and echo each character as it is received.

When a CR is entered on the terminal, the modem will transmit all buffered data over the telnet connection and return the results to the terminal. Terminal software, on pressing <Return> can often be configured to send either a Carraige Return (CR) or the Carraige return/Line Feed (CR/LF) combination. The modem will operate correctly with either. However, to comply with RFC 854, a carraige return not followed by a LF will be sent over the network as CR/NULL to explicitly indicate that a CR only is being sent.

AT Commands

The command set is loosely based on the Dowty Quatro modem, however, due to the differences in using Telnet rather than a switched telephone network, not all of the commands are implemented. Unsupported commands are accepted and return the ́OK ́ response or ́0 ́ if Verbose is not being used (ATV0). This should allow preset modem command strings within terminal software to work as expected.

The following is a list of ́AT ́ commands. Where the command is followed by a ́n ́, this indicates a parameter and may be a number, a character or a string of characters. If a parameter is not specified, it is assumed to be 0 or an empty string as is appropriate for the command. Many commands can be combined, for example the commands AT&H (display help) and ATI (Inquiry) can be combined as follows


When in ́command ́ mode (see ATDT and ATH below), entering AT followed by <Return> should give the response ́OK ́.

Command Summary

ATDTn (Dial)

Causes the modem to initiate a connection to a remote host for example all of the follwoing are valid commands.


ATDP is accepted as an alias for ATDT. ATDT and ATDP were used to indicate pulse or tone dialling in traditional modems when using the telephone network. The Telnet modem will accept either ATDT or ATDP.

ATNn (Store a Url)

Stores a url:port definition. This command stores the url in one of 10 memories (0-9). These are lost when the unit is powered off unless AT&Z is invoked (see below).

To use a stored mumber, ATD can be used for example...


To clear a stored number, simply omit the url for example the following command clears memory 0;


AT&Z (Store Urls)

Not implemented in ver 0.9

Stores the urls entered with ATN for use in subsequent sessions on an SD Card if present in the system.

For ́Hayes ́ compatibilty, the command AT&Z<URL> will store a url the most recently used memory (or memory zero if none has been used). e.g.


This can be dialled with the ́Dial Stored ́ command...


AT&N (Display Stored Numbers)

Displays the entire directory of stored Urls. e.g.


would return...

   N2 - URL: PORT: 23
   N3 - URL: PORT: 2323
   ... etc.

AT&W (Write Active Configuration)

Not implemented in ver 0.9

This command will store the current modem configuration and this command will store the current modem configuration and stored Urls to an SD Card if one is installed in the system..

ATZ (Recall User Configuration)

Not implemented in ver 0.9

This command will reset the modems current settings and stored Urls to those previously stored on a SD card with the AT&W command.

AT&F (Factory Defaults)

This will restore the modem to its factory default settings. It will not clear stored Urls or delete ant settings stored using AT&W.

AT&In (Interface Constant Speed)

Not implemented in ver 0.9

AT\*Yn (Break Mode)

Not implemented in ver 0.9

AT&Yn (Command Terminal)

This enables or disbles the second serial port (Command Port). This port is a USB based serial port on the modem that is used for debugging purposes. The port is disabled by default and can be enabled with the command...

   ATY0  Disabled
   ATY1  Enabled

AT&Kn, AT\*Kn, AT&Un, AT\*Un, AT\*Fn (Flow Control)

Not implemented in ver 0.9

ATEn (Echo Mode)

The Echo command controls the echo of characters received by the modem from the terminal, back to the terminal. Echo is enabled by default.

   ATE0  Disabled
   ATE1  Enabled

ATQn (Quiet Mode)

This command controls the responses to comands from the modem. When Quiet mode is enabled, the modem will accept commands but will not respond. Quiet Mode is disabled by default.

   ATQ0  Disabled
   ATQ1  Enabled

ATVn (Verbose Mode)

Verbose Mode determines the type of responses returned to the terminal. Verbose mode is enabled by default.

   ATV0 Verbose Mode disabled. (numeric responses)
   ATV1 Verbose Mode enabled   (plain english responses)

ATXn (Extended Responses)

Not implemented in ver 0.9

This command controls the level of responses received from the modem. The default setting is 0. A setting of 1 causes the modem to respond with additional diagnostic responses.

   ATX0  Standard responses.
   ATX1  Standard and diagnostic responses

AT&H (Help)

This command returns a help screen with a summary of commands.

AT*C (Configuration Display)

Displays the current configuration.


Displays the current register settings. See _S Registers_ for details.

ATA (Answer Mode)

Not implemented in ver 0.9

ATH (Hook Control)

The hook control command controls the on-line state of the modem. The command causes the modem to go offline and attempt to disconnect any network connection.

ATO (On-Line)

This command causes the modem to return to the on-line state follwing an Escape Code Sequence (see "+++" below).

ATK (Call Timer)

Not implemented in ver 0.9

This command causes the modem to respond with a display of the most recent connection time in minutes and seconds.

"+++" (Escape Code Sequence)

This command, can be issued when the modem is connected to a remote telnet server, it will revert the modem to ́Command ́ mode and will allow the modem to receive AT commands. The mode and will allow the modem to receive AT commands. The connection will be maintained.

The S Register S2 contains the ASCII value of the escape code.

S Registers

The following command will display the current segister contents, however, these settings cannot be changed in ver 0.9.