Help Needed: Debugging Arduino Portenta C33 Code for Logging Data to Google Sheets via Web App URL

Hello Arduino Community,

I’m currently working on a project using an Arduino Portenta C33 and I’m trying to log data from my device to Google Sheets via a web app URL. I’m using the WiFiC3 library to establish a WiFi connection, and I have written a script that sends data to a Google Sheets web app endpoint. However, I’m facing some issues with getting it to work.

What I’ve Done So Far:

  1. I’ve created a Google Apps Script Web App that receives HTTP requests and logs data to a Google Sheet. I’ve confirmed the Web App URL works fine when tested in a browser AND postman
  2. No library called WiFiClientSecure.h
  3. No available method .setInsecure under the calss WiFiClient, which is included in WiFiC3.h
  4. Using httpsPort = 80 without changing the rest of the code results in error printed to Serial Monitor

Problem:

  • No data is appearing in the Google Sheets document when I try to send data from the Portenta C33.
  • I’ve checked my network connection, and the WiFi appears to be working, but the communication with the web app seems to be failing
  • secureClient.available() returns false

Code Snippet:

#include <WiFiC3.h>

const char* ssid = "";
const char* password = ""; 
const char* host = "script.google.com";
const int httpsPort = 443;

// Use WiFiClientSecure class to create TLS connection
WiFiClient secureClient; 

// Replace with your GAS service ID (Google Apps Script Web App URL)
String APP_ID= ""; 

void setup() {
  Serial.begin(115200);
  delay(10);

  // Connect to WiFi
  WiFi.begin(ssid, password);

void loop() {
  float pressure = 101.35;

  // Send data to Google Sheets
  if (secureClient.connect(host, httpsPort)) {
    String url = "/a/macros/s/" + APP_ID + "/exec?Pressure=" + String(pressure);
    Serial.print("Requesting URL: ");
    Serial.println(url);

    secureClient.print(String("GET ") + url + " HTTP/1.1\r\n" +
                   "Host: " + host + "\r\n" +
                   "User-Agent: Arduino\r\n" +
                   "Connection: close\r\n\r\n");
  delay(5000); // Read every 0.5 second
}

Are there specific libraries or configurations I may need for better handling HTTP requests from the Portenta C33? I’d greatly appreciate any help or insights you might have to resolve this issue!

Thank you in advance!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.