TDM2312 four-channel relay control via ERa (Wi-Fi/4G)
1. Install the ERa library
Open Arduino IDE, select Manage Libraries (Ctrl+Shift+I), search for the ERa library, and click Install.
The image shows the ERa library installed successfully.
2. Connect the relay board to ERa over Wi-Fi
2.1. Configure the gateway in Arduino IDE
Open the ERa ESP32_Wifi_Basic example under File/ERa/ESP32/ESP32_Wifi_Basic.

Enter your Wi-Fi network name and password:
const char ssid[] = "";
const char pass[] = "";
2.2. Configure the gateway in ERa
Open https://e-ra.io/index.html in your browser.
Click Sign In to sign in or create an ERa account.
Create a new unit in ERa: select “All Unit Dashboards” → “Create Location”.
Select “Manual setup” → “Next”.
Enter a location name, choose its position, and click “Create”.
Example location setup.
Go to “All gateways” → “Create new gateway”.
Enter a gateway name, such as Relay 4 CH.
Select ESP32-C3 as the board.
Select the location you created under “All Unit Dashboards”.

Click “Next step” to open the library setup page.
Click “Next step” to open the source code page.
Click “Copy token”.
Return to Arduino IDE and find #define ERA_AUTH_TOKEN.

Paste the token copied from ERa.
Example ERa token.
Select the “ESP32C3 Dev Module” board.
Select “Huge APP” under Partition Scheme.
Select the COM port and upload the code from Arduino IDE.
After flashing succeeds, return to ERa and click “Next step” to open the gateway activation page.
Once the gateway connects, select “Go to Gateway”.
Open the “Pin Input/Output” tab and select “Setup”.
Select “New Input/Output device”.
Enter a device name.
Once the new device is created in ERa, click it.
Open the “Write configuration” tab and select “New write configuration”.
Configure relay channel 1 as shown below, then click “Done”.
Relay channels 1, 2, 3, and 4 correspond to GPIO 6, 7, 3, and 10, respectively.
Open the “Actions” tab and select “New action”.
Configure the actions that turn the relay on and off as shown below:
Click “Return to Dashboard”.
Click “Edit dashboard”.
Drag a “Button” widget onto the dashboard and select “Widget settings”.
Enter a widget name and select the area created earlier.
Click “Add” under “Displayed devices”.
Configure the new displayed device as shown below:
Select the newly created device as the data stream to display its data (for example, Relay 1).
Configure the “On action” and “Off action”.
Click “OK”.
Select “Done”.
A widget for controlling the new device appears on the dashboard.
3. Connect the relay board to ERa over 4G
3.1. Configure the gateway in Arduino IDE
Open the ESP32_GMS_Basic example under File/Examples/ERa/ESP32/ESP3232_GMS_Basic.
Comment out #define TINY_GSM_MODEM_SIM800.
Define the modem as SIM7600 instead.
Set the carrier for the SIM card in use (for example, Viettel).
3.2. Configure the gateway in ERa
Follow the same ERa gateway setup steps described in section 2.2.







































