seife / lacrosse2mqtt

Lacrosse Sensors to MQTT gateway
2 stars 0 forks source link

Add compatibility to Heltec LoRa 32 v3 #2

Open ersterexitus opened 12 months ago

ersterexitus commented 12 months ago

Hello, I have a Heltec Lora 32 v3 board because a Lora 32 v2 board was no longer available. Is it possible to adapt the software for the Lora 32 v3?

seife commented 12 months ago

Yes, you'll just need to check the pin configuration. If the module is implemented properly in Arduino (pin definitions etc), it's possible that it will just compile and work. Did you try it?

seife commented 12 months ago

I pushed a "heltec-v3" branch which you can try. Build with

HELTEC_BOARD=V3 ./compile-heltec.sh -e
ersterexitus commented 12 months ago

I was using Arduino IDE with Heletec Boarddefinitions. I will try a build this evening.

seife commented 12 months ago

that might work, too, I just never test that :-)

ersterexitus commented 12 months ago

building firmware now works. But i get some errors which make sense while the v3 has sx1262. See the Serial output below:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a68
entry 0x403c98d4
WPS/WIFI UNKNOWN EVENT: 0
Station Mode Started
E (74) esp_littlefs: ./components/esp_littlefs/src/littlefs/lfs.c:1225:error: Corrupted dir pair at {0x0, 0x1}

E (75) esp_littlefs: mount failed,  (-84)
E (77) esp_littlefs: Failed to initialize LittleFS
LittleFS Mount Failed
setup_web ERROR: load_idmap() failed?
setup_web ERROR: load_config() failed?
TTGO LORA lacrosse2mqtt converter
***** SX127x init failed! ****
Disconnected from station, attempting reconnection
seife commented 12 months ago

Well, then someone with this hardware needs to fix that. I don't have the hardware, so there is not much I can do about that now.

seife commented 12 months ago

something like this:

--- a/SX127x.cpp
+++ b/SX127x.cpp
@@ -161,6 +161,7 @@ bool SX127x::init()
     }
     SPI.begin();
     uint8_t version = ReadReg(REG_VERSION);
+    Serial.printf("SX127x::init version=0x%02x\n", version);
     if (version != 0x12)
         return false;
     return true;

might help finding out what's going wrong, while I try to look at the sx127x datasheet. This should then print before the "init failed" message on the serial port.

seife commented 12 months ago

I looked into the RadioLib sources (https://github.com/jgromes/RadioLib) and it looks like the sx126x is significantly different, at least the "find the chip" is already very different by returning a string with the device name instead of a simple chipversion byte. So this is probably not easily fixed by some simple "just check for a different return value" cases.

It might make sense to port over lacrosse2mqtt to RadioLib, but I'm not really keen on doing that now (there was some reason I did not use RadioLib from the beginning, but I forgot. Maybe it was just harder to get started with it...)

Maybe the easiest way out is to use a plain ESP32 module and a separate "868MHz SX1276 LoRa Breakout Board" available readily from various sellers and wire that up to the same pins as on the TTGO Lora. The display also is simple SSD1306 i2c display available for cheap (and it is not really needed, I just implemented it because it is on the board anyway).

ersterexitus commented 12 months ago

Thanks for the info. I'll build my own with sx1276. Thank you for made this software.

ersterexitus commented 11 months ago

Just a short feedback. Software runs an sends data to my home assistant. I just added username+password to the connection string in the source code. Many thanks for providing the software