XStore

EC-M12-BC-C6-C-A – USER GUIDE

Updated on October 31, 2025

Power Source Selection #

The device has a built-in battery, which is designed for low power operation. During programming and testing of the device, the power source can be changed to USB to save the battery power for its actual operation. The power source can be changed to USB by setting the on-board Jumper to position 2.

Battery Monitoring #

The battery is fed to the Port 2 of ADS1115 16 bit ADC, through a voltage divider as shown in the picture below. The battery voltage can be calculated and used for the operation and alerting functions.

Programming the Device #

NORVI EC-M12-BC-C6-C-A is powered by a STM32L Series microcontroller, STM32L072CZ. This microcontroller is designed for low power applications and can be programmed with Arduino IDE or any other IDE which supports STM32 micro-controllers.

The board includes SWD programming Pins for connection with an ST-Link and USB Port for Serial Debugging.

Configuring Arduino IDE for STM32L
The boards package: STM32 MCU Based boards should be installed from the Arduino Boards Manager.

Then setup the board setting from tools as the below Figure 5. In there, to get the serial monitor output needed to enable generic serial and CDC (generic ‘serial’ supersede U(S)ART.

Board: Generic STM32L0 Series
Board Part number: Generic L072CZTx
U(S)ART support: Enabled generic Serial)

Compiling and Uploading Code for STM32L with Arduino IDE #

The compiled binary can be downloaded from Arduino IDE from Sketch > Export Compiled Binary Option.
Once the process is complete the binary file can be fetched from the programs saved location.

The exported binary file can be uploaded through a ST-Link Programmer.
The connections GROUND, CLK, DIO, RESET should be connected with the ST-Link Programmer.

The complete test program for the product is available on our github repository.

https://github.com/IndustrialArduino/EC-M12-BC-C6-C-A

Utilizing Analog Inputs #

The analog inputs are converted to digital through ADS1115 16bit ADC. ADS1115 provides internal comparators with a digital alarm output, which you can set the ADS1115 to monitor an analog input, while the other peripherals are on sleep. For the reading operation of ADS1115, it is available on I2C bus at the address 0x49.

The Power output of the device can be utilized to power the sensor or the external device. The output voltage can be configured as 12V , 5V or 3.3V according to requirement.

Output from the sensor should be connected to A1 or A2 analog with the reference GROUND.

4 – 20mA Analog Input – Internal Attenuation

0 – 10V DC Analog Input – Internal Attenuation

Arduino Example of Reading Analog Input #

⚙️
cpp
#include <Adafruit_ADS1X15.h>
#define BOOST_EN PA4
Adafruit_ADS1115 ads1;
const float V_Factor = 3.3 / 1.65;
const float mA_Factor = 4.096 / 3269.826;
void setup() {
  Serial.begin(9600);
  pinMode(BOOST_EN, OUTPUT);
  Wire2.begin();
  delay(1000);
  if (!ads1.begin(0x49)) {
    Serial.println("Failed to initialize ADS 1 .");
    while (1)
      ;
  }
  ads1.setGain(GAIN_ONE);  // 1x gain +/- 4.096V  (1 bit = 0.125mV)
}

void loop() {
  digitalWrite(BOOST_EN, HIGH);
  float current0 = ads1.readADC_SingleEnded(1) * mA_Factor;
  float current1 = ads1.readADC_SingleEnded(0) * mA_Factor;
  Serial.print("Current 0: ");
  Serial.print(current0);
  Serial.println(" mA");
  Serial.print("Current 1: ");
  Serial.print(current1);
  Serial.println(" mA");
  digitalWrite(BOOST_EN, HIGH);
  delay(1000);
}

RS-485 Communication #

RS-485 Communication is handled by SN65HVD72 RS-485 transceiver. MODBUS RTU Protocol or any other RS-485 based protocols can be established with the transceiver.

DriverSN65HVD72
UART RXPB7
UART TXPB6
Flow ControlPB5

RS-485 Wiring #

Programming RS-485 #

The example code below initialized the UART Module for RS-485 transceiver and Sends the message “RS485 01 SUCCESS” over RS-485 bus. After that the module is set to receiving mode to receive messages.

⚙️
cpp
#define RS485_RX PB7
#define RS485_TX PB6
#define FC PB5

HardwareSerial Serial1(RS485_RX, RS485_TX);

void setup() {

  Serial.begin(9600);
  delay(500);
  pinMode(FC, OUTPUT);

  Serial1.begin(9600);
}
void loop() {
  digitalWrite(FC, HIGH);               // Make FLOW CONTROL pin HIGH
  Serial1.println("RS485 01 SUCCESS");  // Send RS485 SUCCESS serially
  delay(100);                           // Wait for transmission of data
  digitalWrite(FC, LOW);                // Receiving mode ON
  delay(100);

  while (Serial1.available()) {  // Check if data is available
    char c = Serial1.read();     // Read data from RS485
    Serial.write(c);             // Print data on serial monitor
  }

  delay(100);
}

Sensor Supply Voltage Output #

EC-M12-BC-C6 Series includes a supply voltage output to power external sensors or devices. This output is switchable from the Program to Save power. The output can deliver upto 200mA of current.

The output voltage can be selected between 3.3V , 5V and 12V.

Enabling Power Output from firmware #

