Pycom LoPy4 šŸ‘ Basic Functionality

Maybe this will help someone. Looks like thereā€™s some interest out there. After initially trying 1.3.16 with no success, I rolled back to 1.2.65 and got the Pycom LoPy4 working. I havenā€™t tried since 1.3.17 was released. Preliminary tests pass on 1.3.17 alpha on Android communicating with TBeam.

Unfortunately, I started messing with this the day before Pycom announced these boards are end of life (still shipping through Q4 2022). :laughing:

This was hastily built and superficially tested on Android. The basics seem to work. It has not been thoroughly tested, and Iā€™m posting it in case I get distracted.

variant.h

#undef GPS_RX_PIN
#undef GPS_TX_PIN
// #define GPS_RX_PIN 36
// #define GPS_TX_PIN 33

#define I2C_SDA 12 // I2C pins for LoPy4
#define I2C_SCL 13

// #define RESET_OLED 16 // If defined, this pin will be used to reset the display controller
// #define LED_PIN 0 // If defined we will blink this LED
#define PIN_NEOPIXEL 0

// #define BUTTON_PIN 0 // If defined, this will be used for user button presses

// Pin definition in LoPy4 Manual is incorrect. See link to errata:
// https://forum.pycom.io/topic/3403/wiring-of-dio-pins-of-lora-sx127x-chip-to-esp32/4?_=1655162492722
// https://forum.pycom.io/topic/3483/erratum-in-lopy4-specification-document
// LoPy (original, not 4) pin definition:
// https://forum.pycom.io/post/20460

#define USE_RF95
#define LORA_DIO0 23 // Note: All DIO are wired through a diode bridge to a single pin
#define LORA_RESET -1 // Not connected on LoPy4
#define LORA_DIO1 23 // Not really used
#define LORA_DIO2 23 // Not really used
variant.h untested options + additional comments
// In transmitting, set TXEN as high communication levelļ¼ŒRXEN pin is low level;
// In receiving, set RXEN as high communication level, TXEN is lowlevel;

// Before powering off, set TXEN态RXEN as low level.

/* #define LORA_RXEN -1 // Input - RF switch RX control, connecting external MCU IO, valid in high level

#define LORA_TXEN -1 // Input - RF switch TX control, connecting external MCU IO or DIO2, valid in high level

// RX/TX for RFM95/SX127x
#define RF95_RXEN LORA_RXEN
#define RF95_TXEN LORA_TXEN
// #define RF95_TCXO <GPIO#>

#undef RF95_SCK
#define RF95_SCK 5
#undef RF95_MISO
#define RF95_MISO 19
#undef RF95_MOSI
#define RF95_MOSI 27
#undef RF95_NSS
#define RF95_NSS 18 */

// ratio of voltage divider = 3.20 (R1=100k, R2=220k)

// #define ADC_MULTIPLIER 3.2

// #define BATTERY_PIN 13 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage

platformio.ini
; Meshtastic Pycom Lopy4
[env:lopy4]
board = lopy4
extends = esp32_base
build_flags =
  ${esp32_base.build_flags}
  -D PRIVATE_HW 
  -I variants/lopy4

Notes

  • Saw the neopixel referenced in variant.h for another device, but didnā€™t even begin to figure out how to use it to signal useful information.
  • To load firmware, jumper P2 to GND
2 Likes
~/Meshtastic-device $ grep PIN_NEOPIXEL -ri *
variants/lora_relay_v1/variant.h:#define PIN_NEOPIXEL (8)
variants/lora_relay_v2/variant.h:#define PIN_NEOPIXEL (8)
~/Meshtastic-device $

This was probably some future extensionā€¦ :slight_smile:

1 Like

The board does have a built in ws2812, which I gather is the same as a neopixel, so would be cool to utilize it.

1 Like

Yes, but there is no code in the Meshtastic firmware to do it. The #define is there but nothing to act on it. Pull Requests are of course welcome. :slight_smile:

Nice, that probably means this works too: PyGo1 - Pycom - LoRa, LoRa MESH, Sigfox, WiFi and Bluetooth

1 Like

I know it is kind of late, do you have any update on the lopy4? I was able to build and flash it. But it seems it is not working properly.

I was using the latest source from github.

Anyway. I think mostly it is working fine, last time it was my problem.

Now hooked up I2C OLED display and Button on GPIO0. It worked perfectly.

Next will try out the GPS on the UART.