19003 and an SOS GPIO

Alright so I’m fairly new to all this LoRa stuff, so let me explain what I’m doing. Anything to point me in the right direction will be helpful. I’m setting up some meshtastic nodes and I want to make an “SOS” feature to notify the network if a node has been taken down, messed with, etc. A few people have done this but I’ve seen it done with Heltec stuff once or twice. I have both 19007’s and 19003’s with 4630’s. I would prefer to use the 19003 due to its size.

It looks like an “SOS” feature is already available in the meshtastic settings under the “Detection Sensor” settings. This feature states its function as “Configure a GPIO pin to be monitored for specified high/low status and send text alerts”, so in my case; I would place a button in an enclosure that when opened would release the button thus completing that GPIO pin and sending an alert. My question comes down the the GPIO availability on the 19003. I have found only one other thread where GPIO use and the 19003 was mentioned but both Slot C and D were occupied in that situation.

My understanding was that I could use the header pins, however beegee had mentioned later on it could not be used because those pins are being shared with the RAK12500 as it is connected to both UART1 (RX1/TX1) and I2C. So because I am NOT using any of those slots, could I use these pins or is there more to this?

When it comes to the code, would I just assign the GPIO pin in the software? In my case could it be whatever pin RX1 is? Would it be easier to de-solder an LED and use that as my detection pin (either pin 14, 15, or 16)?

My last question is, would there be a better way to go about this with the 19003?

Welcome to the forum @TWS

If you have no other modules that uses the Serial port, you can use either RX1 or TX1 for an alarm input.

I just don’t know the port numbering of Meshtastic, it is different to what we use in the WisBlock documentation.

If the RAK1904 (3 axis accelerometer) is also connected to the board, seeing as its using IC2 for communication, is there any available GPIO pin to use?
I am assuming that SCL/SDA cannot be used due to the I2C, but the RX/TX ones should still be available, or?

In the documentation it says that the UART pins can be used but with restrictions, is there anything special to consider if one would want to set the pinMode for them to input with pullup or pulldown?

I am a little confused which name to use in the sketch for these pins.

I am using the RAK17200 with the RAK19003 WisyBoard.

I2C allows multiple devices to use the same lines. Each I2C device has a unique ID that is used during the communication (handled by the libraries of the modules).

==>

RAK12500 and RAK1904 can be used together without any problems.

Great to hear it shouldn’t be a problem.

I’m reading the documentation and trying to understand what the name of the TX0 or RX0 pin is. If I look at the documentation for RAK11720 (https://alphamicro.net/wp-content/uploads/2024/06/RAK11720-Quick-Start-Guide_20240223.pdf)

Pin no: 4
Name: GP39/UART0_TX

Pin no 5:
Name: GP40/UART0_RX

Which of these names to use in the sketch? 5, GP40, UART0_RX or P40?

#define SWITCH_PIN   P40

void setup() {
  pinMode(SWITCH_PIN, INPUT_PULLUP);
}

To make a simple test if I the names in the sketch are correct I made this simple sketch:

#define SWITCH_PIN   P40

void setup() {
   Serial.begin(115200);
  delay(5000);
  pinMode(SWITCH_PIN, OUTPUT);
}

void loop() {
    Serial.println("Test with HIGH and LOW");

    Serial.println("Setting to HIGH, and waiting 5 seconds");
    digitalWrite(SWITCH_PIN, HIGH);
    delay(5000);

    Serial.println("Setting to LOW, and waiting 5 seconds");
    digitalWrite(SWITCH_PIN, LOW);
    delay(5000);
}

Then measured with multimeter between GND and TX0 on the WisBoard as well as GND and RX0, but the pins had no voltage.

You can find all pin assignments in the variant.h in the BSP.

I am probably doing something wrong
I am using RAK19003 Base board + RAK11720 module
I checked RAK-APOLLO3-RUI/variants/WisCore_RAK11720_Board/variant.h at main · RAKWireless/RAK-APOLLO3-RUI · GitHub and see that

#define P39                39//UART0_TX
#define P40                40//UART0_RX
#define P42                42//UART1_TX
#define P43                43//UART1_RX

So I run this sketch

// Hardware: RAK19003 Base board + RAK11720 module

void setup() {
    Serial.begin(115200);
    Serial.println("5 second delay..");
    delay(5000);

    pinMode(P39, OUTPUT);
    pinMode(P40, OUTPUT);
}

void loop() {
    digitalWrite(P39, HIGH);
    digitalWrite(P40, HIGH);

    delay(5000);
}

Then I measure the voltage between GND and TX0 on the RAK19003, but it is at zero. Both for RX0 and TX0.

What did I miss here?

Two possible options:

(1) RAK19003 PCB version:
What version is your RAK19003 Base Board?

If your board is a Ver.B, then the pins are RX1 and TX1 ==> GPIO 43 and GPIO 42

If your board is a Ver.C or newer, then the pins are RX0 and TX0 ==> GPIO 40 and GPIO 39

(2) It could be that the two pins are fixed assigned to UART functionality by RUI3 and you cannot use them as GPIO’s. I cannot confirm this 100%, but it has a high possiblity.

The revision of RAK19003 is E, which should mean that I am using the correct pins.

I don’t necessarily need these specific ones, but I need to connect one GPIO input (a switch) to the RAK19003 board. It would be strange if there are non such pins available.
The pins on the baseboard seem to be
VDD
GND
SCL
SDA
BOOT
GND
TX0
RX0

If there is space to have GND twice then there should be space to have at least one GPIO pin.

On the CPU module itself there is also
3V3
SWIO
SWCLK
GND
RESET

I have one 3 axis accelerometer connected to the RAK19003 as well.

From top to bottom, obviously skipping VDD and GND pins:

SCL/SDA ==> As you are using an acceleration sensor as well, SCL and SDA are in use.
BOOT does work
TX0 and RX0 do not work, because assigned to Serial1.

The pins on the Core module are for a JLINK adapter. You cannot use them as GPIO’s

Aha, so BOOT might work, nice!

Seems it is

#define P41                41//BOOT0 - SWO

And it works!
Thank you very much, now I can use this as I thought.
In the next revision it would be nice if there is room to expose maybe even 2 GPIO pins to make the board more flexible with different use cases.