tecznotes

Michal Migurski's notebook, listening post, and soapbox. Subscribe to this blog. Check out the rest of my site as well.

Apr 25, 2008 8:01pm

arduino atkinson

Last October I published a tiny implementation of (Bill) Atkinson dithering in Python. Aaron ran with it and created a Modest Maps filter to prepare maps for print. Now, I'm finding Atkinson dithering useful when pumping pixels through this LED matrix I bought from Sparkfun and connected to my Arduino.

This is me messing with hardware.

First off, the matrix isn't an easy thing to wire up. The datasheet provides these two diagrams:

A bunch of trial-and-error showed that the pins on the matrix are ordered from #1 in the lower left, to #12 in the lower right, up to #13 in the upper right and #24 in the upper left: counter-clockwise, one pin for each row and two pins (green, red) for each column. The pins are grouped in sets of (green, red, row) across the top and bottom, with the top pins controlling the left-hand columns and upper rows, and the bottom pins controlling the right-hand columns and bottom rows. It's necessary to know which end is up, shown by the (now rubbed-off) product code printed on the bottom of the matrix component. I think a little extra effort on Foryard Optoelectronics' part would have resulted in a matrix that was radially symmetrical, and worked identically regardless of how it was pushed into the breadboard.

You connect a column and a row from power to ground, and the corresponding LED lights up. You can address one entire row or one entire column at a time, but a full 8x8 image requires you to scan from one to the next, illuminating pixels in sets of 8 hundreds of times per second.

I don't have 16 digital outputs on the Arduino, so I can only address six rows and six columns. This is enough to beging to experiment with tiny images, like the fades from all-off to all-on and back shown here:

There are two pieces of code making that happen. The first, matrix.pde, is running on the Arduino, set up to accept incoming bytes and display them on the little screen. It's super dumb, but it's got scan lines and an off-screen buffer to reduce flicker, so I'm happy with how it works. The second, fade.py, is running on my laptop and pumping strings of binary data over a serial connection to make the pretty pictures. At the moment, it's fading from white to black and back and sending dithered versions of those images over the wire. If my math is right, it should be able to do this at least 100 times per second without breaking a sweat, so I'm thrilled with the time resolution.

I'm not yet sure where this goes next, but I'm going to try running some simple video over the wire to see whether it's even remotely recognizeable as an image.

Comments (5)

  1. This is great stuff. I've built something similar but have wanted to extend it to taking converted images and sending them over the wire as you have done. You may want to look at a serial to parallel shift register chip which would allow you to have have full control over all the rows and columns within this sketch. There is a tutorial here http://www.arduino.cc/en/Tutorial/ShiftOut and the chips are very cheap and pretty easy to get working.

    Posted by Ben on Friday, April 25 2008 10:42pm EDT

  2. Thanks Ben - that's a great tutorial, I'm ordering a few of those 595's right now. The unfortunate part of working with hardware is that you have to buy new physical components and wait for them to show up. The fortunate part is that in general, they're really cheap.

    Posted by Michal Migurski on Saturday, April 26 2008 1:17pm EDT

  3. Hah, it's interesting to see programming people come into electronics. Most components are designed to be as low-level as possible - and certainly suffer from some of the lack of user friendliness of early programming languages. In fact, high-level electronic engineering is quite an interesting prospect (arduino could be considered the vanguard).

    Posted by Chris on Saturday, April 26 2008 5:13pm EDT

  4. Chris - I totally agree. This is like a subset of etechish crowd that seem to be playing with this stuff. Mike - I don't know if you have an electronics store with this stuff in SF but its much much fun going in and selecting 2 of this chip and 1 of this... it totally reminds me of boiled lollies from when I was a kid and got 20c pocket money a week and spent ages deciding what to buy from the milk bar ;-)

    Posted by Ben on Friday, May 2 2008 5:02am EDT

  5. On the arduino you can use the analog input pins as digital outs, look in the arduino playground for direct drive 8x8 led matrix

    Posted by Justin on Saturday, May 10 2008 3:12pm EDT

Sorry, no new comments on old posts.

October 2017
Su M Tu W Th F Sa
    

Recent Entries

  1. planscore: a project to score gerrymandered district plans
  2. blog all dog-eared pages: human transit
  3. the levity of serverlessness
  4. three open data projects: openstreetmap, openaddresses, and who’s on first
  5. building up redistricting data for North Carolina
  6. district plans by the hundredweight
  7. baby steps towards measuring the efficiency gap
  8. things I’ve recently learned about legislative redistricting
  9. oh no
  10. landsat satellite imagery is easy to use
  11. openstreetmap: robots, crisis, and craft mappers
  12. quoted in the news
  13. dockering address data
  14. blog all dog-eared pages: the best and the brightest
  15. five-minute geocoder for openaddresses
  16. notes on debian packaging for ubuntu
  17. guyana trip report
  18. openaddresses population comparison
  19. blog all oft-played tracks VII
  20. week 1,984: back to the map

Archives