Skip to content

BrickPico User Guide

Timo Kokkonen edited this page Jan 17, 2024 · 12 revisions

BrickPico User Guide

Bricpico is a smart PWM LED controller based around Raspberry Pi Pico (RP2040 MCU). Brickpico is mainly meant to controlling various LED lights on LEGO models (LEGO Light Kits), but can be used to control any other (low current) LED lights or other small loads).

Brickpico operates as standalone controller that incorporates programmable timer to turn lights on/off on a schedule. BrickPico is an Open-source hardware (OSHW) project.

BrickPico Diagram

Connectors and Jumpers

Connector Description Notes
J1 DC Power Input (DC Barrel Jack) Allows easily connecting 12V DC power supply using 5.5mm (OD)/2.1mm (ID) plug.
J2 DC Power Input (Screw Terminals) For directly connecting wire.
J3 SPI (LCD) connector For future use to expand functionality (current firmware does not use this).
J4 I2C (OLED Display) connector Current firmware supports 128x64 and 128x128 OLED displays.
J5 TTL (3.3V) Serial Alternate to USB connection for configuring BrickPico.
J6 2.54mm (Dupont) pin header for outputs For connecting LED lights to outputs using 0.1" pin (Dupont) cables.
JP1 Output Voltage Selector (5V / 3.3V) For selecting nominal voltage for output connectors.

LED Indicator Lights

LED Name Description
D18 DC IN Indicates that board is receiving input power.
D21 VSYS Indicates that Pico is receiving power.
D22 DC OUT Indicates that outputs are receiving power.
D23 OUTPUT 1 Indicates that output 1 is on.
D25 OUTPUT 2 Indicates that output 2 is on.
D27 OUTPUT 3 Indicates that output 3 is on.
D29 OUTPUT 4 Indicates that output 4 is on.
D31 OUTPUT 5 Indicates that output 5 is on.
D33 OUTPUT 6 Indicates that output 6 is on.
D35 OUTPUT 7 Indicates that output 7 is on.
D27 OUTPUT 8 Indicates that output 8 is on.

Powering BrickPico

BrickPico (unit itself) needs DC power supply. Recommended power supply voltage is 12V (DC), this allows relatively long power cable without voltage drop being an issue. When not using very long power cable, 9V (DC) power supply can work fine as well.

  • DC Input voltage range: 7-15 V
  • DC Input nominal current (at 12V):
    • BrickPico-08: 1A
    • BrickPico-16: 2A

There is two power connectors to choose from:

  • DC Barrel Plug (5.5mm/2.1mm) [JP1]
  • Screw Terminal Blog (for connecting bare wired) [JP2]

Installing/Upgrading Firmware

Latest pre-compiled firmware image can be found here: Releases

Selecting Firmware Image

Each release (zip file) contains multiple different firmware files. Make sure to select firmware for the board you're using and for the pico model ("pico_w" if using Pico W).

Firmware file names have format: brickpico-<board_model>-<pico_model>.uf2

brickpico-08-pico.uf2
brickpico-08-pico_w.uf2
brickpico-16-pico.uf2
brickpico-16-pico_w.uf2

Installing New Firmware Image

Firmware installation steps:

  • Connect Pico to a computer using Micro USB cable.
  • Boot Pico into UF2 bootloader. This can be done in two ways:
    • Press and hold BOOTSEL button and then press and release RESET button.
    • Issue command: SYS:UPGRADE
  • Copy firmware file to the USB mass storage device that appears.
  • As soon as firmware copy is complete, Pico will reboot and run the BrickPico firmware.

Installation

BrickPico has 4 mounting holes that or grounded, so it is generally safe to mount it directly to a metal enclosure using metal screws/mounting posts. But it is fine to use plastic mounting posts/screws if desired.

falcon-back-small

Connections

When installing BrickPico in a display (or inside a larger LEGO model), following connections are typically needed:

  • DC Power (this can be either bare two conductor wire or ready made power cable with DC Barrel Jack).
  • Connect various lights to output connectors.

Note, each output (channel) has three different connectors:

  • JST SUR (0.8mm): This is what most LEGO Light Kits use (Light My Bricks, etc.)
  • JST SRS (1.0mm): This is larger connector that some LEGO Light Kits use (BrickStuff "large" connector)
  • 0.1" (2.54mm) "Dupont" header

Cabling

Each output port is capable of supplying upto 200mA, which is typically more than enough to power entire LEGO Light Kit, but always check the power requirements. BrickPico can be used to power/control multiple LEGO Light Kits (displays), or larger Ligtht Kit could be modified (split) into multiple separately controlled sections.