The output enable pin is connected to the GPIO PA4 on STM32. By turning the PA4 High, the output can be turned ON.

The program below performs output being turned ON and OFF every 1 second.

⚙️
cpp
#define BOOST_EN PA4


void setup() {
  pinMode(BOOST_EN, OUTPUT);
  digitalWrite(BOOST_EN, LOW);
}

void loop() {
  digitalWrite(BOOST_EN, HIGH);
  delay(1000);
  digitalWrite(BOOST_EN, LOW);
  delay(1000);
}

MicroSD Card Support #

microSD card is connected to the SPI Bus of the STM32 with a GPIO to control power to the microSD Card. This is implemented to cut off power to the microSD Card when the device is in sleep mode. Below example code shows, to enable power to the microSD Card and read the data.

⚙️
cpp
#define MISO_PIN PA6
#define MOSI_PIN PA7
#define SCLK_PIN PA5


#define SD_chipSelect PA0
#define SD_PWR PB0


Sd2Card card;
SdVolume volume;
SdFile root;


void setup() {
  Serial.begin(9600);
  delay(100);
  pinMode(SD_PWR, OUTPUT);


  Serial.print("\nInitializing SD card...");
  if (!card.init(SPI_HALF_SPEED, SD_chipSelect)) {
    Serial.println("CARD NOT FOUND");
  } else {
    Serial.println("SD WORKING");
  }

  Serial.print("\nCard type: ");
  Serial.println(card.type());
  if (!volume.init(card)) {
    Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
    return;
  }
  if (!SD.begin(SD_chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    return;
  }
}

void loop() {
  delay(100);
}

Low Power Mode #

Preparing for Low Power #

Before entering sleep, all peripherals are powered down in a defined sequence:

StepsActionPurpose
1SPI.end()Stop SD communication
2Wire2.end()Disable I²C bus
3digitalWrite(FC, LOW)Disable flow control / put RS-485 in receive mode
4digitalWrite(SD_PWR, LOW)Power off SD card
5digitalWrite(BOOST_EN, LOW)Disable booster and INA196
6digitalWrite(GSM_POWER, HIGH)Turn off GSM module
7Delay 2sEnsure all subsystems shut down safely

Entering Low Power Mode #

After peripherals are powered down:

This command puts the STM32 into deep-shutdown mode for the defined duration (here ShutdownPeriod = 30000 ms, i.e. 30 s).

In shutdown mode:

  • Most peripherals and clocks are off.
  • Power consumption drops to a few microamps.
  • The RTC keeps running and wakes the MCU automatically when the timer expires.

Wake-Up and Resume #

After the shutdown period ends:

  • The MCU restarts from setup() (a cold start).
  • Peripherals are re-initialized.
  • Normal data acquisition and communication resume.
  • The cycle repeats.

Notes #

To change sleep duration, edit:

uint32_t ShutdownPeriod = <milliseconds>;
  • Ensure external circuits connected to BOOST_EN and SD_PWR properly isolate powered-down peripherals.
  • Avoid serial communication immediately before shutdown to prevent incomplete transmissions.

Modem NB-IoT / 2G

Model of GSM ModemSIMCOM SIM7070G
Bands SupportedCat-M1: B1 / B2 / B3 / B4 / B5 / B8 / B12 / B13 / B14 / B18 / B19 / B20 / B25 / B26 / B27 / B28 / B66 / B85.
Cat-NB (NB1/NB2): B1 / B2 / B3 / B4 / B5 / B8 / B12 / B13 / B18 / B19 / B20 / B25 / B26 / B28 / B66 / B71 / B85.
2G (GSM/GPRS/EDGE): 850 / 900 / 1800 / 1900 MHz (quad-band).
Technology4G LPWA: LTE Cat-M1 (eMTC) and LTE Cat-NB (NB1/NB2).
2G fallback: GPRS/EDGE (quad-band)
RXDPA3
TXDPA2
POWERPC13
Model of GSM ModemQUECTEL BC660K
Bands SupportedNB-IoT: B1 / B2 / B3 / B4 / B5 / B8 / B12 / B13 / B17 / B18 / B19 / B20 / B25 / B28 / B66 / B70 / B85
TechnologyNB-IoT (LTE Cat NB2)
RXDPA3
TXDPA2
POWERPC13

The GSM modem on the EC-M12-BC-C6-B-2.1 is connected to the microcontroller via Serial2 (PA2 – TX, PA3 – RX). It can be accessed directly using standard AT commands for basic communication and testing.

After powering on the modem (digitalWrite(GSM_POWER, LOW)), open the serial interface at 9600 bps and send AT commands such as: Serial2.println(“AT”); The modem will respond with “OK” if communication is successful.

Note: This section covers only basic AT command communication and testing. Refer to the “Using the Modem for Different Types of Connections” guide for details on data, SMS, and network configurations.

Indicator LED #

The device includes an Indicator LED connected to the NET light output of the GSM modem.
This LED reflects the modem’s network status as follows:

  • Blinking every 1 second: Modem is searching for a network.
  • Blinking every 3 seconds: Modem is registered on the network successfully.
  • Blinking rapidly: Modem is establishing a data connection.
  • Off: Modem is powered off or in low-power mode.

The indicator provides a quick visual reference to confirm modem activity and network connection status.

Visit Product Page, Buy it from shop