AG-221

AG-221 is 4G LTE cellular gateway with 2 ethernet ports, WiFi, RS485, digital inputs working on OpenWRT system. It can connect in multiple ways to the Internet with dual SIM capability and a range of advanced functions for mission critical IoT or M2M applications.  It supports multiple VPN providers and is therefore ideal for remote PLC management and industrial automation monitoring.

General information

Download technical specification Technical Specification

Model selection

Different Gateway models are available depending on the periphery availability and type.

Model
Cellular Network
GNSS
Internal memory
GPRS 3G
LTR 4G
5G

Flash 64MB
NAND 512MB
AG-221




AG-221-LT-EU

AG-221-LT-GL

AG-207 is the basic variant of this model. Has a no cellular module.

Hardware informations

The Gateway is made on one PCB, which is fitted to the aluminum housing. The housing is made of a thick, strong aluminum profile with two end plates also made from aluminum. The surface of the housing is finished by anodizing. 

At the bottom of the housing there are slots through which DIN rail clamp or any other clamp can be mounted by t-nuts.

Top view dimensions

AG-221-dimensions-top.png

Side view dimensions

AG-221-dimensions-B.png


Connectors

Top view connectors and indicators

AG-221-connectors-A.png

AG-221-connectors-B.png

Block diagram

For a better understanding of the operation of the gateway, refer to the block diagram. Non-essential components have been omitted. Developers who program peripherals such as GPIOs, serial etc. will find information about them in the sections dedicated to such peripherals.

AG-221-block-diagram.png


Power supply

The Gateway power supply range is 8-48V DC. First, connect the power supply according to the diagram. The Gateway is protected against reverse power connection. If the polarity is reversed, the Gateway will not start.


PoE

The Gateway can also be powered via PoE in the range of input power supply using unused pairs of wires in the LAN cable. Below is the pinout of the RJ45 socket.

Pin number
Function
Comment
1
RX+ Data
2
RX- Data
3
TX+ Data
4
DC+ Power supply positive
5
DC+ Power supply positive
6
TX- Data
7
DC- Power supply negative
8
DC- Power supply negative

LTE 4G modem

Generally, the Gateway supports all versions of Quectel and Telit MiniPCI express modems. However, you can use a third-party modem, as long as the signal outputs are compatible with those of the Quectel company. For use your LTE module, select model without LTE module installed. You also need to pay attention to the power supply to the LTE module should be 3.3V.

Configuration Manual

Please read carefully before starting. Also read the product safety information.


First start

After unpacking, the gateway is ready to use, but requires configuration to adapt to the required functions. 


Power supply

First, connect the power supply according to the power supply information.


Opening inbuilt website

Through the WAN interface

To access the built-in website, connect the gateway by WAN to the local network and enter the DHCP assigned IP address in the address window of the browser. Please note that it may take some time from powering on to booting up the system. When the LEDs next to the RJ45 socket start flashing, after about 10 seconds the built-in website becomes available.

user name: root 
password: root

Through the LAN interface

Connect the ETH2 directly to the computer and enter in the address window of the browser default IP of Gateway.

IP: 192.168.1.1
user name: root 
password: root

Through the WiFi interface

By default, the gateway creates its own network with default ESSID "AG-702". The network is secured with default password "atreyo12".
Connect to this network and enter the IP in the address bar of your browser.

IP: 192.168.1.1 
user name: root 
password: root

ag-221-web-login.png

ASfter logging in, you are automatically taken to the dashboard page.

ag-221-web-overview.png

Password setting

Set a password on the System > administration page:

ag-221-web-change-password.png

To maintain security, it is recommended to use long and complex passwords.


Cellular modem

Modem

The Gateway in its basic configuration is equipped with an LTE modem that also supports GPRS and SMS functions. Different modems were used depending on the model variant. Here is a table of models. 


SIM card

The Gateway supports two nano SIM cards, both 1.8V and 3V. The card connector is tray type. When installing the SIM card, pay attention to the correct insertion of the card. The used SIM card tray is designed so that the card sticks to the tray. This make easily insert the SIM regardless of the position of the Gateway


Using Cellular Network

To activate the LTE modem, go to Network > Interfaces and select the lte tab there.

Mostly the network operator requires you to enter the APN, sometimes it also requires a username and password. Enter the required data and save.

AG-221-web-network-interfaces-config-lte.png

Then go to System > Custom Commands and click on Start modem with SIM1/Start modem with SIM2. Depending on which SIM card you want to start.

AG-221-web-custom-commands-sim-1-2.png

