First steps with the ATtiny 45

The ATMEL ATtiny 45 is an 8-bit programmable microcontroller chip. Some weeks ago I stumbled upon this How-To article by Matt from MAKE about the ATtiny 45 and with my last electronics order I got one (actually two, just in case I accidentially blew one up).

Yesterday I took the time and got it up and running:

Following the tutorial at the MIT Media Lab page it took no longer than 30 minutes to make the microcontroller drive two LEDs.

Although the tutorial was very helpful some things have changed in the current software versions, so (as promised in my last blog posting) this is what I did differently:

1. Copying the ATTiny files

  • doing so as described in the tutorial
  • but: they are showing up as simple devices under “Tools”, “Board”

2. Preparing the Arduino Uno

  • connect the Arduino Uno via USB to the PC
  • start the Arduion IDE 1.0.1
  • open “ArduinoISP” from “File”, “Examples”
  • upload it to the Arduino Uno
  • when finished, connect Arduino Uno to ATtiny on its breadboard, see tutorial for details

3. You(r) program

  • open the blinking example, change pin 0
  • select “Tools”, “Programmer”, “Arduino as ISP”
  • upload program using “File”, “Upload Using Programmer”

4. Done

  • depending on your program and breadboard setup, the LED(s) should be blinking now

What’s next?
I’m not quite sure, but I think the ATtiny 45 is a cool chip, so I’m really looking forward to finding a good way to integrate it into upcoming projects.

ATMEL ATtiny 45
MAKE article
MIT Media Lab page ATtiny
My ATtiny 45 video at YouTube

Some thoughts about this blog

I’m totally aware that blog postings about (not) blogging are boring, but anyway, I’m feeling the urge to share some thoughts about blogging in general and also about what’s going on with this blog.

Not blogging just for the sake of blogging
There is no value in putting together some content just to publish a new blog posting. This is neither helpful for the (occasional) reader nor for the author. So I’ll not blog something just for putting up some content.

A month without a blog posting is not a lost month
One might spend a month or two just reading, learning or playing, without publishing a single blog post. I think this is totally fine. If you blog on a regular basis: fine. If you blog once in a while: it’s fine, too. There is no fixed timetable that you have to follow.

Not starting the posting with an apology
“I’ve been busy over the last few weeks, so I’m sorry that …” By looking at the timestamp of the blog postings it is obvious that the previous posting was published some weeks or even months ago. As said above, this has happened for a reason. If you want to talk about this reason, then feel free to do so, but you don’t need to, and I don’t think this is a lack of respect towards the reader. If you want to tie in with the last psoting, then why not start with something like “After some exciting weeks of working on XYZ / playing with XYZ / … I’ll share my thoughts / findings /… on this …”

Cutting to the chase
You can write many lines without saying anything. You can paste lots of quotes in to your post. You can sum up the obvious. But you can also skip these parts if you like and get to the point.
In my future postings I am going to focus on what I think is important; I’ll link to other good tutorials and descriptions that might be helpful. There is so much good and interesting content out there, so why copy / rewrite it instead of linking to it?

I really hope that I’ll blog more often, shorter, more to the point.

As always: feel free to contribute by commenting.

Reading RFID tags with Arduino and ID12

The mission: getting started with RFID

With my recent gadget order I also bought an ID-12 RFID reader with a corresponding breakout board. The breakout board is needed because the ID12 chip contacts have a 2mm grid while the breadboards have a 2.54mm grid.

Step 1 – setting up the circuits

