Monthly Archives: September 2012

ATtiny45 meets 74HC595

Earlier today I’ve been following the Arduino Tutorial for driving a 74HC595 shift register which turned out to work pretty well.

In short, a shift register is an electronical component that can be controlled using 3 wires to change the output of 8 pins, or even more when two or more shift registers are chained together. Using a shift register can be useful when you need some more output pins on a microcontroller but only want to use few pins on the microcontroller itself.

I really suggest taking a look at the linked tutorial above for more information, everything worked great following the steps described there.

Limited number of pins on a microcontroller? Did anybody say “ATtiny”?!

Yes, there we go:

It is pretty straight forward to port the Arduino example code for controlling a shift register to work with an ATtiny45 as well.

  • Upload the ArduinoISP sketch to the Arduino Uno
  • Load the Shift Register sketch into the Arduino IDE
  • Switch the board settings to ATtiny45
  • Connect the ATtiny45 to the Arduino Uno (see my previous posting for more infos)
  • Upload the sketch through the Adruino Uno to the ATtiny

As you can see in the photo above, the Arduino is only used as a power source, the shift register – lighting the LEDs – is just driven by the ATtiny45 on the small breadboard.

I’ve been using a very simple blinking pattern which I set up in the code in an array of bytes (can you guess the pattern? shouldn’t be too hard due to the LED setup), and the program is about 1084 bytes in size. As the ATtiny45 comes with 4096 bytes of program memory there is still a decent amount of space left to build a more complex program, because I guess most of the code is used by the “invisible” part of your program (not the directly written user code but the “infrastructure” code to make it run on the chip) – but that’s just a guess ;)

Anyway, shift registers are a powerful “tool” which is easy to use because the Arduino comes with both predefined functions to work with shift registers and also useful examples, so depending on your project needs you might want to give the shift registers a try.

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.