Using PyCom boards with Arduino IDE

  • It appears to be easy to use PyCom boards with Arduino IDE.

    I'll show here an example for my FiPy, you have to adjust the instructions if you want to use it with other boards.

    Disclaimer: continue at your own risk! (This is not officially supported)

    First of all, here is a list of prerequisites you need to start with:

    1. Install Arduino IDE
    2. Install ESP32 Arduino core package
    3. Be able to build (verify) a simple sketch for ESP32. Select Tools->Board->ESP32 Dev Module.

    Next, I had to create a simple list of pin definitions for my peripherals (according to FiPy pinout).
    You can (for example) include it on the top of your sketches for simplicity of use.

    #define LED_WS2812B   0
    #define LTE_RTS   32
    #define LTE_TX    33
    #define LTE_RX    34
    #define LTE_CTS   35
    #define LORA_WAKE 38
    #define LORA_SS   18
    #define LORA_CLK  5
    #define LORA_MOSI 27
    #define LORA_MISO 19
    #define LORA_INT  23

    RGB LED example

    Let's start with a simple RGB led example (for this you need to install the FastLED library):

    #include "FastLED.h"
    #define NUM_LEDS 1
    CRGB leds[NUM_LEDS];
    void setup() {
      // Set console baud rate (not used here)
      // Init RGB LED
      FastLED.addLeds<WS2812B, LED_WS2812B, GRB>(leds, NUM_LEDS);
      leds[0] = CRGB::Black;;
    void loop() {
      leds[0] = CRGB::Red;;
      leds[0] = CRGB::Green;;
      leds[0] = CRGB::Blue;;
      leds[0] = CRGB::Black;;

    Next I connect my G23 -> GND + push a reset button on my FiPy to enter the firmware update mode.

    The board is connected via USB cable, so I select the corresponding Tools->Port and hit Upload:

    If upload is successful. disconnect the G23 jumper and reset the board.
    Yaaay - it should starts blinking an RGB.

    LTE modem example

    HardwareSerial SerialAT(1);
    void setup() {
      // Set console baud rate
      // Set LTE modem Serial
      SerialAT.begin(921600, SERIAL_8N1, LTE_RX, LTE_TX);
      pinMode(LTE_RTS, OUTPUT);
      digitalWrite(LTE_RTS, LOW);
    void loop() {
      while (SerialAT.available()) {
      while (Serial.available()) {

    Now I'm able to send some AT commands directly to the modem:


    What's next?

    • Other examples for Arduino & ESP32 should work, like working with the LoRa module, you could try playing with it.
    • It should also be easy to control your board over BLE or WiFi with Blynk.
    • I'm rather interested to integrate this LTE modem into my TinyGSM library, but unfortunately can't get it working even with default examples (probably some LTE service provider problem here).
    • You should also be able to run JavaScript (Espruino), or Espressif IDF (official ESP32 SDK) in the same way.

    Returning to normal

    Oh, almost forgot to mention! If you want to restore the MicroPython on your board, just follow the PyCom firmware upgrade guide. It will bring the power of Python back to you ;)


    I find it useful, at least for:

    • Educational purposes
    • Checking peripherals/modules (i.e. there's an ready-to-use Arduino driver/example available)
    • Having advanced control over the board capabilities (especially if using IDF)

  • @jmarcelino Thx. Updated my post to reflect this.

  • @volodymyr
    Thank you for your post. Yes it's possible to run any ESP32 environment such as the Arduino however this isn't officially supported by Pycom.


Hello World?

Pylife on Kickstarter - November 2018

Back Us On Kickstarter >

Pycom on Twitter