Yesterday I soldered the reader and connectors to the breakout board (not a very easy task for a non-soldering-expert like me), and today I tried to get it working. And guess what: it didn’t work :(

After each step of soldering I checked the connections with a multimeter and everything seems to work fine (except that I got confused, because on the breakout board the pins 3 and 4 both connect to the antenna somehow and are then connected which I did not expect).

But when trying to get some data out of the assembled circuit nothing happened, and after some checks I found the error: the pin 2 did not connect correctly to the pin on the ID-12 chip. I wasn’t expecting this, so I tried to fix the soldering at that connection, but still no success, so finally I had to solder a testing wire to the pin, and then the contact worked.

Conclusion up to this point: check the soldering connections after each step, even if they look good.

This is how the connections are made:

Actually the ID-12 is soldered to a breakout board so this is how everything looks in reality (notice the white wire on the left side of the chip – this is the one that I soldered directly to the chip):

(A big thanks goes out to HC Gilje for the good explaination on how to connect the ID-12 chip.)

Step 2 – coding to get some results

There is some great example code for reading RFID tag data on the Arduino website.

It works quite well, but… the ID-12 chip uses a serial connection and the Arduino just has one serial port (input: pin 0, labeled RX), and internally the flashing and PC connection also uses a serial connection. So you cannot have both connections set up at the same time (therefore it is suggested to disconnect the ID-12 chip when uploading a new software version).

But there is a great solution provided by the Arduino IDE: it comes with a SoftwareSerial library (see “File”, “Examples”, “SoftwareSerial”) which turns two normal pins into a serial port. I guess there are some limitations on this, but for me it works quite well.
If you take a close look at the photo and schematics you’ll see that the blue wire (serial) is connected to pin 2 instead of pin 0. This is because I configured the SoftwareSerial lib to use pins 2 (RX) and 3 (TX) to provide a serial port.

By changing the example code to work with two serial ports and opening a PuTTY on port COM3 I was finally able to see the tag IDs showing up!

On request (please leave a comment below) I’ll share my code – it is currently not proper formatted and commented ;)

What’s next?

I’m very excited that this worked so well, but I’ll continue building upon the code and circuit layout:

  • Putting up the code (actually needs some reformatting and commenting)
  • Reading the data on the PC with a custom application
  • Extending that PC application to provide this data to other applications, maybe using some plugin architecture
  • Getting the ID-12 to work with a FEZ Panda II and a Gadgeteer board

If you have any suggestions, ideas or any other feedback, please feel free to leave a comment below.

Update 14.02.2013

I’ve uploaded the code at

It is based on the example RFID reader code from the Arduino site, except that it uses the software serial connection at described above.

New gadget: Arduino Uno

Just a short update: I recently received some fun stuff, including an Arduino Uno.

I’ve also been soldering some components together, and I’m really excited about getting into the Arduino Universe. So stay tuned for more updates on that topic.

As a first impression I shot a little video with two blinking LEDs (seen on the right side in the video):

Numeric converter using different bases

Inspired by a short conversation with jsilence I was looking for a NewBase60 converter written in Java and C#.

NewBase60 is a format suitable for building parts of URLs, e.g. for URL shorteners. Instead of just using numbers for the short links it uses letters as well, while internally still using numeric values. (There are different strategies to increase a numeric value: just increase the number, increase it using hexadecmial notation, or using an extended set of characters like NewBase60 does it.)

Sadly, the NewBase60 posting didn’t list a C# implementation, and the link to the Java implementation was broken.

So I decided to write my own version. And while NewBase60 with its given 60 characters is just a special case for such numeric conversions, my Base-N implementation not only includes NewBase60 but also a binary, octal and a hexadecimal converter, a flexible base implementation for user-defined bases/alphabets and a “max. base 36” implementation.

The Base-N code is up on my github page, so feel free to download, use and/or fork it.

If you encounter any bugs or just want to provide any other (positive?) feedback, feel free to leave a comment below.

C# Extension Methods, Part 3

While I’ll probably (have to) focus on Java for the next month, I just came up with the idea of just another extension method class. It is acually not very helpful but it again shows how powerful extension methods can be.

This is how it can be used:

StringBuilder buffer = new StringBuilder();
foreach (int i in 10.To(15))
    buffer.AppendLine("" + i);

I know that this piece of code does not look very helpful, because the same can easily be done using a simple for loop, but there might be some cases – especially when using LINQ – when it is quite useful to have an iterable range of int values.

The code is up on my github C# extension method project. Feel free to use or fork it.

Timelapse, experimental (April 2012)

Last weekend I tried a timelapse software on my mobile phone, and here’s the result:

I think I’ll do more of these…