I choosed TTGO LoRaOLED V1, and the Arduino IDE compiled and uploded the code OK.
When I tried to run the code: https://github.com/RuiSantosdotme/ESP32-Course/blob/master/code/LoRa_RFM95/LoRa_Sender/LoRa_Sender.ino
Starting Lora failed. Maybe I need to change the values for the pins used for LoRa?
//define the pins used by the transceiver module
#define ss 5
#define rst 14
#define dio0 2
I got TTGO V2.1_1.5 and TTGO V2.1_1.6
Hi.
If you’e using a board with built-in LoRa, the pin definition for the LoRa module is different.
I think this is the pinout you need to follow:
https://primalcortex.files.wordpress.com/2017/11/ttgolorapinout_v2.jpg
use the following pin definition instead:
#define ss 18 #define rst 14 #define dio0 26
Let me know if it works.
Regards,
Sara
Thank you Sara. It worked on firs try. Very good. I am now using TTGO T3 V2.1_1.5
Soon I will get from China TTGO T3 V2.1_1.6 I wonder if it will work with the same pin numbers or if I will have to change something?
Thanks again, and I will let you know when I get the 1.6 verson.
Did a siple test and put the sender in my window, and drove around. Thesignal was OK ina radiuse of about 500 meters, but when Igot to a spot withline of site about 1000 meters away I got the signal with RSSI -117 so this is promising.
Hi.
The pinout of the new version should be the same, I think. You’ll have to try when you receive it.
LoRa is great for long range. You’ll get better results in open fields (without buildings around).
Our RSSI was around -110 at 130 meters. So, you’re getting way better results.
Regards,
Sara
Now I am looking for arduino code for comunication with The Things Network. We have 14 base stations in the city, and several are in reach from my sailboat. That is my goal for the LoRa project, to send data from my sailboat when it is laing in its bay. I know a lot of friends would like the same, but I need to find arduino code I can modify for sending the date I need.
We don’t have any example that connects to TTN.
I’ve found this tutorial that you might found helpful for your projects: https://primalcortex.wordpress.com/2017/11/24/the-esp32-oled-lora-ttgo-lora32-board-and-connecting-it-to-ttn/
Also, Andreas Spiess has a great video building a cheap LoRa gateway with the ESP32. It’s not very intuitive, but it should work.
Regards,
Sara
Thank you for your help. I finely manage to get the LoRa program running. The pin mapping was my problem.
For The TTGO T3 V2.1_1.5 this works:
// Pin mapping
const lmic_pinmap lmic_pins = {
.nss = 18,
.rxtx = LMIC_UNUSED_PIN,
.rst = 12,
.dio = {26, 33, 32},
};
The second problem was to put in the EUIs right.
// Set your AppEUI and DevEUI
They have to be backwords. When I got it right it started to work. Now I can sit at my kitchen table and program with the TTGO attached to the PC, and communicate with 5 different gatways in the city 3 till 5 km away.
My house is placed 150 meters above sealevel, so that helps on the long reach.
Now I am looking at CayenneLPP.h I got som code examples and they compile OK, but I need to make som modification to make it work. Do you know where I can find the info I need?
This is the code I am looking at:
#include <TheThingsNetwork.h>
#include <CayenneLPP.h>
// Set your AppEUI and AppKey
const char APPEUI[8] = { 0xA3, 0x8D, 0x…………………. 0xB3, 0x70 };
const char *appEui = APPEUI;
const char APPKEY[16] = { 0xB4, 0x1B, 0x05, 0x36, 0x………………x7A, 0x60, 0xAA, 0xCD, 0xDB, 0x71 };
const char *appKey = APPKEY;
#define loraSerial Serial1 / / <– I think this is the important conection that I need to modify
#define debugSerial Serial
// Replace REPLACE_ME with TTN_FP_EU868 or TTN_FP_US915
#define freqPlan TTN_FP_EU868
TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan);
CayenneLPP lpp(51);
void setup()
{
loraSerial.begin(57600);
debugSerial.begin(9600);
// Wait a maximum of 10s for Serial Monitor
while (!debugSerial && millis() < 10000)
;
debugSerial.println(“– STATUS”);
ttn.showStatus();
debugSerial.println(“– JOIN”);
ttn.join(appEui, appKey);
}
void loop()
{
debugSerial.println(“– LOOP”);
lpp.reset();
lpp.addTemperature(1, 22.5);
lpp.addBarometricPressure(2, 1073.21);
lpp.addGPS(3, 52.37365, 4.88650, 2);
// Send it off
ttn.sendBytes(lpp.getBuffer(), lpp.getSize());
delay(10000);
}
That’s great that you got it working.
I’ve never worked with CayenneLPP.h, so I don’t have any experience with that.
I can only recommend the following documentation.
https://mydevices.com/cayenne/docs/lora/#lora-cayenne-low-power-payload
https://www.thethingsnetwork.org/docs/devices/arduino/api/cayennelpp.html
https://hackmd.io/s/H1lA3HLrb
I hope it helps.
Let me know if you need anything else.
Have a great weekend.
Sara