Skip to content

Commit da625ff

Browse files
committed
Initial commit - Portenta Mid Carrier Pro 4G Module Section Update
1 parent 42e01e0 commit da625ff

File tree

2 files changed

+64
-70
lines changed

2 files changed

+64
-70
lines changed
93.7 KB
Loading

content/hardware/04.pro/carriers/portenta-mid-carrier/tutorials/user-manual/content.md

Lines changed: 64 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,16 +2218,11 @@ nmcli c add type gsm ifname cdc-wdm0 con-name wwan0 apn mobile.vodafone.it gsm.p
22182218

22192219
#### Using Arduino IDE
22202220

2221-
The Portenta H7 and C33 are compatible with the Mini PCIe interface and can leverage the Pro 4G Module's capability. Enable and using the modem with the Portenta H7 or C33 will require a library named **Arduino_4GModem**.
2221+
The Portenta H7 and C33 are compatible with the Mini PCIe interface and can leverage the Pro 4G Module's capability. Enable and using the modem with the Portenta H7 or C33 will require a library named [**Arduino_Cellular**](https://github.com/arduino-libraries/Arduino_cellular). The library manager within the Arduino IDE can access the library by navigating to **Sketch -> Include Library -> Manage Libraries**.
22222222

2223-
The *Arduino_4GModem* library packs two sources:
2223+
![Arduino Cellular Library for Pro 4G Modules](assets/arduino_cellular_library.png)
22242224

