Posts | Comments

Planet Arduino

The Fuse Factory’s third annual exhibition – Ignition 3.0 – will discuss community.

Experimenters, tinkerers, creatives, performers and art and technology creators of all sorts are being sought for the Fuse Factory’s  third annual Ignition exhibition.
Theme: Community.

Ignition 3.0

Works are sought that explore both the individual and the groups with which they connect and communicate.  Artists are encouraged to submit interactive works that engage, challenge and provide unique experiences to the viewer.

We’re looking for robotics, performances, installations, short videos and films, web cam art, sculptures, stills, games, music and sound art, prints, and even paintings — to name a few.

Take us somewhere we’ve not yet been and weren’t quite expecting to go.  Let us play — and let us share our experiences with those around us.

Ignition 3.0 will take place in and around
Skylab on May 14th and 15th 2010.

Download the call for entries here.
Postmark Deadline: April 5, 2010.

Share/Bookmark

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)

Thanks to Mobilediesel it now also doesn’t create the temporary xslt file and there is the option to use ‘-a feedurl [items]‘ to add a feed to the config file.  The [items] parameter is optional and when used will cause bashpodder to mark all items in the feed as already downloaded except the last [items] items.  This is useful when added a new feed so that it doesn’t try to download every item in the feed since day one :-)

The updated script can be downloaded as bashpodder.sh and an example config file as .bashpodder

For more details on the script see the original post here

feb
15

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.

The script is as follows (or download from here)

#!/usr/bin/perl
# Convert a single-channel musicxml file to include file for arduino
# Pass the xml filename on the commandline and a .h file will be generated
# with the same name (replacing .xml with .h)

# Needs XML::Mini perlmodule (libxml-mini-perl package in debian/ubuntu)
use XML::Mini::Document;
my $size = 0;

my $name = $ARGV[0];
$name =~ s/\.xml$//;
open(OUT, ">".$name.".h");
print OUT "PROGMEM prog_uint16_t ".$name."Tune[] = {\n";

my $xmldoc = XML::Mini::Document->new();
$xmldoc->fromFile($ARGV[0]);
my $xmlHash = $xmldoc->toHash();
my $measures = $xmlHash->{'score-partwise'}->{'part'}->{'measure'};
foreach my $measure (@$measures) {
  my $notes=$measure->{'note'};
  foreach (@$notes) {
    my $note = "";
    if ($_->{'pitch'}) {
      if (defined $_->{'accidental'}) {
        if ($_->{'accidental'} eq "sharp") {
          $_->{'pitch'}->{'step'}=$_->{'pitch'}->{'step'}."S";
        } elsif ($_->{'accidental'} eq "flat") {
          $_->{'pitch'}->{'step'} =~ tr/A-F/FA-E/;
          $_->{'pitch'}->{'step'}=$_->{'pitch'}->{'step'}."S";
        }
      }
      $note = "NOTE_".$_->{'pitch'}->{'step'}.$_->{'pitch'}->{'octave'};
    } else {
      $note = "NOTE_00";
    }
    my $duration = $_->{'duration'};
    print OUT $note.", ".$duration.", ";
    $size++;
  }
  print OUT "\n";
}
print OUT "};\n";
print OUT "byte ".$name."TuneSteps = ".$size.";\n";
print "total memory usage:".(($size*4)+1)." bytes\n";
close OUT;

To actually use this generated include file I created a function ‘playMelody’ which is called regularly during the running of a sketch.

Each time it runs it checks if it is time to play the next note, if so then it reads the next note from the array,calls ‘tone’ to play it and then sets a variable to say when the next note should be played.  If it is not yet time to play the next note then it quickly returns (there is not much latency added by calling the function so it’s okay to call too often)

boolean playMelody()
{
  boolean retVal=true;
  if (millis() > time) {
    int toneVal = 0;
    int duration = 0;
    if (tuneStep >= SmoothCriminalTuneSteps) {
      retVal=false;
      tuneStep=0;
    }
    toneVal=pgm_read_word_near(SmoothCriminalTune+(tuneStep*2));
    duration = pgm_read_word_near(SmoothCriminalTune+(tuneStep*2)+1);
    tuneStep++;
    if (toneVal) tone(speakerPin,toneVal,duration*2);
    time=millis()+(duration*2)+5;
  }
  return retVal;
}

I have a sample sketch which uses this to play a short melody loop as music.zip

feb
15

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.

See the original post here for more details on what is included

RGB Lamp Kit

RGB Lamp Kit

My new kit uses an Arduino clone that I designed that I am calling “StackDuino”. For this project I designed an RGB Led board that displays various colors. The RGB board screws on top of the StackDuino.

This kit will be home brew. I will be posting the Eagle Board files shortly for anyone interested.

