Category Archives: Raspberry Pi/Pico


JeegVa44 ErgoZero Split Mechanical Keyboard

JeegVa44 ErgoZero Split Mechanical Keyboard

License: GPLv3

tags: Raspberry Pi RaspberryPi Raspberry Pi Pico RaspberryPiPico MicroPython

Status: COMPLETED.

A split hand-wired custom Mechanical Keyboard based on the Waveshare RP2040-Zero.

My second keyboard designed from scratch, this time split.

Components

  • 2x RP2040 (KMK on Waveshare RP2040-Zero), USB-C port
  • 44x switches
  • 2x TRRS breakout boards
  • 1x TRRS cable
  • 28x M2 5mm screws
  • 14x M2 10mm stand-offs
  • 4x M4 Low profile brass heat inserts
  • 4x M4 6~8mm Socket cap head screws
  • 8x 10mm Rubber feet
  • 46u Round hole female pin header
  • 3D printed case, plate, feet

Story

I wanted a portable split keyboard with a gentle vertical stagger, sixth column available and four thumb keys.
I also wanted to learn more about proper CAD design, so this time I ditched Blender and I designed everything from scratch in Onshape.

Keymap (dev)

Keymap

Repository

https://github.com/slabua/keyboards/tree/main/jeegva44ergozero

3D Model

3D model of JeegVa44 ErgoZero rev1 also available on:
Onshape: [Link]
Thingiverse: https://www.thingiverse.com/thing:5866262
Printables: https://www.printables.com/model/404303-jeegva44-ergozero-rev1

Some photographs and renders


Small Form Factor RP2040 Boards

Small Form Factor RP2040 Boards

tags: Raspberry Pi RaspberryPi Raspberry Pi Pico RaspberryPiPico RP2040 MicroPython CircuitPython Arduino C/C++ Pimoroni Tiny2040 Tiny 2040 Seeed Seeed Studio XIAO XIAO RP2040 Waveshare RP2040-Zero

Introduction

Given the great potential of the RP2040 chip announced on the 21st of January 2021 as the first microcontroller designed by Raspberry Pi Ltd, more and more boards from different manufacturers have been populating the shelves of enthusiast makers.

About this article

This article will be covering the general characteristics of the RP2040 chip, and introduce three popular small form factor boards that I have been considering for some of my projects to come.

Front

Back


The RP2040 Microcontroller

At the very core of the aforementioned boards there is the RP2040 chip.

Here follows a list of its major characteristics:

Component Description
CPU: Dual ARM Cortex-M0+ @ 133 MHz
Memory: 264kB on-chip SRAM in six independent banks
Storage: Support for up to 16MB of off-chip Flash memory via dedicated QSPI bus
Architecture: DMA controller
Fully connected AHB crossbar
Interpolator and integer divider peripherals
On-chip programmable LDO to generate core voltage
2 × on-chip PLLs to generate USB and core clocks
Interfacing: 30 × GPIO pins, 4 of which can be used as analogue inputs
Peripherals: 2 × UARTs
2 × SPI controllers
2 × I2C controllers
16 × PWM channels
1 × USB 1.1 controller and PHY, with host and device support
8 × PIO state machines
Package: 7 × 7 mm QFN-56 package

Other notable properties include:

  • Supported input power 1.8–5.5V DC
  • Operating temperature -40°C to +85°C
  • Drag-and-drop programming using mass storage over USB
  • Low-power sleep and dormant modes
  • Accurate on-chip clock
  • Temperature sensor
  • Accelerated integer and floating-point libraries on-chip

RP2040 Pinout

Resources

https://www.raspberrypi.com/products/rp2040/specifications/
https://www.raspberrypi.com/documentation/microcontrollers/rp2040.html
https://datasheets.raspberrypi.com/rp2040/rp2040-product-brief.pdf
https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf

^Top


Boards

Since all of the following boards use the same RP2040 microcontroller chip, only the relevant features that have been updated by the respective manufacturers in comparison with the original Raspberry Pi Pico will be listed.

※ Describing the Raspberry Pi Pico is beyond the scope of this article.

Pimoroni Tiny 2040

Overview

Features