2225-
- Arduino_4G_Module
2226-
- ArduinoProModem
2227-
2228-
Each source is included for the correct compilation and operation of the modem with either Portenta H7 or C33. The library manager within the Arduino IDE can access the library by navigating to **Sketch -> Include Library -> Manage Libraries**.
2229-
2230-
The library provides functionality for setting up a 4G connection, handling GPS/A-GPS location services, and uninterrupted SMS transactions.
2225+
The [**Arduino_Cellular**](https://github.com/arduino-libraries/Arduino_cellular) provides tools for interacting with Arduino Pro 4G modules. It enables internet connectivity, SMS communication, and location tracking via cellular networks or GPS. Features include fast 4G internet connection, secure SSL connections, GPS or GSM-based location tracking, time synchronization with cell providers, and SMS sending and receiving.
22312226

22322227
Please ensure the mini PCIe power configuration is set as outlined in the [Mini PCIe Power Breakout Header](#mini-pcie-power-breakout-header-j9) section. The Portenta H7 or C33 requires **SERIAL1 Breakout** pins to be connected to designated **PCIe Breakout** pins :
22332228

@@ -2250,96 +2245,95 @@ The Portenta H7 can be replaced with the Portenta C33, maintaining the same setu
22502245
Once the setup is ready, we can use the following example from the library called **HTTPClient**:
22512246

22522247
```arduino
2253-
#define TINY_GSM_DEBUG
2254-
#define LOGGING
2255-
#define DEBUGSERIAL Serial
2248+
/**
2249+
* This example demonstrates how to make a HTTP GET request using
2250+
* the ArduinoHttpClient library and the ArduinoCellular library.
2251+
*
2252+
* Instructions:
2253+
* 1. Insert a SIM card with or without PIN code in the Arduino Pro 4G Module.
2254+
* 2. Provide sufficient power to the Arduino Pro 4G Module. Ideally, use a 5V power supply
2255+
* with a current rating of at least 2A and connect it to the VIN and GND pins.
2256+
* 3. Specify the APN, login, and password for your cellular network provider.
2257+
* 4. Upload the sketch to the connected Arduino board.
2258+
* 5. Open the serial monitor to view the output.
2259+
*
2260+
* Initial author: Cristian Dragomir
2261+
*/
22562262
2257-
#include "ArduinoProModem.h"
2263+
#define ARDUINO_CELLULAR_DEBUG
22582264
2259-
const char apn[] = "APN";
2260-
const char gprsUser[] = "GPRSUSER";
2261-
const char gprsPass[] = "GPRSPASS";
2265+
#include "ArduinoCellular.h"
2266+
#include "arduino_secrets.h"
22622267
22632268
const char server[] = "vsh.pp.ua";
22642269
const char resource[] = "/TinyGSM/logo.txt";
22652270
const int port = 80;
22662271
2267-
ArduinoCellularModem fourgee = ArduinoCellularModem();
2268-
HttpClient http = fourgee.getHTTPClient(server, port);
2272+
ArduinoCellular cellular = ArduinoCellular();
2273+
HttpClient client = cellular.getHTTPClient(server, port);
22692274
2270-
//HttpClient http = HttpClient(&fourgee.getNetworkClient(), server, port);
2275+
void getResource(){
22712276
2272-
void setup(){
2273-
Serial.begin(115200);
2274-
while (!Serial);
2275-
fourgee.begin();
2276-
fourgee.connect(apn, gprsUser, gprsPass);
2277-
}
2277+
Serial.println("Making GET request...");
22782278
2279-
void loop(){
2279+
client.get(resource);
22802280
2281-
Serial.print(F("Performing HTTP GET request... "));
2282-
int err = http.get(resource);
2283-
if (err != 0) {
2284-
Serial.println(F("failed to connect"));
2285-
delay(10000);
2286-
return;
2287-
}
2281+
int statusCode = client.responseStatusCode();
2282+
String response = client.responseBody();
22882283
2289-
int status = http.responseStatusCode();
2290-
Serial.print(F("Response status code: "));
2291-
Serial.println(status);
2292-
if (!status) {
2293-
delay(10000);
2294-
return;
2295-
}
2296-
2297-
Serial.println(F("Response Headers:"));
2298-
while (http.headerAvailable()) {
2299-
String headerName = http.readHeaderName();
2300-
String headerValue = http.readHeaderValue();
2301-
Serial.println(" " + headerName + " : " + headerValue);
2302-
}
2284+
Serial.print("Status code: ");
2285+
Serial.println(statusCode);
2286+
Serial.print("Response: ");
2287+
Serial.println(response);
23032288
2304-
int length = http.contentLength();
2305-
if (length >= 0) {
2306-
Serial.print(F("Content length is: "));
2307-
Serial.println(length);
2308-
}
2309-
if (http.isResponseChunked()) {
2310-
Serial.println(F("The response is chunked"));
2311-
}
2312-
2313-
String body = http.responseBody();
2314-
Serial.println(F("Response:"));
2315-
Serial.println(body);
2289+
client.stop();
2290+
}
23162291
2317-
Serial.print(F("Body length is: "));
2318-
Serial.println(body.length());
2292+
void setup(){
2293+
Serial.begin(115200);
2294+
while (!Serial);
2295+
// cellular.setDebugStream(Serial); // Uncomment this line to enable debug output
2296+
cellular.begin();
23192297
2320-
// Shutdown
2298+
if(String(SECRET_PINNUMBER).length() > 0 && !cellular.unlockSIM(SECRET_PINNUMBER)){
2299+
Serial.println("Failed to unlock SIM card.");
2300+
while(true); // Stop here
2301+
}
23212302
2322-
http.stop();
2323-
Serial.println(F("Server disconnected"));
2303+
Serial.println("Connecting...");
2304+
if(!cellular.connect(SECRET_GPRS_APN, SECRET_GPRS_LOGIN, SECRET_GPRS_PASSWORD)){
2305+
Serial.println("Failed to connect to the network.");
2306+
while(true); // Stop here
2307+
}
2308+
Serial.println("Connected!");
23242309
2310+
getResource();
23252311
}
2312+
2313+
void loop(){}
23262314
```
23272315

2328-
The example above connects to the web and fetches resources via HTTP. The script will require defining the following parameter fields:
2316+
The example above connects to the web and fetches resources via HTTP. The script will require **arduino_secrets.h** to be defined wtih following credentials:
23292317

2330-
- APN
2318+
- GPRS APN
23312319
- GPRS User
23322320
- GPRS Password
2321+
- SIM Card Pin Number
23332322

2334-
These three parameters will always be required to be defined to use the SIM functionalities within the modem. The image below shows an anticipated initial result of the modem detected and connecting to a 4G network:
2323+
These parameters will always be required to be defined to use the SIM functionalities within the modem. The image below shows an anticipated initial result of the modem detected and connecting to a 4G network:
23352324

23362325
![Portenta H7 & Pro 4G Module - HTTPClient Example Initialized](assets/portentaMIDcarrier_h7_mpcie_4gmodem_result.png)
23372326

2338-
You may find additional examples as well within the library, each dedicated to different purposes as follows:
2327+
You may find additional examples as well within the library to try various functionalities such as deleting SMS, getting GPS location, and connecting to web servers securely:
23392328

2340-
- **MQTTClient:** Stream sensor information via MQTT
2341-
- **SMSReceive:** Send and receive SMS messages
2342-
- **TimeAndLocation:** Get time and location using GPS and GSM as a fallback process for the EU version
2329+
- **HTTPClient**: Connects to a web server using the [*ArduinoHttpClient*](https://github.com/arduino-libraries/ArduinoHttpClient).
2330+
- **HTTPSClient**: Establishes a secure connection to a web server with [*BearSSL*](https://bearssl.org/) and [*ArduinoHttpClient*](https://github.com/arduino-libraries/ArduinoHttpClient).
2331+
- **ModemTerminal**: Useful for debugging and testing AT commands.
2332+
- **GetLocation**: Shows how to obtain the current GPS location.
2333+
- **GetTime**: Uses GPS to acquire the device's time.
2334+
- **ReceiveSMS**: Demonstrates SMS sending and receiving functionality.
2335+
- **SendSMS**: Shows how to send an SMS.
2336+
- **DeleteSMS**: Demonstrates how to delete SMS messages.
23432337

23442338
#### Ethernet
23452339

0 commit comments

Comments
 (0)