GithubHelp home page GithubHelp logo

guruthree / microdot-pico Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 464 KB

Run a Pimoroni Micro Dot pHAT on a Raspberry Pi Pico

C++ 83.53% C 15.84% CMake 0.63%
adafruit-gfx arduino is31fl3730 micro-dot-phat raspberry-pi-pico ltp-305

microdot-pico's Introduction

microdot-pico

This is an example of getting Pimoroni's Micro Dot pHAT working with a Raspberry Pi Pico with the C SDK. The Micro Dot pHAT has three IS31FL3730 modules, each controlling two LTP-305 LED matrices.

Video clip in action:

Pimoroni Micro Dot pHAT lit up full (left) and showing Plasma Effect Demo (right)

This is an evolution of an unpublished project of using the Micro Dot pHAT with a Teensy, so as an added bonus it's built on top of the Adafruit-GFX-Library library and an existing IS31FL3730 library. Rather than implement stubs for missing bits of the Arduino IDE, this time I've just stripped out/re-written the Arduino bits of code with Pico equivalents directly in the libraries as needed.

I've also borrowed some bits of code from my own pico-composite-PAL-colour for random numbers, time, and a plasma effect demo.

Software shenanigans

Yes, I'm aware this is a derivative unholy abomination of Pi, Teensy, Arduino, and Pico. But on the plus side I've also implemented a rudimentary PWM brightness! There are 12 levels of brightness available, set as pixel values 0-12. Any more levels and the display starts flickering a lot. The number of brightness levels is controlled in MicroMatrix.h by changing the return value of getBrightnessLevels().

The IS31FL3730 chips have some control over brightness via a brightness register and current register. These are set in MicroMatrix::begin in MicroMatrix.cpp to values that are not eye searingly bright. Please refer to the IS31FL3730 datasheet for more detail.

There is also compensation for the gaps between LTP-305 modules, controlled in MicroMatrix.h by changing the value of SEGMENTPADDING. I've found a value of 3 best for things in motion, 4 for static images, and 0 if you want to use text.

Hardware setup

The Micro Dot pHAT really only needs 4 connections.

  • Pins 2 or 4 for +5V.
  • Pins 3 and 5 for I2C SDA and SCL respectively.
  • Pins 6, 9, 14, 20, 25, 30, 34, or 39 for ground.

I have connected to I2C0 on the Pico on pins 16 and 17, but these are easily changed by altering the #define SDA_PIN, SCL_PIN, or I2C_BUS at the top of microdot-pico.cpp.

I've been working with a Pico W, so if you're using a regular Pico (or other RP2040-based board) you will probably want to comment out or change the PICO_BOARD definition in CMakeLists.txt.

Note that I have the I2C bus running at 2.4 MHz, which is a touch faster than recommended for the IS31FL3730. I don't think this can cause any harm, but as always, proceed at your own risk.

Here's the setup I've been running on my breadboard. It's getting dimmer left to right on purpose, see above describing the brightness effects.

The Micro Dot pHAT wired up to Pico W on a breadboard

Usage

  1. Have a working Raspberry Pi Pico C SDK setup.
  2. Clone/download the repository.
  3. Ensure that there is a symbolic link or copy of pico_sdk_import.cmake from the Pico C SDK in the root of the repository. pico_extras_import.cmake might also be needed.
  4. Create a build directory, cd to it, and run cmake ../. (Or your build system equivalents.)
  5. Build by running make. (Or your build system equivalent.)
  6. Reset (or plug in) the Pico holding down the BOOTSEL and copy microdot-pico.uf2 to the Pico's USB mass storage device.

microdot-pico's People

Contributors

guruthree avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

idreamsi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.