Component Description
Board form factor: 16 + 3 pins
Storage: 2MB or 8MB of QSPI flash supporting XiP
Interfacing: 12 × GPIO pins
4 × 12-bit ADC channels
12 × PWM
Peripherals: 2 × I2C
2 × UART
1 × SPI
SWC/SWD pins
Power, programming, data transfer: USB Type-C interface
Castellated pads allows direct soldering onto a PCB
LED: 1 × user controllable RGB LED
Buttons: 1 × BOOT button (doubles up as user input button)
1 × RESET button
Software compatibility: Micropython ・ CircuitPython ・ C/C++ ・ Arduino
Dimensions: 21.3 x 18 mm
approx 22.9 x 18.2 x 6 mm (including the USB-C port)

What makes it stand out

  • 8MB of QSPI flash supporting XiP variant available
  • User input button (doubles up as DFU select on boot)

Resources

Product page: https://shop.pimoroni.com/products/tiny-2040?variant=39560012234835

^Top

Seeed Studio XIAO RP2040

Overview

Features

Component Description
Board form factor: 14 pins
Storage: 2MB of on-board Flash memory
Interfacing: 11 × GPIO pins
4 × 12-bit ADC channels
11 × PWM
Peripherals: 1 × I2C
1 × UART
1 × SPI
1 × SWD Bonding pad
Power & Downloading interface: USB Type-C interface
Castellated pads allows direct soldering onto a PCB
LEDs: 1 × user LED
1 × user WS2812 RGB LED
1 × power LED
2 × LEDs for serial port downloading
Buttons: 1 × BOOT button
1 × RESET button
Power Pads: For the battery power supply
Software compatibility: Micropython ・ CircuitPython ・ C/C++ ・ Arduino
Cover: Cover for protecting the circuit
Dimensions: 20 x 17.5 x 3.5 mm

What makes it stand out

  • No components on the back for seamless SMD integration via castellated pads
  • Small size of 20 x 17.5 x 3.5 mm for wearable devices and small projects
  • 2 × user controllable RGB LEDs

Resources

Product page: https://www.seeedstudio.com/XIAO-RP2040-v1-0-p-5026.html
Wiki: https://wiki.seeedstudio.com/XIAO-RP2040/

^Top

Waveshare RP2040-Zero

Overview

Features

Component Description
Board form factor: 18 + 5 pins + 10 solder points
Storage: 2MB of on-board NOR-Flash memory
Interfacing: 29 × GPIO pins (9 of which via solder points)
4 × 12-bit ADC channels
16 × PWM
Peripherals: 2 × I2C
2 × UART
2 × SPI
8 × PIO state machines
Power, programming, data transfer: USB Type-C interface
Castellated pads allows direct soldering onto a PCB
LED: 1 × user controllable WS2812 RGB LED
Buttons: 1 × BOOT button (doubles up as input button)
1 × RESET button
Software compatibility: Micropython ・ CircuitPython ・ C/C++ ・ Arduino
Dimensions: 23.5 x 18 mm

What makes it stand out

  • 29 × multi-function GPIO pins
  • Full peripherals range support

Resources

Product page: https://www.waveshare.com/product/raspberry-pi/boards-kits/raspberry-pi-pico-cat/rp2040-zero.htm
Wiki: https://www.waveshare.com/wiki/RP2040-Zero

^Top


Comparison

~

Board Form Factor

  • All of the three boards are contained in a small package that can be easily fit on wearable or space constrained devices, with the smallest of them being the Seeed XIAO RP2040 and the largest being the Waveshare RP2040-Zero.

Storage

  • Other than the standard 2MB on-board flash memory, the Pimoroni Tiny 2040 is also available for purchase in the 8MB variant.

GPIO and Peripherals Interfaces

  • An impressive amount of GPIO pinout has been squeezed onto the Waveshare RP2040-Zero for a total of 29 GPIO and full peripheral support, costing only a marginal increase in form factor size.
  • The Pimoroni Tiny 2040 loses only one of the two SPI peripheral interfaces, although the number or GPIO pins is more than halved down to 12.
  • The board with least amount of available GPIO pins is, understandably, the Seeed XIAO RP2040 with only 11 GPIO pins available, keeping only one interface for each type of supported peripheral.
  • Despite the above differences, each board provides access to all of the 4 ADC channels available on the RP2040 chip.

LED

  • RGB LEDs for visual signalling are available on each board, with the Seeed XIAO RP2040 actually sporting two user controllable RGB LEDs.

