Skip to content

A repository to store MicroPython and Arduino based applications for ESP32 based boards from Heltec Automation

License

Notifications You must be signed in to change notification settings

CodeMetalAI/iot-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This repository contains MicroPython, CircuitPython, and Arduino based applications and any necessary software for Raspberry Pi Pico from Raspberry Pi Foundation and ESP32 based boards from Heltec Automation.

Handy links to sections:

Hey, if you are beginner to IoT, ESP32 programming and have not heard these things before, don't worry! We have a doc that captures step-by-step instructions to get LoRa-based Send/Recv working with these boards. Additionally, Raspberry Pi documentation is quite useful.

Raspberry Pi Pico is a low-cost, high-performance microcontroller board with flexible digital interfaces.

The Raspberry Pi Pico family, referred to as Pico or Pico 1, comes in 4 variants: Pico, Pico H, Pico W, Pico WH. While the second-generation Raspberry Pi Pico family, referred to as Pico 2, comes in the following variants: Pico 2 and Pico 2 W. W stands for Pico containing 2.4GHz wireless interfaces (802.11n) using the Infineon CYW43439. While H stands for Pico with pre-soldered headers.

Overall, some of the key features of Pico family of microcontrollers include:

  • RP2040 or similar microcontroller chip designed by Raspberry Pi in the United Kingdom
  • Dual-core Arm Cortex M0+ processor, flexible clock running up to 133 MHz (Pico 1)
  • on-board memory, USB support, low-power modes, GPIO pins, clock and timer on-chip,
  • temperature sensor

Additional Details:

This board contains following components:

  • CPU - ESP32-S3FN8 (datasheet). ESP32-S3 is a low-power MCU-based system on a chip (SoC) with integrated 2.4 GHz Wi-Fi and Bluetooth® Low Energy (Bluetooth LE). It consists of a high-performance dual-core microprocessor (Xtensa® 32-bit LX7), a ULP coprocessor, a Wi-Fi baseband, a Bluetooth LE baseband, RF module, and numerous peripherals.
  • LCD Display: Onboard 0.96-inch 160*80 dot matrix TFT LCD display, based on ST7735
  • UC6580 (GPS SoC): via GNSS (also other satellite systems - QZSS, GLONASS, NAVIC, Galileo)
  • SX1262 (LoRa transceiver) - 868MHz frequency, about -139dBm high sensitivity, +20 dBm power output, high reliability, transmission distance (measured open area communication distance 3.6Km).

Additional Details:

This board contains following components:

  • CPU - ESP32-S3FN8 (datasheet). ESP32-S3 is a low-power MCU-based system on a chip (SoC) with integrated 2.4 GHz Wi-Fi and Bluetooth® Low Energy (Bluetooth LE). It consists of a high-performance dual-core microprocessor (Xtensa® 32-bit LX7), a ULP coprocessor, a Wi-Fi baseband, a Bluetooth LE baseband.
  • OLED Display: Onboard 0.96-inch 128*64 dot matrix OLED display, based on SSD1306
  • SX1262 (LoRa transceiver) - 868MHz frequency, about -139dBm high sensitivity, +20 dBm power output, high reliability, transmission distance (measured open area communication distance 3.6Km).
  • Integrated CP2102 USB to serial port chip,
  • Onboard 32MByte Flash

Additional Details:

Software

Below we list the necessary Python and Arduino software for the boards mentioned above.

Base Python software

  • A good IDE for writing MicroPython or CircuitPython programs is Thonny.
  • Raspberry Pi Pico supports MicroPython. Its firmware can be found here.
  • Heltec Wireless Tracker supports MicroPython only. Its firmware can be found here.
  • Heltec Wifi LoRa V3 board supports both MicroPython (shared above) and CircuitPython that can be found here.

Firmware for Raspberry Pi Pico can be installed via UF2 bootloader by holding down the BOOTSEL button while plugging the board into USB. The UF2 file should then be copied to the USB mass storage device that appears.

Firmware for Heltec boards can be flashed on the board using esptool.py as:

