I did a post a the end of last year on writing Flappy Bird in Sniff, to run an Arduino with an 8x8 led matrix screen. Following on from that I got very excited about the potential for running more complex games on such a simple screen. Having only 64 pixels to work with really focuses the gameplay and makes you think about every pixel. I started thinking of the possibility of designing a workshop session around these sort of games, and have a pretty near finalised design for a handheld "games console" that's easy to put together and is great fun to code for. However before I got to that stage I investigated lots of hardware options for what to use for the screen.
I started with a fairly common board with an 8x8 matrix of red leds driven by a max7912 chip. We already supported them in Sniff. Clk and Din connect to the SPI pins on an Arduino (or other controller), while you can connect CS to any control pin. Using SPI means it really only uses one pin (as the others can be shared), and its super fast, though as its only pushing out 8 bytes of data that's not really an issue (not worrying about drawing performance is a big win, as Arduino's struggle to push data out to bigger screens). What's especially nice is that you can daisy chain the boards, connecting the output from one to the input of the next to make a bigger display. Sniff is set up to handle up to four of these boards side by side - the shape of the board prevents them being stacked vertically.
To code for them just make a display device, and do some drawing:
make display maxMatrix device D10
make displayX number
make displayY number
make displayColor number
when start
.set displayColor to 000
.tell display to "clear"
.
.set displayColor to 700
.set displayX to 1
.set displayY to 1
.tell display to "move"
.set displayX to 8
.set displayY to 8
.tell display to "draw"
The pixels are numbered 1-8, rather than 0-7 as its really critical that you make every pixel count. Normally it doesn't matter than screens start at 0, but in this case numbering from 1 is more "Sniff like".
We were able to get recognisable versions of breakout, space invaders, snake, flappy bird, and most impressively defender running on this. It's a great board, and easy to find for under £2.
Working with these boards revealed that 8x8 was plenty of resolution to get some interesting game play, but trying to display multiple things on screen made them indistinct. It wasn't that we needed more pixels but that we couldn't distinguish what different pixels were supposed to be. For that reason we started looking into coloured displays.
The Colorduino is an all in one system, specifically designed to drive full colour an 8x8 rgb matrix with 8bit per channel colour depth (rather than just being on or off). The board is an arduino compatible, with headers laid out so that an rgb matrix drops straight on top of it. Shopping around I was able to get the board and a matrix for under £10, which is pretty reasonable (though i regularly encountered prices FAR higher that that). Not only is the display full colour , its huge - twice the height and width of the regular Max matrix.
To use it, just change the first line of the above code to:
make display colorduino device
and you're good to go. Compile and download using uno-sniff and it should just work like a normal Uno.
There's lots to like, but there are a couple of downsides. Most significantly is the limited I/O pins left available after the RGB matrix has been plugged in. On the side of the board are D0,D1,A4 and A5 (aka tx/rx and i2c data/clock). While this is a good selection it can be limiting. There's also no USB support on the board, so you need a USB/serial adapter to program it. These are only a couple of pounds and I keep a few around "for emergencies", so this should be no obstacle if you're using one for your own projects, I decided it was a bit fiddly for a workshop, as I didn't fancy getting a room full of kids to wire up serial pins compared to the simplicity of plugging in a USB cable. The extra cost also pushed it to the edge of what the budget for our workshops would allow.
Everyone loves neoPixels, and the only thing better than neoPixels is MORE netPixels arranged in an 8x8 grid. While these are expensive from mainstream suppliers, again we managed to find them for under £10. You'll need to add an Arduino to that, but they look amazing. Unfortunatly ours have got lost in the post, so we haven't been able to play with them yet. As soon as they arrive we'll have a device driver for them which lets you use them with the standard drawing commands, but for now you'll need to drive them using the standard ws2812 code.
As they're neoPixels these have the advantage of only using 2 pins on our controller, and are full colour. They're even BIGGER than the colorduino, which on the one hand is great, but they're perhaps getting a little too large (and expensive) for what we had in mind.
The final board gets back to the simplicity if the original Max single colour boards, but just steps it up a little. The tm1640 matrix is hard to find, but is available for about £4, and rather than being full colour, each of the pixels is a bi-colour LED - red and green. Each of the channels is a single bit, so they can be on or off, giving only four options: black, red, green and orange/yellow. However on my board the orange is a bit of a disappointment, being hard to distinguish from red. Despite that just having red and green opens up the options considerably, and everything looks really great.
The other limitations on this board are that it has no mounting holes and the chip is on the bottom, making it hard to attach to stuff, and there's no through pins like the max, so you can't easily connect several of them to make a larger display.
The pins on the board are unlabelled, and it took us a while to confirm the pinout, but once we had that is an easy hookup - just power, data and clock. The board is smaller than the colorduino, but larger than the Max, making it a great size. Coding works exactly the same - just use:
make display tm1640Matrix device
All things considered this was our favourite board - just enough of a step up from the original red max matrix to be exciting, without being too big or expensive.
So here it is in operation in our Arduino powered handheld game console!
So here it is in operation in our Arduino powered handheld game console!
What do you reckon to an LCD mini display next?
ReplyDeleteTrouble is the options are really the 128x64 oled, or the nokia 5110 screen. Both are very functional, and actually work well, but they're small and unimpressive - not "fun".
DeleteAnything bigger and you can't double buffer them - particularly if they're colour. Then refresh becomes an real problem and you have to code very carefully to avoid terrible flicker. The great thing about coding games on the 8x8 matrix is you don't really have to worry about performance or memory.
It might be possible to do something with a Nucleo n411 instead of an Arduino which has enough ram and might be fast enough to push the data out to a screen in reasonable time.
LED screen rental have been integrating new technology space and have significantly enhanced their pixel quality, these pixel quality have been the enhancers for the product companies and to create a lasting impression before the potential audience. LED display
ReplyDeleteYour composing is purely awe-inspiring that I desired to read such high quality material...
ReplyDeletego to this site
YUCHIP LED screen panel includes Transparent LED Screen, LED Poster, HD LED Screen, Rental LED Display, Outdoor & Indoor LED Screen and more. LED Display
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteNew customers can use promo code to get a discount. Apart from charging affordable rates for their services, the company also runs discounts for its customers https://expertpaperwriter.com/essaypro-com-review/. Once you set up a new account, you can take advantage of them immediately. The code allows you to enjoy 10% off of the total price of the paper.
ReplyDelete