Reset Button

  • Each board also comes equipped with a reset button. In this case there is no obvious winner.

SMD Integration

  • SMD integration via castellated pads is a breeze with the Seeed XIAO RP2040 as there are completely no components on the bottom of the board.

^Top


Conclusion

Each board excels on one or more different aspects.
To wrap it up:

  • Pimoroni Tiny 2040:
    • Largest storage (in the 8MB variant)
  • Seeed Studio XIAO RP2040:
    • Smallest form factor
    • 2 × user LEDs
    • SMD friendly
  • Waveshare RP2040-Zero:
    • Most available GPIOs (29)
    • Full range of peripheral interfaces

^Top


Notes

※ The XIAO RP2040 board has been generously donated by Seeed Studio as part of their currently ongoing Free Shipping campaign in 221 countries and counting.

^Top


AtreuSLB50+ Mechanical Keyboard

AtreuSLB50+ Mechanical Keyboard

License: GPLv3

tags: Raspberry Pi RaspberryPi Raspberry Pi Pico RaspberryPiPico MicroPython

Status: COMPLETED.

A hand-wired custom Mechanical Keyboard based on the Raspberry Pi Pico.

Finally I had the time to wrap up my little side project started about three months ago, and I thought to share it here. Although inspired by the Atreus, I couldn't quite find the right compromise among the non-split ergo keyboards, so I decided to make my own.

Components

  • 1x RP2040 (KMK on Raspberry Pi Pico), USB-C port
  • 50x switches
  • 1x SSD1306 128x64px 0.96in IIC OLED display
  • 2x EC11 rotary encoders
  • 1x EVQWGD001 rotary encoder
  • 1x Pimoroni IIC trackball breakout
  • 1x Active buzzer
  • 2x micro switches (bootsel, reset)
  • 3D printed case (5-10° tilt), plate, pcb

Story

The design started from a semi-automated customised process by forking an OpenSCAD hotswap pcb generator repository, subsequently heavily worked on Blender. I had also added cutouts for per-key rgb, but in the end I gave up the idea of hand wiring the LEDs. At least in this version which, for me, has been an insightful experience.
I am slowly finalising the firmware configuration and I will eventually put it on github as usual. Wiring diagram and key layout will come along later.

Keymap

[Coming Soon]

Repository

https://github.com/slabua/keyboards/tree/main/atreuslb50+

3D Model

3D model of AtreuSLB50+ rev1 also available on:
Thingiverse: https://www.thingiverse.com/thing:5458679
Printables: https://www.printables.com/model/262446-atreuslb50-rev1

Some photographs


Pico Motorcycle Dashboard

Pico Motorcycle Dashboard

tags: Raspberry Pi RaspberryPi Raspberry Pi Pico RaspberryPiPico MicroPython

Status: Currently under development.
https://github.com/slabua/PicoMotorcycleDashboard

A Motorcycle Dashboard based on the Raspberry Pi Pico and the Pimoroni Pico Display Pack.

Components

  • Raspberry Pi Pico
    • Main control board
  • Pico Display Pack
    • Input:
    • Button A
    • Button B
    • Button X
    • Button Y
    • Output:
    • 240x135 px IPS display
    • RGB LED
  • Sensors
    • Built-in temperature sensor
    • (internal ADC on pin 4)
    • DS18B20 Temperature sensor
    • (currently up to 3 in parallel)
  • Work in progress
    • Connection for Battery/Fuel/Rpm readings

Wiring Diagram

Breadboard - Full diagram

Breadboard

Breadboard - Display directly mounted on the back of the Pico (not shown)

Breadboard


Usage

Screens

Home

Home

  • A: Go to next (Battery) screen
    • If pressed again within 3 seconds,
      cycle through all the screens
  • B: Cycle Brightness presets
  • X: Select Multiple or Single Temperature mode
  • Y: If Multiple (*) or Single (**) Temperature mode:
    • Cycle Temperature sources (**)
    • Cycle bars style (*) (globally)
  • X+B: Cycle Colour palette
  • Y+B: Show Info scroll banner (hold)

Battery

Battery

  • A: Go to Home screen
  • B: Cycle Brightness presets
  • X: Continuous / Discrete battery representation
  • Y: Cycle Graphics style
  • Y+B: Show Info scroll banner (hold)

