Macchina Docs
  • Macchina.cc
  • Introduction
    • Disclaimer
  • Product Documentation
    • M2 Docs
      • Getting Started
      • Arduino IDE Quick Start
      • M2 Code libraries
        • CAN bus
        • Single-wire CAN
        • LIN
      • Next Steps with M2
      • Detailed Reference
        • Installation
        • Processor
        • Pin Mapping
        • Automotive Interfaces
        • Communication
          • M2 Bee-Compatible Add-ons
          • Cellular
        • Power
        • Storage/Memory
        • 12V IO
        • LEDS/Buttons
        • Enclosures
        • Breakout Board
        • Schematics and Source
      • Versions of M2
    • A0 Docs
      • Quick Start Guide
      • Firmware Reference
      • Hardware Reference
      • Projects
      • Troubleshooting
    • SuperB Docs
      • Getting Started
      • Hardware
      • Sending AT Commands
    • P1 Docs
      • Getting Started
      • Pin Mapping
      • Interfaces
      • Power Supply Note
    • OBD3way Docs
  • Projects
    • A0 Projects
      • A0 CAN Vehicle Data
      • A0 CAN Point to Point
      • A0 CAN Read VIN
      • Work-in-Progress A0 projects
    • M2 Projects
      • "OK Google, start my car!"
      • M2 and SavvyCAN, the Basics
      • Help Collect Voltage Data
      • Mini-Project Tutorials
        • M2 CAN Loopback
        • M2 CAN Point to Point
        • M2 SWCAN Point to Point
        • M2 VIN Extraction
    • P1 Projects
      • P1 CAN Vehicle Data
      • P1 CAN Loopback
    • Community Projects
    • Project Support
    • Other Resources
  • Support /contact us
    • Contact US / FAQ
    • Common Issues
    • Out of Stock/ Status
Powered by GitBook
On this page
  • Setup
  • Power
  • Basic communication

Was this helpful?

Export as PDF
  1. Product Documentation
  2. M2 Docs
  3. Detailed Reference
  4. Communication

Cellular

PreviousM2 Bee-Compatible Add-onsNextPower

Last updated 5 years ago

Was this helpful?

This tutorial will show how to connect your car to the internet using M2, a and a SIM card. You may also wish to reference the .

Setup

The modem plugs directly into the 20 pin wireless socket on top of your M2. Make sure that it is oriented correctly with the angled chamfers pointed toward the USB/SD side of your M2. Please make sure your M2 is not being powered when plugging in the modem.

Before plugging the modem into your M2, make sure to install a SIM card. This modem uses a 4FF (Nano) size SIM card.

Power

As you work with the Digi modem, please keep in mind that it requires more power that your computer can provide directly over a USB port. You have 2 options:

  • Power your M2 via the OBD2 port (i.e. plugging into your car or some sort of adapter)

  • Use a powered USB hub. This option is preferable for desktop development. We've had good luck with this inexpensive hub:

Basic communication

A good first step is to check that everything is working it to talk to the modem from your computer, through your M2. For this, you need to program your M2 with a simple sketch that will forward data between the 2 serial ports:

  • USBSerial, the USB connection between the M2 processor and your computer.

  • Serial, the Serial connection between the M2 processor and the XBee socket pins

int AssociateState = 0;            // variable for reading the associate status

void setup() {
  Serial.begin(9600);              // Serial port for XBEE socket
  SerialUSB.begin(9600);           // Native USB port
  pinMode(XBEE_MULT2, INPUT);      // DIGI Associate PIN
  pinMode(DS6, OUTPUT);            // Green LED
  pinMode(XBEE_RST, OUTPUT);
  digitalWrite(XBEE_RST, HIGH);    // Make sure RESET is HIGH
  pinMode(DS2, OUTPUT);
  digitalWrite(DS2, LOW);          // Turns on Red LED
}

void loop() {

  if (SerialUSB.available()) {     // read from port 1, send to port 0:
    int inByte = SerialUSB.read();
    Serial.write(inByte);
  }

  if (Serial.available()) {        // read from port 0, send to port 1:
    int inByte = Serial.read();
    SerialUSB.write(inByte);
  }

  AssociateState = digitalRead(XBEE_MULT2);

  if (AssociateState == HIGH) {
    digitalWrite(DS6, HIGH);       // turn LED on:
  } else {
    digitalWrite(DS6, LOW);        // turn LED off:
  }
}

This sketch will also make the GREEN LED blink as the pin of the modem toggles. The pin signals and locations for the modem can be found .

The second part to a basic communication test is the software on your computer. Digi offers a nice UI called XCTU to communicate with their products. Download the .

Once downloaded and installed, launch XCTU and follow the instructions from .

From there, you can do all sorts of fun things, from sending an SMS to connecting to servers to posting data to a website. Several examples are found on .

https://www.amazon.com/AmazonBasics-Port-2-5A-power-adapter/dp/B00DQFGH80
associate
here
latest verison
Digi's documentation
Digi's documentation page
Digi XBee Cellular LTE modem
modem's datasheet