PicoRuby for IoT: Connecting to the Cloud with MQTT

PicoRuby is an extremely small implementation of Ruby that can run even on microcontrollers such as the ESP32, developed by Espressif Systems. At RubyKaigi 2025, I talked about porting PicoRuby to the ESP32.

This talk is a sequel to that session. I will introduce the process of enabling PicoRuby on the ESP32 to connect to the cloud over the internet.

The ESP32 supports Wi-Fi and TCP/IP networking, making it well suited for IoT applications. For PicoRuby running on the ESP32, I implemented and refined classes such as WiFi, Socket, and an MQTT client. This work also includes secure communication using TLS and device authentication with X.509 client certificates. These implementations are portable and can be adapted to POSIX environments as well as other microcontrollers.

As a result, PicoRuby can now communicate with cloud services such as AWS IoT Core using the publish/subscribe model, making it ready for real-world IoT systems.

  • Yuhei Okazaki
    Yuhei Okazaki

    IoT Engineer at Fusic Co., Ltd. , Fjord Boot Camp Mentor, living in Fukuoka, Japan. RubyKaigi 2019 Local Organizer. My hobby is playing with ESP32.