Freetronics DMD - updated library

I recently got two Dot Matrix Displays from Freetronics - They are 32x16 LED panels that can be daisychained via SPI. It came with a quick library which worked okay but could do with a few enhancements ;) My modified library supports multiple displays (tested with 2x1 and 1x2 layout - but should work with other layouts) It also supports multiple fonts, marquee text, scrolling the display around and grayscale (grayscale sort of works - but not well :( ) I have updated the examples included in the original library to use these new functions.

Console-based podcaster - updated

It has been a while since I first posted my version of bashpodder (a console-based podcaster in a single bash script)

Since then a bunch of small fixes have been added to the script to better handle ‘odd’ rss feeds and also to clean up the output.

The configuration of the script now sits in the file ~/.bashpodder Inside this file you can specify where the logs go to and where the files download to (makes it easier to run the script automatically)

MusicXML/MIDI for Arduino

For a recent project I wanted to add music.

Being that I am not musically talented in any way I figured the best way to do this was to generate the music from a midi file.

To help with this I wrote a converter that would take a MusicXML file and output an include file.

It simply reads the XML and outputs an array where each note is stored in two uint16 values - the first is the note name as a defined in pitches.h (ie NOTE_C4), the second is the duration in milliseconds. The entire array is stored in PROGMEM so as to not use up too much ram on the AVR.

Peggy 2 multi-game sketch v0.2

I’ve done a lot more work on the multi-game sketch for my Peggy2 - mostly to add functionality and fix up a few ‘issues’ See the original post here for more details on what is included Download it from here When compiled it uses 13808 bytes so there only a bit of room to spare. I’ve added a two player version of pong (use up/down buttons to control player two - I’ve made a separate plug-in controller for player two to make things easier to use) I’ve fixed up the ‘breakout’ clone so it actually can be considered a ‘game’ :-) I also added a ‘demo’ game which just lights up all leds with a nice grayscale pattern than can be moved around via the direction buttons (press select to stop the motion) The other main thing is that it now has sound! With the release of arduino-0018 they added a function ’tone’ to generate square waves on a digital pin. I connected a piezo speaker (from a headphone) to ADC5 and generated the tones on that pin. There is intro music at the game select screen, music when displaying the score and various bips and beeps while playing the games. To make the music I wrote a small perl script to convert MusicXML files to a suitable include file (will be documented in a separate post) Adding the music and extra games meant I was hitting the space limits in the AVR so there is a bit of ‘dodgyness’ in the code so that it would fit.

Peggy 2 multi-game sketch v0.1

I had such fun writing the simple ‘snake’ game for my peggy 2 that I wrote a bunch of other games for it as well.

At the moment there is Snake, Breakout, Pong and Race.

You can download the sketch as peggy2_games_0.1.zip

When compiled it takes up 11432 bytes (it includes the ‘Tone’ library as I have started adding sound to the sketch - connect speaker to ADC5 to hear it)

Peggy 2 Character display

As mentioned in the [intlink id=“13” type=“post”]Peggy 2 Snake[/intlink] post I wrote a bunch of small utility functions to display a string on the peggy 2.

Each character is stored as a 24-bit number (held in a 32bit uint32) where each 4 bits indicates the on/off status for a row of 4 pixels. This results in allowing for a 4x6 pixel character

For example the character for the number ‘0’ is stored as 0x699996 which when spread out looks like:

Peggy 2 Snake

For Christmas my wife gave me a peggy 2 and I finally got around to building it.

[caption id=“attachment_14” align=“aligncenter” width=“199” caption=“Peggy 2 running Snake”] Peggy 2 running Snake[/caption]

It has 24x25 White LEDs with a row of 25 Red LEDs across the bottom.

By having that bottom row a different colour I can use that section for displaying score or other information

The first application I wrote for it the good old game of ‘Snake’. After writing a quick version of the game I realised it needed a bit more ‘flair’ and so added the ability to display an intro screen and score screen. To make this easier I wrote a bunch of utility functions to display characters that are stored in an array. I’ll describe how this works in a separate post as [intlink id=“15” type=“post”]Peggy 2 Character display[/intlink].

Arduino controlled lights - The Hardware

Okay - now that I have a box it is time to wire it all up.

After playing around with various methods of switching I settled on a bunch of solid-state relays connected to the arduino.

The advantage of solid-state relays over mechanical onese are that they switched quicker, are less likely to arc and don’t require any additional components to up the voltage in order to throw them.  I ended up with a bunch of FSS1-102Z relays which can be bought from jaycar for about $12 each as part SY4088.