We are in the process of setting up a new creative space in Columbus, OH called Lifelong Labs (http://www.lifelonglabs.com) and this will be one of the first project that we work on. We should be fully operational by March.

Lifelong Labs provide “all ages” instructional workshops that explore the intersection of art & technology.  An organization created to engage enthusiast and the general public with artistic works intertwined with scientific and technological elements.

Our mission is to provide a fun atmosphere for learning that the whole family can enjoy!

Below are a few photos of the RGb Lamp. This is an open source kit, you are welcome to improve upon it. If you add to the design, please send me some photos so I can display them here.

The kit will come with the StackDuino board, RGB LED board, recycled cardboard box and battery holder. I will also be including some files to you get started with creating a simple origami box to use for the lamp shade.

YouTube Video of Lamp

The Arduino code is by Earthshine Design and can be downloaded here.

StackDuino with RGB LED Board

StackDuino with RGB LED Board

a few photos of the lamp in action to show some of the colors…

RGB Lamp with simple paper shade

RGB Lamp with simple paper shade

RGB Lamp with simple paper shade

RGB Lamp with simple paper shade

RGB Lamp with simple paper shade

RGB Lamp with simple paper shade

Share/Bookmark
feb
03

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)

Starting peggy2_game

Game menu

When you turn on the peggy2 a menu is presented displaying the available games – you can select from them using the up/down buttons and select with the ’select’ or ‘any’ button on the left of the peggy2.  Only three game names fit on the screen at once so the entire display scrolls up/down when changing game (and highlights the current selection)  To change games press the reset button.

Playing the games

Snake

SnakeLevel select

When the game first starts you can choose which level to start at.  There are four different boards available – these boards are re-used in a loop just at a higher speed for later levels.

Eat the ‘apples’ to get points, don’t hit yourself or walls

Arrow buttons control movement of the snake.

Score screen

Pong

Pong game

Hit the ball back, get a point if the AI misses, AI gets the point if you miss

Left/right buttons control movement of the bottom paddle (one player only for the moment)

Break

Breakout game

Not much here yet, just displays a bouncing ball + blocks to hit

Left/right buttons control movement of the paddle

Race

Race game

Avoid the walls.  One point every 25 blocks driven past, walls get narrower every 25 points

Left/right buttons control movement of the car.

peggy2_games.zip

So what is an arduino? An arduino is an open source open hardware programmable controller with several inputs and outputs. The image below shows an Ardunio Dicemella. It (Arduino Dicemella) has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator, a USB connection, a power [...]
gen
30

Peggy 2 Character display

Peggy 2, arduino Commenti disabilitati

As mentioned in the Peggy 2 Snake 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 4×6 pixel character

For example the character for the number ‘0′ is stored as 0×699996 which when spread out looks like:

0110
1001
1001
1001
1001
0110

By doing this I can store 0-9 and A-Z in only 144bytes.
To save RAM I put this in program memory using: PROGMEM prog_uint32_t chars[37] 

To write a character to the display I use a function “show_char” (note I use a special function ’setPixel’ to set the individual pixels to a certain brightness level – but if you are not using grayscale then the call can be replaced by standard frame.SetPixel calls)

void show_char(char Character, byte x, byte y)
{
  byte charNum = 36;
  if ((Character >= '0') && (Character <= '9')) {
    charNum=Character-48;
  }
  if ((Character >= 'A') && (Character <= 'Z')) {
    charNum=Character-55;
  }
  unsigned long w;
  w = pgm_read_dword_near(chars + charNum);
  for (byte i=0; i<6; i++) {
    byte offset = 4*(5-i);
    byte b = w >> offset; // get four bits
    b=b & 0xF;
    if (b & B1000) setPixel(x,y+i,7);
    if (b & B0100) setPixel(x+1,y+i,7);
    if (b & B0010) setPixel(x+2,y+i,7);
    if (b & B0001) setPixel(x+3,y+i,7);
  }
}

To make things a bit easier to display a string I also created a quick wrapper function ‘write_string’

void write_string(char string[], byte x, byte y)
{
  byte i=0;
  while (string[i] != '\0') {
    show_char(string[i], x+(5*i), y);
    i++;
  }
}

Full usage/source can be found in the peggy 2 snake code

gen
30

Peggy 2 Snake

Peggy 2, arduino, game Commenti disabilitati

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

Peggy 2 running Snake

Peggy 2 running Snake

It has 24×25 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 Peggy 2 Character display.

The game has multiple levels (where walls are put up in different spots and the speed is increased).  All up the program takes up 5258 bytes so fits on an atmega168 with room to spare.

Source code is available as peggy2_snake.zip

If you don’t have all the leds soldered on you can change gameMinX, gameMaxX, gameMinY, gameMaxY and score* to set the area used to play/display score

Jeff at Totus Terra has been working on an Arduino based sequencer. He has a three part series on his blog.  Part 1 takes control of the SX-150 pitch control.

Part 2 is a build on the basic sequencer note-on/note-off control.

Part 3 is where it comes together with a hardware-and-Arduino based 4-step sequencer for the SX-150

Jeff has included complete instructions, explanations, schematics and Arduino sketch files for this build.

Share/Bookmark


  • About

    Planet Arduino is, or at the moment is wishing to become, an aggregation of public weblogs from around the world written by people who develop, play, think on Arduino platform and his son. The opinions expressed in those weblogs and hence this aggregation are those of the original authors. Entries on this page are owned by their authors. We do not edit, endorse or vouch for the contents of individual posts. For more information about Arduino please visit www.arduino.cc

  • Follow us

    Follow us on Identi.ca Follow us on Twitter
    Bookmark and Share
  • People

PlanetArduino is powered by WordPress. Design by Jasone.it. Valid XHTML   •   Valid CSS
31 queries. 3,140 seconds.