The modem will start up and connect to the Internet. To check if it is working properly and what the signal is, go to Modem > Information about 3G/4G/5G connection. When the modem starts up, the LEDs showing the signal strength will also light up. This makes it easy to see the signal strength in a particular location.

ag-221-web-modem-information.png

Cellular modem  ON on start

To make the gateway automatically connect to the Internet after startup, you need to add a modem startup in the System > Startup section under Local Startup, add a line before line 'exit 0'.
/usr/commands/start_modem_sim1.sh or /usr/commands/start_modem_sim2.sh. Then save the changes. After each reboot, the gateway will automatically start the modem with the selected SIM card.


SMS

To test the SMS operation, the gateway has an SMS interface installed. Under Modem > SMS Messages. There you can check sent and received SMS. Be sure to enter the phone number together with the country prefix, but without the + sign. The maximum number of characters is 160. The system does not support alphabets such as devanagari. The maximum number of messages in the inbox is 20.

ag-221-web-modem-sms-rec.png

For send SMS go to Send Message tab.

ag-221-web-modem-sms-send.png


System statistics

The gateway has a built-in real-time statistics system under Status > Realtime Graphs and accurate statistics with selectable time range under Statistcis > Graph. You can check CPU load, memory usage, network load, etc.

Realtime Load

ag-221-web-realtime-stat-a.png

Statistics Interfaces

ag-221-web-statistics-interfaces.png

Statistics Memory

ag-221-web-statistics-memory.png

Statistics Processor

ag-221-web-statistics-processor.png

Statistics System Load

ag-221-web-statistics-system.png


Modbus

The Gateway has a very advanced Modbus application with a convenient graphical interface. Below are the capabilities of the application:

A detailed guide to Modbus configuration is available here.


Using the terminal

The AG-221 has a built-in bash terminal. With it you can execute all commands in the OpenWRT system. To enter the terminal, go to the tools > terminal section on the built-in website. The default password is the same root/root.

ag-221-web-terminal.png


Reset and default

Make factory default

To reset the system to factory settings, hold down the "Default/Reset" button for more than 5 seconds while the device is operational. During the factory reset, all LED indicators will light up for 2 seconds.

Reset device

To restart the gateway without disconnecting the power supply, press and hold the "Reset/Default" button for less than 5 seconds. During the restart, 4 LED indicators will light up for 1 second.

Do not hold the button for more than 5 seconds, as it will trigger the gateway to restore default settings.


Modbus Master

Modbus Master is an application that allows full operation of devices connected to the gateway over Modbus RTU and Modbus TCP/IP. Also, the application allows sending data to the server via MQTT, TCP/IP JSON and saving to storage.


Configuration of Modbus Master

To open Modbus master, go to Modbus > Modbus Master

Add Slave Device in Modbus Slave Devices

ag-221-web-modbusmaster-start.png

Enter a slave device name of your choice & Select communication protocol.

AG-221-web-modbusmaster-advanceSettingsAlert.png

Modbus RTU

Need to enter the serial port configuration according to the slave device. In AG-221 is for RS485 dev/ttyS1.

/dev/ttyS1 = RS485

ag-221-web-modbusmaster-serial.png

Change the baud-rate according to your slave device requirement. In Modbus RTU 9600 baud-rate is most common used.

AG-221-web-modbusmaster-baudrate.png

Data bits are used to represent each character or data unit in a communication protocol. Select the appropriate setting.

AG-221-web-modbusmaster-databit.png

Parity is an error-checking mechanism to detect data transmission errors. Most devices use the None option.

AG-221-web-modbusmaster-parity.png

A stop bit signals the end of a data frame, helping the receiver recognize when one byte is complete.

Select the option according to the slave device.

AG-221-web-modbusmaster-stopbit.png

Modbus TCP/IP

In Modbus TCP/IP, only the IP address and port number (typically 502) are required for communication. 

AG-221-web-modbusmaster-tcp.png

Modbus slave

After entering these parameters, the next configuration steps are the same for both Modbus TCP and Modbus RTU.

You should enter the slave ID (1-255), polling interval, and request timeout according to your requirements.

ag-221-web-modbusmaster-slaveidpollingrequest.png


Query Configuration

To make a Query, click on ADD QUERY

AG-221-web-modbusmaster-rtu2.png

Enter the Function code, Start Address, Register/Coil number as per the Slave documentation or instruction. Here 1-50 register/coil quantity is supported.

AG-221-web-modbusmaster-Query1.png

Parameter Configuration

Enter and select the option as per your requirement.

AG-221-web-modbusmaster-parameter2.png

AG-221-web-modbusmaster-parameter1.png