pip install esptool.py
# To erase flash on first use
# Find the port under /dev
esptool.py --chip esp32s3 --port <port> erase_flash
# To flash downloaded firmware
esptool.py --chip esp32s3 --port <port> write_flash -z 0 <downloaded_file>
  • MicroPython or CircuitPython application may require particular libraries to be installed (mentioned in Applications below). These libraries can be installed by navigating to Tools -> Manage plug-ins in Thonny IDE.

Arduino software

Install Arduino IDE from here.

Installing specific Arduino libraries for Raspberry Pi Pico

These libraries cover various sensors that are typically used with Raspberry Pi Pico. Feel free to skip libraries for sensors that you may not be using.

arduino-cli core update-index && \
arduino-cli core install \
        --additional-urls https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json \
        RP2040:rp2040 && \
arduino-cli lib install "Adafruit NeoPixel" && \
arduino-cli lib install "HCSR04" && \
arduino-cli lib install "MFRC522" && \
arduino-cli lib install "Adafruit MPR121" && \
arduino-cli lib install "Adafruit MPU6050" && \
arduino-cli lib install "DHT sensor library" && \
arduino-cli lib install "IRremote" && \
arduino-cli lib install "Servo" && \
arduino-cli lib install "Adafruit ImageReader Library" && \
arduino-cli lib install "Adafruit SH110X" && \
arduino-cli lib install "ArduinoBLE" && \
arduino-cli lib install "RotaryEncoder" && \
arduino-cli config set library.enable_unsafe_install true && \
arduino-cli lib install --git-url https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library.git && \
arduino-cli lib install --git-url https://github.com/jarzebski/Arduino-MPU6050/ && \
arduino-cli lib install --git-url https://github.com/wonho-maker/Adafruit_SH1106.git && \
arduino-cli config set library.enable_unsafe_install false

After installation, select Raspberry Pi Pico in tools/Board or by clicking drop-down box near top-left corner of IDE. After installation, select appropriate board and port as here.

Installing specific Arduino libraries for Heltec boards

Install necessary Arduino libraries Heltec boards as below.

arduino-cli core update-index && \
arduino-cli core install esp32:esp32 && \
arduino-cli lib install "Heltec ESP32 Dev-Boards" && \
arduino-cli lib install "Heltec_ESP32_LoRa_v3" && \
arduino-cli lib install "Adafruit GFX Library" && \
arduino-cli lib install "Adafruit SSD1306" && \
arduino-cli lib install "Adafruit ST7735 and ST7789 Library" && \
arduino-cli lib install "Adafruit Unified Sensor" && \
arduino-cli lib install "Adafruit BME280 Library" && \
arduino-cli lib install "ESP8266 and ESP32 OLED driver for SSD1306 displays" && \
arduino-cli lib install "LiquidCrystal" && \
arduino-cli lib install "LoRaRF" && \
arduino-cli lib install "EByte LoRa E22 library" && \
arduino-cli lib install "EByte LoRa E220 library" && \
arduino-cli lib install "EByte LoRa E32 library" && \
arduino-cli lib install "TinyGPSPlus" && \
arduino-cli lib install "TFT" && \
arduino-cli lib install "TFT_eSPI" && \
arduino-cli lib install "ArduinoJson" && \
arduino-cli lib install "PubSubClient" && \
arduino-cli lib install "Crypto" && \
arduino-cli lib install "Chrono" && \
arduino-cli lib install "Base64"

One of the LoRA libraries require a special treatment because of a symbol name conflict between a popular LoRa library and Heltec's LoRa APIs. Install this special library as:

arduino-cli config set library.enable_unsafe_install true && \
arduino-cli lib install --git-url https://github.com/nhasabnic/arduino-LoRa && \
arduino-cli config set library.enable_unsafe_install false
  • For Heltec Wireless Tracker, select Heltec Wireless Tracker in tools/Board or by clicking drop-down box near top-left corner of IDE.
  • For Heltec Wifi LoRa V3, select Heltec WiFi LoRa 32 (v3) in tools/Board or by clicking drop-down box near top-left corner of IDE.
  • After installation, select appropriate board and port as here.

