DEV Community

Germán Alberto Gimenez Silva
Germán Alberto Gimenez Silva

Posted on • Originally published at rubystacknews.com on

Exploring the World of Electronic Engineering with PicoRuby

Exploring the World of Electronic Engineering with PicoRuby
Exploring the World of Electronic Engineering with PicoRuby

December 11, 2025

Based on the presentation “Exploring the World of Electronic Engineering with PicoRuby” by Hayao Kimura at Ruby World Conference 2025 .

Promote Your Brand on RubyStackNews

Reach a highly engaged audience of Ruby and Ruby on Rails developers. We offer flexible sponsorship options for companies, job boards, SaaS tools, and tech products.

  • Inline Sponsored Block — USD 20 / week
  • Sidebar Banner 300×250 — USD 100 / month
  • Article Sponsorship — USD 50 per article
  • Monthly Partner Placement — USD 200 / month Contact for Sponsorship

When people think of Ruby, they imagine expressive code, elegant APIs, and beautiful web apps—not motors spinning, sensors buzzing, or circuits glowing on a breadboard. But at Ruby World Conference 2025 , Hayao Kimura (freee K.K.) delivered a talk that flipped that assumption upside down.

His session, “Exploring the World of Electronic Engineering with PicoRuby,” showed how Ruby—yes, the same Ruby you use for Rails—can become a powerful tool for physical computing. And the best part? It makes electronics fun, accessible, and shockingly simple.

This article expands on that presentation, adds context, and enhances it with code examples and explanations to help you start your own PicoRuby journey.

Article content


Rediscovering Electronics Through Ruby

Kimura began with a relatable story: early curiosity in electronics, formal studies, then a long detour into web development. Microcontrollers felt distant… until PicoRuby brought the joy back.

The message is clear: You don’t need to be an electrical engineer to build hardware. You only need Ruby.


What Is PicoRuby?

PicoRuby is a lightweight Ruby implementation designed for tiny microcontrollers like the RP2040. What once required C, toolchains, and hours of debugging now looks like this:


led = GPIO.new(25, :OUT)
loop do
  led.on
  sleep 0.5
  led.off
  sleep 0.5
end

Enter fullscreen mode Exit fullscreen mode

Small, readable, friendly—pure Ruby.

PicoRuby gives you:

  • GPIO input and output
  • ADC (analog sensors)
  • PWM (motors, LEDs, buzzers)
  • UART, SPI, I²C
  • Interrupts
  • Almost no setup friction

You flash a .uf2 file, connect via serial, write Ruby, and start making things blink, spin, measure, or react.


The “Killer App”: Ruby for Custom Keyboards

Many developers first encounter PicoRuby through programmable keyboards. Firmware like prk_firmware makes it possible to define keymaps in Ruby. It’s an instantly rewarding entry point because your keyboard is something you use every day.

And once you realize you can program hardware in Ruby… you want to build more.

Much more.


A Hands-On Example: Building a Ruby-Powered RC Car

One of the most inspiring components of Kimura’s presentation is a fully functional remote-controlled car built with:

  • An RP2040 board running PicoRuby
  • A motor driver
  • Two DC motors
  • A joystick module
  • A handful of wires and a breadboard

It’s not just proof-of-concept—it’s simple enough for beginners and powerful enough to understand real-world hardware.


Reading a Joystick with Ruby

A joystick outputs analog voltages. With PicoRuby, reading those values feels natural:


class JoyStick
  def initialize(vertical_pin:, horizontal_pin:)
    @adc_vertical = ADC.new(vertical_pin)
    @adc_horizontal = ADC.new(horizontal_pin)
  end

  def vertical
    @adc_vertical.read
  end

  def horizontal
    @adc_horizontal.read
  end
end

Enter fullscreen mode Exit fullscreen mode

No registers. No bit shifting. No headaches.

read returns a number you can use to control the car’s movement.


Driving Motors with PWM

DC motors need PWM signals. Kimura used a dual PWM setup per motor: one signal for forward, one for reverse.


class Motor
  def initialize(positive_pin:, negative_pin:)
    @pos = PWM.new(positive_pin, frequency: 100_000, duty: 0)
    @neg = PWM.new(negative_pin, frequency: 100_000, duty: 0)
  end

  def update(duty)
    if duty >= 0
      @pos.duty(duty)
      @neg.duty(0)
    else
      @pos.duty(0)
      @neg.duty(-duty)
    end
  end
end

Enter fullscreen mode Exit fullscreen mode

Again: elegant, readable, and unmistakably Ruby.


Bringing It All Together

The Car class acts as the orchestrator, converting joystick values into motor speeds.


class Car
  NEUTRAL = 2000 # Example offset for joystick center

  def initialize
    @left = Motor.new(positive_pin: 19, negative_pin: 18)
    @right = Motor.new(positive_pin: 17, negative_pin: 16)
    @js = JoyStick.new(vertical_pin: 26, horizontal_pin: 27)
  end

  def start!
    loop do
      calculate_duty
      @left.update(@left_duty)
      @right.update(@right_duty)
    end
  end

  private

  def calculate_duty
    vertical = @js.vertical - NEUTRAL
    horizontal = @js.horizontal - NEUTRAL

    # Convert analog values into motor speeds
    @left_duty = vertical + horizontal
    @right_duty = vertical - horizontal
  end
end

Enter fullscreen mode Exit fullscreen mode

A complete, working robot—written in Ruby.

This is the magic of PicoRuby.


When Firmware Gets Easy, Creativity Explodes

Kimura showed additional projects born from playing with PicoRuby:

  • Custom keyboard mods
  • Sensor experiments
  • A hand-crafted FM radio
  • Beautifully designed enclosures and physical builds

Once firmware feels effortless, makers naturally move to the physical world: 3D printing, woodworking, analog circuits, enclosure design.

PicoRuby becomes an amplifier for creativity.


The Future of PicoRuby

The presentation closed with a roadmap:

  • Runtime Gems to reuse Ruby components directly on embedded devices
  • Better documentation for newcomers
  • A complete book on PicoRuby’s internals and practical use cases
  • Continued support for educational programs like mruby Girls Matsue 1st

The message: PicoRuby is growing—and you can be part of that growth.


Why This Matters

Kimura’s talk at Ruby World Conference 2025 revealed something profound:

Ruby is not limited to web apps. It can move motors, read sensors, and bring devices to life.

For developers who have always wanted to explore electronics but felt overwhelmed, PicoRuby is the bridge you’ve been waiting for.

You already know Ruby. Now you can use it to build robots.


Final Thought

If you’ve ever thought “I wish I could build hardware, but it looks difficult,” PicoRuby proves the opposite.

Start with an LED. Then a sensor. Then a keyboard. Then a robot.

Ruby can take you all the way.

Article content

Top comments (0)