AG-221-web-modbusmaster-parameter.png

Click on SAVE after entering and selecting the Parameters.

This is how we can configure Modbus and view the details.
And for another slave do the same process by click on ADD SLAVE DEVICE.

ag-221-web-modbusmaster-save-modbusconfig.png


Data output configuration

Click on Output configuration. There are two option: 

  1. Save Data to File.
  2. Send Data to Server.

We can choose both options and then the data is both sent to the server and saved locally.

ag-221-web-modbusmaster-outputconfig.png

If Save Data to File is selected, it is necessary to specify the folder path.

Send data to server

In Send Data to Server. There are 2 option:

Atra-Data is Atreyo's system for quick and easy presentation of data in the cloud. In the case of 3rd-PARTY-PLATFORM, we can choose any data platform that communicates using one of the selected ports: HTTP, MQTT or TCP/IP.

ATRA-DATA

ATRA-DATA. In This Data is send direct to the ATRA server without any aditional configuration.

ag-221-web-modbusmaster-outputconfig1.png

3rd-PARTY-PLATFORM. 

There are some parameter required to select protocol – HTTP, MQTT, TCP/IP.

ag-221-web-modbusmaster-outputconfig-select.png

HTTP(s)

Enter the URL For HTTP Post and Header. Where able to Change default header or add new one if needed.

ag-221-web-modbusmaster-outputconfig2.png

Certificates

To enhance security for data transmission, you can use certificate-based TLS along with credentials.
Certificate-based TLS (Transport Layer Security) require CA(Certificate Authorities) file, Client Certificate and Private key 
Credentials often require a username and password for authentication and access control in secure systems.

ag-221-web-modbusmaster-outputconfig-certificates.png

MQTT

Enter the Server Hostname/IP, Server Port, Publish Topic and Subscribe Topic. Select QoS level as per requirement and Client ID it is Auto-generate.

ag-221-web-modbusmaster-outputconfig-mqtt-cert.png

QoS (Quality of Service) level

Firmware update

The system can be updated via the built-in website. We can update OpenWRT firmware both when the system is running and when it's in U-Boot mode. In cases we need to have a firmware file with a new system compatible with this gateway model. Uploading the incorrect image may cause the device to malfunction.

When OpenWRT is running

Go to System > Backup / Flash Firmware. At the bottom of the page is an option to Flash new firmware image. Select the correct system image and click Flash Image

AG-702-web-update-firware.png

This is followed by a firmware file selection window. 

AG-702-web-update-firware-select.png

Select the correct file and click upload.

AG-702-web-update-load.png

The file will be loaded into the gateway and verified. If it is verified correctly it will go to the window where the option "Keep settings and retain the current configuration" will be checked. If you do not care about keeping the configuration, it is better to uncheck this option. 

AG-702-web-update-conform.png

Then you have to wait a few minutes for the system to load and update.

Do not turn off the gateway while the system is being updated. This will damage the system.

By U-Boot mode

This method of uploading firmware should only be used when the system is not working and the firmware cannot be uploaded in the normal way. To enter U-Boot mode press RESET switch for 4 seconds when switching on the power supply. The Gateway should start on U-Boot mode. In U-Boot mode, the white STAT LED glows continuously. To access internal website go to IP 192.168.10.50 and load firmware from proper firmware file provided by Atreyo. 

Uploading incompatible firmware not provided by Atreyo will void the warranty.

Then you have to wait a few minutes for the system to load and update. 

Do not turn off the gateway while the system is being updated. This will damage the system.


Firmware list

The Gateway works on the OpenWRT operating system. The operating system is specially prepared and compiled for hardware. So when it is booted up, it is ready for use. In addition to the pre-installed application, we provide our own repository of free apps compiled for this Gateway. We update the system regularly to keep the latest version. You can check the latest releases here.

V1.01.10

AG-702-LT-EU version

Firmware Version File name Kernel
OpenWRT
Date
V1.01.10 download 5.15.71
27.11.2025

AG-702-LT-GL version

Firmware Version File download
Kernel OpenWRT
Date
 
5.15.71
 

Safety information

Operating environment

Use in inappropriate conditions may damage the device or shorten its life.


Electrical and power supply safety

Only a person with qualification and appropriate knowledge should install the device.


Malfunctioning and damaged device

Radio frequency exposure

This device has been designed and manufactured not to exceed radio frequency energy emission limits set by regulatory agencies. To comply with RF exposure guidelines, the device must be used at least 20 cm away from a person's body. Failure to follow these instructions may result in exceeding the applicable RF exposure limits. This only applies to models with a built-in LTE modem.


What to do and what not to do