Applications

Below we list the applications, their language, and necessary library dependencies to get them working.

Apps for Raspberry Pi Pico

Below we provide some MicroPython based applications for Raspberry Pi Pico board. We also list any necessary software libraries required for those applications.

Component File Board Language Necessary software
Display lcd_hello_world.py RaspberryPi Pico MicroPython pico_i2c_lcd
lcd_api.py RaspberryPi Pico MicroPython Standard MicroPython
LEDs led_blink.py RaspberryPi Pico MicroPython Standard MicroPython
external_led_blink.py RaspberryPi Pico MicroPython Standard MicroPython
RGB color strip rgb_color_strip_patterns.py RaspberryPi Pico MicroPython adafruit_circuitpython_neopixel
Motion sensor motion_sensor.py RaspberryPi Pico MicroPython Standard MicroPython
passive_ir_sensor.py RaspberryPi Pico MicroPython Standard MicroPython
security_sys.py RaspberryPi Pico MicroPython Standard MicroPython
Ultrasonic sensor lcd_ultrasonic.py RaspberryPi Pico MicroPython picozero, pico_i2c_lcd

Apps for Heltec boards

Component File Board Language Necessary software
Display hello_world_micropy Heltec Wireless Tracker MicroPython MicroPython-ST7735, sysfont.py
hello_world_micropy Heltec Wifi LoRa V3 MicroPython ssd1306 (Install through Thonny)
hello_world_circuitpy Heltec Wifi LoRa V3 CircuitPython adafruit-circuitpython-display-text
display-demo Both boards Arduino heltec-unofficial or TFT_eSPI (Installation)
simple-demo Both boards Arduino Heltec_ESP32 or TFT_eSPI (Installation)
Wifi wifi_scan.py Heltec Wireless Tracker MicroPython Standard MicroPython Build
wifi_ap.py Heltec Wireless Tracker MicroPython Standard MicroPython Build
wifi_download.py Heltec Wireless Tracker MicroPython Standard MicroPython Build
wifi_packet_monitor.py Heltec Wifi LoRa V3 CircuitPython Standard CircuitPython Build
wifi_packet_sniffer.py Heltec Wifi LoRa V3 CircuitPython Special CircuitPython Build
wifi-scan Heltec Wifi LoRa V3 Arduino Official Arduino wifi API
wifi-client-connect Heltec Wifi LoRa V3 Arduino Official Arduino wifi API
LoRa lora_sender.py Both boards MicroPython micropysx1262x (Requires license)
lora_receiver.py Both boards MicroPython micropysx1262x (Requires license)
lora-sender Both boards Arduino Heltec_ESP32, SX126x-Arduino, (Installation) (Requires license)
lora-receiver Both boards Arduino Heltec_ESP32, SX126x-Arduino, (Installation) (Requires license)
BLE ble_connect_and_ad.py Heltec Wifi LoRa V3 CircuitPython adafruit-circuitpython-ble-adafruit
ble-scanner Heltec Wifi LoRa V3 Arduino Official Arduino ESP32 BLE library
ble-client Both boards Arduino Official Arduino ESP32 BLE library
GPS gps-basic Heltec Wireless Tracker MicroPython Standard MicroPython Build
gps-message-parser Heltec Wireless Tracker MicroPython Copy micropyGPS.py onto device
gps-test Heltec Wireless Tracker Arduino Heltec_ESP32

Disclaimer

THIS REPOSITORY CONTAINS DEMONSTRATIVE MICROPYTHON, CIRCUITPYTHON, AND ARDUINO C PROGRAMS DEVELOPED OR COLLECTED FOR THE PURPOSE OF HACKATHONS. THEY DO NOT REPRESENT CODE METAL PLATFORMS OR PRODUCTS.

About

A repository to store MicroPython and Arduino based applications for ESP32 based boards from Heltec Automation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages