Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heltec Esp32 Lora & TTGo T-Beam Integration #32

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions examples/BasicSend_v2_Heltec_Lora/BasicSend_v2_Heltec_Lora.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#include <IridiumSBD.h>

/*
BasicSend
you can't use U0TXD and U0RXD becuase they are used for the programming of the board, quite why Heltec brought these pins
out to the edge connector I don't know, I suppose to allow an external programmer, who knows.
The pins that are free are as follows:
GPIO-17
GPIO-2
GPIO-22
GPIO-23
GPIO-0
GPIO-12
GPIO-13
GPIO-25

All other spare pins are inputs only, best avoided.

I've modified the code here accordingly to use (say) 12 and 13

Wiring:
Heltec Pin 12 (rxpin) --- Iridium txdata pin
Heltec Pin 13 (txpin) --- Iridium rxdata pin

*/

#define IridiumSerial Serial2
#define DIAGNOSTICS false// Change this to see diagnostics
#define rxpin 12
#define txpin 13

// Declare the IridiumSBD object
IridiumSBD modem(IridiumSerial);

void setup()
{
int signalQuality = -1;
int err;

// Start the console serial port
Serial.begin(1500);
while (!Serial);

// Start the serial port connected to the satellite modem
Serial2.begin(9600, SERIAL_8N1, rxpin, txpin, false); // false means normal data polarity so steady state of line = 0, true means staedy state = high.

// Begin satellite modem operation
Serial.println("Starting modem...");
err = modem.begin();
if (err != ISBD_SUCCESS)
{
Serial.print("Modem begin failed: error ");
Serial.println(err);
if (err == ISBD_NO_MODEM_DETECTED)
Serial.println("No modem detected: check wiring.");
return;
}

// Example: Print the firmware revision
char version[12];
err = modem.getFirmwareVersion(version, sizeof(version));
if (err != ISBD_SUCCESS)
{
Serial.print("FirmwareVersion failed: error ");
Serial.println(err);
return;
}
Serial.print("Firmware Version is ");
Serial.print(version);
Serial.println(".");

// Example: Test the signal quality.
// This returns a number between 0 and 5.
// 2 or better is preferred.
err = modem.getSignalQuality(signalQuality);
if (err != ISBD_SUCCESS)
{
Serial.print("SignalQuality failed: error ");
Serial.println(err);
return;
}

Serial.print("On a scale of 0 to 5, signal quality is currently ");
Serial.print(signalQuality);
Serial.println(".");

// Send the message
Serial.print("Trying to send the message. This might take several minutes.\r\n");
err = modem.sendSBDText("Hello, world!");
if (err != ISBD_SUCCESS)
{
Serial.print("sendSBDText failed: error ");
Serial.println(err);
if (err == ISBD_SENDRECEIVE_TIMEOUT)
Serial.println("Try again with a better view of the sky.");
}

else
{
Serial.println("Hey, it worked!");
}
}

void loop()
{
}

#if DIAGNOSTICS
void ISBDConsoleCallback(IridiumSBD *device, char c)
{
Serial.write(c);
}

void ISBDDiagsCallback(IridiumSBD *device, char c)
{
Serial.write(c);
}
#endif
120 changes: 120 additions & 0 deletions examples/BasicSend_v2_TTGO_Boards/BasicSend_v2_TTGO_Boards.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#include <IridiumSBD.h>

/*
BasicSend

This sketch sends a "Hello, world!" message from the satellite modem.
If you have activated your account and have credits, this message
should arrive at the endpoints you have configured (email address or
HTTP POST).

The TTGO T Beam unit does not have many if any spare GPIO ports. Most of the
ports are already in use for Esp32, Lora and GPS. So this only leaves you

Pins:
GPIO-13
GPIO-25

All other spare pins are inputs only, best avoided.

I've modified the code here accordingly to use (say) 12 and 13

Wiring:
TTGO Pin 13 (rxpin) --- Iridium txdata pin
TTGO Pin 25 (txpin) --- Iridium rxdata pin

*/

#define IridiumSerial Serial2
#define DIAGNOSTICS false// Change this to see diagnostics
#define rxpin 13
#define txpin 25

// Declare the IridiumSBD object
IridiumSBD modem(IridiumSerial);


void setup()
{
int signalQuality = -1;
int err;

// Start the console serial port
Serial.begin(1500);
while (!Serial);

// Start the serial port connected to the satellite modem
Serial2.begin(9600, SERIAL_8N1, rxpin, txpin, false); // false means normal data polarity so steady state of line = 0, true means staedy state = high.

// Begin satellite modem operation
Serial.println("Starting modem...");
err = modem.begin();
if (err != ISBD_SUCCESS)
{
Serial.print("Modem begin failed: error ");
Serial.println(err);
if (err == ISBD_NO_MODEM_DETECTED)
Serial.println("No modem detected: check wiring.");
return;
}

// Example: Print the firmware revision
char version[12];
err = modem.getFirmwareVersion(version, sizeof(version));
if (err != ISBD_SUCCESS)
{
Serial.print("FirmwareVersion failed: error ");
Serial.println(err);
return;
}
Serial.print("Firmware Version is ");
Serial.print(version);
Serial.println(".");

// Example: Test the signal quality.
// This returns a number between 0 and 5.
// 2 or better is preferred.
err = modem.getSignalQuality(signalQuality);
if (err != ISBD_SUCCESS)
{
Serial.print("SignalQuality failed: error ");
Serial.println(err);
return;
}

Serial.print("On a scale of 0 to 5, signal quality is currently ");
Serial.print(signalQuality);
Serial.println(".");

// Send the message
Serial.print("Trying to send the message. This might take several minutes.\r\n");
err = modem.sendSBDText("Hello, world!");
if (err != ISBD_SUCCESS)
{
Serial.print("sendSBDText failed: error ");
Serial.println(err);
if (err == ISBD_SENDRECEIVE_TIMEOUT)
Serial.println("Try again with a better view of the sky.");
}

else
{
Serial.println("Hey, it worked!");
}
}

void loop()
{
}

#if DIAGNOSTICS
void ISBDConsoleCallback(IridiumSBD *device, char c)
{
Serial.write(c);
}

void ISBDDiagsCallback(IridiumSBD *device, char c)
{
Serial.write(c);
}
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#include <IridiumSBD.h>

/*
BasicSend

This sketch sends a "Hello, world!" message from the satellite modem.
If you have activated your account and have credits, this message
should arrive at the endpoints you have configured (email address or
HTTP POST).

Assumptions

The sketch assumes an Arduino Mega or other Arduino-like device with
multiple HardwareSerial ports. It assumes the satellite modem is
connected to Serial3. Change this as needed. SoftwareSerial on an Uno
works fine as well.

you can't use U0TXD and U0RXD becuase they are used for the programming of the board, quite why Heltec brought these pins
out to the edge connector I don't know, I suppose to allow an external programmer, who knows.
The pins that are free are as follows:
GPIO-17
GPIO-2
GPIO-22
GPIO-23
GPIO-0
GPIO-12
GPIO-13
GPIO-25

All other spare pins are inputs only, best avoided.

I've modified the code here accordingly to use (say) 12 and 13

Wiring:
Heltec Pin 12 (rxpin) --- Iridium txdata pin
Heltec Pin 13 (txpin) --- Iridium rxdata pin

*/

#define IridiumSerial Serial2
#define DIAGNOSTICS false// Change this to see diagnostics
#define RXD2 2
#define TXD2 0

// Declare the IridiumSBD object
IridiumSBD modem(IridiumSerial);


void setup()
{
Serial.begin(19200);
Serial.println("Starting setup...");

int signalQuality = -1;
int err;

// Start the serial port connected to the satellite modem
Serial.println("Starting satellite serial connection (swSer)");
Serial2.begin(19200, SERIAL_8N1, RXD2, TXD2);

// Begin satellite modem operation
Serial.println("Starting modem...");
err = modem.begin();
Serial.print("modem: ");
Serial.println(err);

if (err != ISBD_SUCCESS)
{
Serial.print("Begin failed: error ");
Serial.println(err);
if (err == ISBD_NO_MODEM_DETECTED)
Serial.println("No modem detected: check wiring.");
return;
}
}

void loop() {
}