Fuel

Fuel

  • A: Go to Home screen
  • B: Cycle Brightness presets
  • X: -
  • Y: Cycle Bars style (globally)
  • Y+B: Show Info scroll banner (hold)

Temperature

Temperature

  • A: Go to Home screen
  • B: Cycle Brightness presets
  • X: Cycle Temperature sources
  • Y: Clear history for the current temperature source
  • Y+B: Show Info scroll banner (hold)

RPM

RPM

  • A: Go to Home screen
  • B: Cycle Brightness presets
  • X: Cycle Ramp style
  • Y: Cycle Bars style (globally)
  • Y+B: Show Info scroll banner (hold)

Stats

Stats

  • A: Go to Home screen
  • B: Cycle Brightness presets
  • X: Update Configuration file
  • Y: Reset uptime
  • X+B: Reset Configuration file
  • Y+B: Show Info scroll banner (hold)

A Practical Introduction to the Raspberry Pi Pico

A Practical Introduction to the Raspberry Pi Pico

tags: Raspberry Pi RaspberryPi Raspberry Pi Pico RaspberryPiPico MicroPython

Introduction

My name is Salvatore and I am a Development Engineer at 株式会社Rist.

  • Robotics team, responsible for Robotics R&D.
  • Robot design, control, motion, perception and manipulation.
  • Image analysis, recognition and classification.
  • AI algorithms design and implementation.
  • UI/UX design and implementation.

About this article

This article aims to give a quick introduction to the Raspberry Pi Pico, through simple step-by-step instructions to its setup and providing some code examples in MicroPython.

※ No soldering nor external components are required to follow this tutorial~

What is the Raspberry Pi Pico

The Raspberry Pi Pico is a microcontroller able to acquire various inputs and provide outputs through a series of GPIO pins, similar to a Raspberry Pi computer [1][2].
Microcontrollers are most suitable for embedded applications or any other situations in which the use of a full computer running an Operating System would be considered not necessary.

Environment Setup

~

User group

In order to have read/write permission to the serial port created upon connecting the Pico, the current user must belong to the dialout group.
Verify the current groups the user belongs to with:

$ groups

If the user does not belong to the dialout group, add it as follows:

# usermod -a -G dialout $USER

To make the changes effective, relog the current user to the system.

※ A reboot might be needed after performing the operation, in the case which a simple relog would not be sufficient.

Thonny and MicroPython

Proceed with the installation of the Thonny Python IDE [3]:
As of writing this article, the easiest way to get the most updated version of the IDE on a variety of linux distributions is through pip.

$ pip install thonny

※ For more information and other platforms support, visit thonny.org.

Once installed, the Thonny IDE would look similar to:

In order to control the Pico, it is necessary to switch the Python interpreter to MicroPython (Raspberry Pi Pico).

Click on the bottom right corner to switch the interpreter:
Python 3.7.9 > Configure interpreter...
Then select MicroPython (Raspberry Pi Pico) from the combo box list.

Or alternatively, from the Thonny menu, select:
Run > Select interpreter... > Interpreter > MicroPython (Raspberry Pi Pico)

Connecting the Pico to the PC

As the Pico comes out of the box, it needs to be initialised by installing the MicroPython firmware.
This can be done easily from the Thonny IDE itself.

To connect the Pico to the computer:

  1. Press and hold the BOOTSEL button on the Pico
  2. Connect the Pico to the computer via micro USB
  3. Release the BOOTSEL button

The Pico is now connected as a USB mass storage device.

MicroPython firmware installation

By clicking the Stop/Restart button on the Thonny toolbar, the IDE will connect to the Pico and it will prompt for the MicroPython firmware installation.

Proceed with the installation.

At this point, the environment setup is complete.

Code

As mentioned in the introduction, for this tutorial no external component are required.
The provided sample code will make use of the on-board power LED (GPIO 25) and the embedded temperature sensor.

LED test

Let's skip the basic LED on/off/blink tests and try the PWM controlled brightness test instead.

Create a new file and paste the following code [1]:

from machine import Pin, PWM
from time import sleep

pwm = PWM(Pin(25))
pwm.freq(1000)

while True:
    for duty in range(1024, 65025, 2):
        pwm.duty_u16(duty)
        sleep(0.0001)
    for duty in range(65025, 1024, -4):
        pwm.duty_u16(duty)
        sleep(0.0005)

