Coder Social home page Coder Social logo

d900139 / led-matrix Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marcmerlin/led-matrix

0.0 2.0 0.0 625 KB

Single/bi/tri-color LED Matrix PWM driver for arduino (direct IO or Shift Register connected)

License: Apache License 2.0

C++ 28.32% C 71.68%

led-matrix's Introduction

LED-Matrix

Single/bi/tri-color LED Matrix PWM driver for arduino (direct IO or Shift Register connected)

Blog post with video: http://marc.merlins.org/perso/arduino/post_2015-01-06_Driver-for-direct-driving-single-to-3-color-LED-Matrices-with-software-PWM.html

This code implements equivalent and additional functionality from what you get from Adafruit's https://github.com/adafruit/Adafruit-LED-Backpack-Library

Adafruit sells bi color 8x8 LED matrices with an I2C interface. They are easy to program with the adafruit library, but doing per pixel PWM is virtually impossible, which means you only get 3 colors: Red, Green, and Orange (red+green). See: http://www.adafruit.com/product/902

I wrote this driver to control raw LED matrices which is a lot more work, but provides more flexibility. My code allows you to connect the matrices directly to any arduino IO pins or via shift registers for the columns (adding shift register support for rows is easy, but I haven't done it yet since it makes the code slower and I didn't need to save extra IO pins)

Here is how my approach differs from Adafruit's: Summary: if you don't need to mix color intensities (3 colors is enough vs 256), buy adafruit's solutions, they are much simpler for you and leave CPU time and IO pins on the arduino. But if you already have raw LED matrices with no driver chip, this code is for you. Note that if you buy a MAX7219 driver chip, you'll have the same problem than the adafruit solution and will not be able to mix colors intensities. I've found that this newer chip http://www.maximintegrated.com/en/products/power/display-power-control/MAX6961.html can do bi color and 4 step PWM (not as good as my code, but not bad). You may still want to look at a MAX6960.

Pluses for my solution:

Minuses for my solution:

  • my driver does all the work in software, and requires sequencing interrupts every 150, 300, 600, 1200 microseconds on the arduino (I use binary code modulation to avoid having 16 interrupts at 150us, and only have 4 interrupts at increasing frequencies. See http://www.batsocks.co.uk/readme/art_bcm_1.htm)
  • obviously my solution requires more IO pins than adafruits (at least 5 pins for 2 colors and 6 pins for 3 colors, or many more if you don't use shift registers for extra speed)
  • my driver also uses Timer1 (which means you can't easily use PWM 9 and 10)

Required libraries:

led-matrix's People

Contributors

marcmerlin avatar

Watchers

James Cloos avatar KevinChang avatar

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.