Archive | December, 2012

Tutorial: making Gravitech’s MP3 Player add-on work

08 Dec

Tutorial: making Gravitech’s MP3 Player add-on work

Gravitech is the company that created the Arduino Nano, one of my favorite Arduino's for prototyping. These are really tiny, but fully breadboard compatible. Just pop it into a breadboard and you're ready to start making things.

The obvious drawback of this size is that it can't use standard Arduino Shields, but Gravitech has made their own line of "shields" for the Nano form factor. For a recent project I'm evaluating the MP3-shield and I quickly discovered that Gravitech needs to update the links on the product page as this board can no longer use the code suggested (they've done it now).

Making it work

The reason it could use the Sparkfun example, is that it's using the same decoding chip (VS1053) as Sparkfun's MP3 Player Shield does. This is a great chip that can not only decode MP3, but also play back Ogg Vorbis, AAC, WMA and MIDI. It can even encode audio if connected correctly. 

The problem with the Sparkfun example is that the required SdFat-library has changed. There is no longer a file called "Sd2PinMap.h", so you can't do the crucial setting for selecting the SD card. To make the Gravitech MP3 Player add-on for Arduino Nano work, you have to do a few things.

Step 1: Do not download the SdFat-library

The Sparkfun example starts off by saying that you should download and install this from the official URL. Do not do this. We have an easier way.

Step 2: Do not use the Sparkfun example

Instead, use the MUCH better SFEMP3Shield library maintained by Bill Porter (and others). Click the ZIP-download button on the GitHub page (or use GIT if you know how). Unzip the files and place the two folders named "SdFat" and "SFEMP3Shield" in the "libraries" subfolder in your Arduino sketches folder. If this folder is missing, just create it yourself.

The "libraries" folder should be in the following location:

OSX: /Users/username/Documents/Arduino/libraries/

Windows: C:\Users\yourname\Documents\Arduino\libraries\

If you are using the Sparkfun MP3 shield, you can skip the next step. If you are using the Gravitech shield, we need to edit a file for it to work. Do not start your Arduino software yet.

Step 3: Edit SFEMP3ShieldConfig.h

This file is in the "SFEMP3Shield"-folder that you just copied. Open it in a text editor (NOT a word processor!) like TextMate/Textwrangler on Mac or Notepad on Windows. Locate the lines that says "#define GRAVITECH". This macro was added after I first posted this, so now it's really easy to set it up. Change this:

#define GRAVITECH 0

into this:

#define GRAVITECH 1

and save the file. That'll set up the library for the Gravitech MP3 player. What this changes is what the SD_SEL variable (for selecting the SD card) is set to a little further down the same file.

Step 4: Declare the required pins as OUTPUTs

Unless your code explicitly declares the pins of this shield as outputs, you'll get problems with "floating grounding". Some pins will flickr between 1 and 0 and this will prevent the SD card from initializing. Sometimes you'll be able to make it work by just holding the pins, but this'll be random and not repeatable.

The error you will get is something along the lines of this:

Can't access SD card. Do not reformat.
No card, wrong chip select pin, or SPI problem?
SD errorCode: 0X1,0X0

To fix it, just add these lines at the top of your code (at the start of void setup() )

  pinMode( 2, OUTPUT);
  pinMode( 3, OUTPUT);
  pinMode( 4, OUTPUT);
  pinMode( 6, OUTPUT);
  pinMode( 7, OUTPUT);
  pinMode( 8, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);

Pin 10 isn't used in the shield, but since the shield is using SPI, it should always be declared as an output.

Step 5: Play audio!

Start the Arduino software and click the Open-button. Locate the SFEMP3Shield-menu and open the example  "SMP3Shield_Library_Demo". Make sure your Board/port settings are correct and compile. Open the Serial Monitor for instructions on how to use the example. When you've got the grip on this, study the example to understand how you can implement this into your own app.

Why use SFEMP3Shield rather than the old lib?

As long as you remember to use the old fashioned 8+3 character naming convention (ABCDEFHG.ABC) this library is really good. Many of the Arduino-libraries out there are written by people that don't understand the general Arduino audience. They are overly complex in both implementation and use. The SFEMP3Shield-library is MUCH better written than the original libraries from Sparkfun. All the complex options are hidden and you're left with easy to use commands such as setVolume, playTrack, setPlaySpeed and much more. You can also access the ID3 tags of the MP3's you're using such as trackTitle, trackArtist and trackAlbum.

If you for some reason run into problems, you can find a good description of Error Codes and other troubleshooting on this page



Using Printrbot Jr with Kisslicer

06 Dec

Using Printrbot Jr with Kisslicer

While my Printrbot Jr keeps impressing, the software side is a little less overwhelming. I use Kisslicer with my Ultimaker and setting it up for the Printrbot was quite easy. Kisslicer is a very good slicer that thinks differently than many of the other alternatives such as Skeinforge and Slic3r. I tend to toggle between mutiple slicers, but lately I've more or less settled on Kisslicer. It simply makes better toolpaths and it's easier to work with. It's also easy to set up for use with multiple 3D printers and it's a free download that isn't crippled in any way. Paying the $42 gives you a few "Pro" features, but most user won't need this. I basically just bought a license because I wanted to support the future development.

Here's the current Kisslicer settings I'm using with my brand new Printrbot Jr. It's not possible to save settings for simple distribution, but by just typing in the values here, you'll get a good starting point. The settings work perfectly for prints, but I think I'll need to up the E-vaule from the current 569 to a little more as too little plastic is used.


Printrbot Jr - built by Jr!

05 Dec

Printrbot Jr - built by Jr!

My son loves hacking and I've thought about getting a second 3D printer. I figured, this could be a fun activity for the two of us. The idea is to have this one in the office, while my Ultimaker stays at home. I've followed all the Kickstarters that involve 3D printers and thus far, only one has really delivered - the Printrbot. The kit I decided to get was the Printrbot Jr.

The PrintrBot Jr is the cheapest kit out there and I was really curious to see what kind of printer you could get for just $399. They also sell it Pre-Built for $449, but we wanted to put it together ourself. The instructions and videos supplied are reasonably good, but at many places you just had to guess and see if things were right. There were also some screws missing, but I found replacements. The stupid thing was that the supplied screws were mostly american sizes so it's hard to find the correct replacement screws unless you're in the US. I got it to work and I'm happy with that, but I wish they had counted correctly in the first place. Also missing is all the tools required, so make sure you have the following:

  • Umbraco's (2mm and 4mm)
  • A little wood-glue
  • Blue painters tape for the bed
  • Unless they update the kit, you'll also need the seven 1/8" 40mm bolts (that were missing in my kit). I used 3mm as replacements, but it's not ideal.
  • There is also no filament in the package, so order a Rainbow pack from Faberdashery or something to get you started.

To get the most out of your printer, you should also get:

  • 40mm fan (you'll find this in any decent computer store)
  • Micro SD card. A small one (2-4Gb) will do

What I missed the most was good pictures of how the extruder fits onto the rest of the assembly, so I took some pictures that I have posted on my Flickr account of how this is supposed to look. Here's how you mount the hot-end and here's how the motor assembly should be. Assembly speed wasn't amazing (compared to the Ultimaker), but hey - my son did almost 70% of it himself and he's only 11! Not shabby at all. And with a little better instructions, I'm sure he could have done it all himself.

We're still to get a print out of it, as the software side is a bit rough. We got everything working with Printrun/Pronterface but we didn't get anything sliced to print. That's the part where companies like BfB and Makerbot has a big advantage. They have a complete end to end solution, whereas the Open Source printers also use an Open Source toolchain. I'll post images of the first prints when we have time to set up Slicer. If you're setting up a Printrbot Jr, be sure to check out the rest of the pictures of Flickr so you can see how to mount the extruder to the printer.

Update: Now printing!

After following the official Getting Started Guide, we're now getting decent prints! I just tried printing this Thing and it highlighted another thing that is missing with this printer - a proper PLA cooling fan. It'll be incredibly hard to get anything good looking without it, so I guess that's where I'll start...


3D Printer weekend

04 Dec

3D Printer weekend

Last weekend I organized the second meetup for 3D printer enthusiasts in Norway. I host these meetups together with Kjetil that runs and we're trying to make it a place where both entusiasts can meet and curious can come and ask questions. As the first time, the event was hosted at my local hackerspace (and daily office) called Bitraf. Bitraf is the biggest hackerspace in Oslo (in terms of area) and it consists of a big room for hackerspace activities, a sofa & film area with projector, a workshop with soldering, cnc and 3dp equipment. The perfect place to host tech meetups!

Kjetil with his new MakerGear M2 - smiling all weekend!

Kjetil with his new MakerGear M2 - smiling all weekend!

The first meetup saw more than 35 attendees in one evening and it got quite hectic. This time around, we wanted people to have more time to hang out so we set it up as a combined meetup- and build-event. Throughout both events we've had Ultimakers, Makerbots, Makergear, BfB and several Reprap Mendel, Prusa & Huxleys on display. If you have a printer, feel free to come along for either help or showcase!




Installation Error: ApplicationVerificationFailed

04 Dec

For future reference: if you're compiling a mobile app for Adobe AIR and you get this error, it basically means that there's something wrong with the certificate that you're compiling with. The app I'm working on at the moment is using TestFlight for distribution and after pushing a build, I was unable to install to any of my devices. The installation on both iPad and iPhone went as normal until after the install, where it just said that it "Failed to install".

Turns out I had mixed up release and development versions of the certificates. Duhh... Posting it here to help others doing the same and not finding a solution.

Feb 11 2013 update: so got this error again and my own explanation showed up in Google - but - it didn't help me. So some more detail on the problem I had today. I have several identities on some of my accounts. Some are for companies I work for and for some reason - I have two developer identities with Apple.  Let's hope I don't pay for both hmmm

This time, I got the error for trying to export the app, or rather the provisioning file with a company certificate for wich i didn't have the Key (.p12/.cer). As soon as I connected the right certificate to the provisioning file, I was able to install the app on my phone. What made me solve it eventually was to open the Organizer app in XCode. This will actually tell you if the Provisioning profile is valid, whereas Flash Builder will not. It was a bit of a facepalm when i realized it, but I'm posting it here so it can help others.

Here's Organizer showing me what Flash builder should have told me half a day ago...

Update May 2014: another way to get this error -> if you're toggling between release and development versions of the app, you must be sure that the "aps-environment" are set to "development" and not "production" when testing.