By running this code, the on-board LED will pulse smoothly according to the values specified in the ranges of the duty cycles and the sleep intervals.

※ The value 65025 corresponds to the LED maximum brightness.

Temperature test

For the temperature test, use the following code [4]:

import machine
from time import sleep

sensor_temp = machine.ADC(4)
conversion_factor = 3.3 / 65535

while True:
    reading = sensor_temp.read_u16() * conversion_factor
    temperature = 27 - (reading-0.706)/0.001721
    print(temperature)
    sleep(2)

The temperature measured by the sensor will be printed in the Shell standard output every 2 seconds.

Putting it together

The following code will make the on-board LED pulse with variable speed.

from machine import Pin, PWM
from time import sleep

sensor_temp = machine.ADC(4)
conversion_factor = 3.3 / 65535

pwm = machine.PWM(machine.Pin(25))
pwm.freq(1000)

while True:
    reading = sensor_temp.read_u16() * conversion_factor

    temperature = 27 - (reading-0.706)/0.001721
    print(temperature)

    if temperature < 19:  # Lower threshold
        steps = 16
    elif temperature > 23:  # Higher threshold
        steps = 64
    else:
        steps = temperature

    for duty in range(0, 65025, int(steps**2)):
        pwm.duty_u16(duty)
        sleep(0.001)
    for duty in range(65025, 0, -int(steps**3)):
        pwm.duty_u16(duty)
        sleep(0.05)

The LED will blink in three different ways, depending on the ambient temperature measured by the on-board sensor:

  • Temperature below the lower threshold:
    • The LED pulses at a slow pace
  • Temperature within the thresholds interval:
    • The LED pulses at a pace proportional to the temperature
  • Temperature above the upper threshold:
    • The LED pulses at a fast pace

Adjust the Lower and Higher thresholds to best suit the local environment temperature.

Stand-alone operation

It is time to store the program in the Pico.

File > Save as...
And select Raspberry Pi Pico from the following dialog window:

In order to make the code run upon power up, the file must be named main.py.

※ Safe operating voltages are between 1.8V and 5.5V.

Alternatives

Recently, various boards are taking advantage of the RP2040 chip to provide custom solutions. One of them is the Seeed Studio XIAO RP2040, currently available through a Free Shipping campain in 221 countries and counting.
More on this and other tiny boards soon! Please check it out if you like.

References

[G] https://github.com/slabua/RaspberryPiPico
[Q] https://qiita.com/slabua/items/ed0a49cd587d0c8103b8
[1] https://www.raspberrypi.org/documentation/pico/getting-started/
[2] https://projects.raspberrypi.org/en/projects/getting-started-with-the-pico
[3] https://hsmag.cc/picobook
[4] https://tkrel.com/14899


Raspberry Pi – VPN Server

Connecting from the University network, I often incur into a very annoying issue, that of blocked ports. I have therefore decided to configure a personal VPN (Virtual Private Network) server where to connect to from university and have true freedom of access to whichever service I would need to use.
(more…)


Raspberry Pi – Webcam streaming

Now it's time to make my old Creative Live! Cam Vista IM (VF0260) Webcam work on the RasPi, I also tried a new Logitech C270 HD Webcam and they both work flawlessly out of the box.
I have tried three softwares for the webcam, which I previously tested on my desktop machine running Fedora and I wanted to try them also on the Pi. These are:

  • fswebcam
  • motion
  • mjpeg-streamer

Let's now have a look at them.
(more…)


Raspberry Pi – Firmware and Updates

Now that the system is installed on the SD card and the ssh service has been configured properly, we're going to take care of the system and firmware updates; few words have to be said about the system partitioning scheme.
The Raspbian installation consist of two partitions: the fat16 boot partition, that contains the firmware needed to the Pi to boot, and the ext4 system partition.
(more…)


Raspberry Pi – SSH and static IP

By the time I received my RasPi, I didn't have an usb keyboard yet, so my first concern was about how to use it without the keyboard from the very first boot. It wasn't clear whether the ssh daemon would be active by default or not, and I've also got to know that for some distributions, or even among different updates of the same distribution, its default state changed over time.
I found out that in Raspbian, ssh is installed by default but it's not configured to start up automatically since the first boot.
(more…)