If splitting pre-made Light Kits, its often necessary to obtain extra connecting ables and "expansion" boards to be able to split the existing kit to multiple smaller kits (that are then connected to output ports on BrickPico).

Configuring BrickPico

To configure BrickPico USB connection is needed. So it may be good idea to configure BrickPico before installing it a display (etc.), or plan on leaving easy access to the USB port on BrickPico.

Connecting to BrickPico (serial) console

First we need to get connected to the console. For this any terminal emulation program will do.

On Windows PuTTY is one good option. On Linux and MacOS "tio" is easy to use.

To validate that connection is working we can issue *IDN? SCPI command to request instrument to identify itself.

Using PuTTY

Using PuTTY makes connecting to BrickPco console rather easy. Just need to set COM port and baudrate (115200).

In this example BrickPico got assigned "COM5" so we select COM5 as serial line and 115200 as speed:

brickpico-putty

Additionally, enable local echo and editing under Terminal settings if you wish to see what you're typing when issuing commands:

putty-localecho

Next click "Connect" to open serial console window:

brickpico-idn

Using tio

With tio we can specify speed (baud rate) from command line along with local echo.

On Linux RaspberryPi Pico usually gets device name like /dev/ttyACM0, while on MacOS it gets name like /dev/cu.usbmodem833101.

tio

Basic Configurations Steps

After we have working connection to the device, we can start configuring it using.

See Command Reference for full list of available commands.

Example configuration given here is based on installing (modified) light kit from Light My Bricks on a LEGO USC Millennium Falcon set.

Clear Any Existing Configuration

First step should be to clear existing configuration (if any) from the device. So we start from a known default state.

This can be done by issuing CONF:DEL command and then rebooting the unit by using *RST command:

CONF:DEL
*RST

Initial Setup

Local Echo

If configuring BrickPico manually then it can be desirable to enable "local echo" feature, this causes BrikPico to echo all typed characters back, this allows seeing commands when typing them in. Note, if enabling local echo, then generally you won't want to have local echo enabled on terminal program (PuTTY, tio, ...).

SYS:ECHO ON
Default Logging Level

By default BrickPico does not output any responses or error messages to commands. To be able to see information about system state, logging level can be adjusted using SYS:LOG command.

Setting logging to "NOTICE" level provides feedback on failing commands, etc, while "INFO" provides more verbose information about system status and state changes.

SYS:LOG NOTICE

Name System and Outputs

Next we will want to name our unit and the outputs.

System Name

First we set name for our system (BrickPico unit). This name shows up in the web UI.

SYS:NAME UCS Millennium Falcon
Output Names

Next, we set names for the outputs we are going to be using (and mark any unused outputs as "Unused").

CONF:OUTPUT1:NAME Main Lights
CONF:OUTPUT2:NAME Engine Lights
CONF:OUTPUT3:NAME Interior Lights
CONF:OUTPUT4:NAME Weapon Systems

Configure Default Brightnesses

Each output "brightness" can be controlled. Now we set (power on) default brightness for each of the outputs.

CONF:OUTPUT1:PWM 60
CONF:OUTPUT2:PWM 40
CONF:OUTPUT3:PWM 15
CONF:OUTPUT4:PWM 100

Configure Default Power (ON/OFF) State for Outputs

If we wan't to have some outputs be on when system is powered on, this can be done as follows:

CONF:OUTPUT2:STATE ON

Save Configuration

After making changes to system configuration it must be saved (into flash memory on Pico/Pico W). Otherwise any changes made will be lost when unit is reset.

CONF:SAVE

Timer Configuration

BrickPico has basic timer functionality allowing specifying rules to turn output(s) on/off at specified times.

Adding Timer Rules

Command CONF:TIMERS:ADD is used to add timer events.

Example (turn outputs 1 through 4 on 8pm on weekdays and 6pm weekends):

CONF:TIMERS:ADD 00 20 1-5 ON 1-4 Weekdays 8pm
CONF:TIMERS:ADD 00 18 0,6 ON 1-4 Weekends 6pm

Example (turn all outputs off always at midight)

CONF:TIMERS:ADD 00 00 * OFF * All off at midnight

Verify current settings:

CONF:TIMERS?
1: 00 20 1-5 ON 1-4 Weekdays 8m
2: 00 18 0,6 ON 1-4 Weekends 6pm
3: 00 00 0-6 OFF 1-8 All of at midnight

Network (WiFi) Configuration

If using Pico W in FanPico, then it is possible connect unit to network.

See BrickPico Web Interface wiki page for details on configuring network.