Silly universe, this is what you get when you give me free time.

dino_lcd

(I was messing around with PIL and realised that the dithering capabilities were perfect for my graphical LCD. As you can see, it turned out rather well!)

Installing PyGTK on Windows

GTK is awesome. PyGTK is awesome. PyGTK on Windows is far, far less than awesome. I recently wrote some software that runs fine on my Linux box after a couple of apt-gets, but unfortunately the software is for Windows users. I spent a good part of the morning getting all the stuff needed for PyGTK installed in a VM; it was a painful process of trial and error. To save everyone else the trouble, here is how I ended up doing it. Continue reading ‘Installing PyGTK on Windows’

Getting your joystick to work under Ubuntu Intrepid Ibex (8.10)

So, I’ve finally gone Linux-only on my desktop with a nice fresh install of Ubuntu 8.10. I have to say that Ubuntu has improved greatly since I last used it on the desktop (I have been running Ubuntu Server for a while with no issues as well), but there are still a few nagging problems. One of these was the Xorg autodetection driver; while mostly awesome, it would recognise my gamepad as a mouse and then intercept all input from it. However, a couple of quick edits and a restart fixed it up nicely (this post assumes that your joystick is supported by HAL under Linux, but is just behaving badly). Continue reading ‘Getting your joystick to work under Ubuntu Intrepid Ibex (8.10)’

Update on….things

Well, ‘09 has been a good year so far. I love python, so I wrote a personal blog in it, you can find it here. Also, I started Engineering at UQ and am having an awesome time.

I bought a unibody Macbook 13″ and love it :D .

No-one probably comes here since I was serving 500s for about 3 months, so I best get writing again!

Graduating from Arduino to AVR

An AVR MicrocontrollerI often see quite large scale projects online made with Arduinos, but as a person who has moved from AVRs to Arduino what I see doesn’t make a lot of sense. The arduino is essentially a prototyping device and while there is nothing really wrong with using it in a final design, much can be gained from moving away from it.  Just to clarify: I understand that an arduino is built around an AVR, but the problem is that much of the power (and complexity) is abstracted away by the software. Perhaps it’s just me, but I like to know exactly what is going on inside my processor. On top of this, AVR Simulator is a godsend for hunting down that last bug.

The real reason behind this whole thing is price. From Little Bird, the cheapest Arduino is $17.50 while the sale is on, and that has no USB chip on it. The ones with the USB chip are >$40, not to mention the price of accessories. An Atmega88 at Futurlec is $3.80, a crystal is $1, caps are a few cents and so is the pullup resistor for reset (this will all be explained in a later post).

Development Environment

The basic tools I use for AVR development are:

  • AVR Studio - A free IDE with AVR Simulator built in
  • WinAVR – A free C compiler for AVRs (based on gcc) and other tools
  • STK500 – There is a multitude of free or prebuilt development boards on the net

You won’t need any of these till the next tutorial; we are just going to talk about hardware for now. Continue reading ‘Graduating from Arduino to AVR’

Happy New Year!

If there is anyone out there reading this, happy new year! I have had so much time lately to work on my own projects that it is becoming difficult to choose which one to work on. On top of this, I found out that I have even more time off then I expected. My New Year’s resolution is to write a decent, informative post at least once a week (excluding exam weeks), so to the 5 or so people who have subscribed to my RSS, I promise more is coming soon!

My latest two projects: developing a photography gallery for nelpix.com and creating a sort of race timer for little remote control cars (more on that later).

Have a great year everyone!

The trap of false optimisation

Every so often, a post pops up in my RSS reader that is something along the lines of “20 optimisation tricks” or “10 techniques to make your code run faster”. Sure, everyone wants their code to run faster, but a number of these techniques only serve to make code run slower and become less readable. The problem is that people blindly accept these posts as factual information(myself included) because optimisation is hard, and the next time they come across a situation they use the false optimisation which makes their code run slower. I decided to investigate a one of the tips I read recently. Continue reading ‘The trap of false optimisation’

Graduation

As of today, I no longer attend school! I envisage that this will leave me with much more free time for my own projects. I also expect to update this blog a lot more with little guides, so watch this space!

Using lambda in Python

SPOILER ALERT: This post contains a solution to Project Euler problem 20.

I gave some more Project Euler a go last week and when I came across problem 20, I knew it was time for me to finally learn how to use closures. I could not find much accessible information for beginners, so I figured I would write up what I discovered. That means it’s time to grab a cup of coffee and put on your theory cap, because this topic needs a bit of explanation. Continue reading ‘Using lambda in Python’

Using the vs1002 MP3 IC with an AVR

A MP3 decoding ICIn one of my various orders to Sparkfun, I picked up a vs1002 IC on a breakout board. Just yesterday I got round to having a good look at it, and I figured if I show my code then others will not have to do the boilerplate and just get it working. My setup is a ATMEGA88 running at 3.686MHz on a STK500 board, but it should work for most anyone with a decent clock speed. Just remember that all code is ATMEGA88 specific and may need to be changed for other devices.

Things that may be useful: the Sparkfun page, the datasheet.

Communication modes

(Note: The vs1002 has a backwards compatability mode with the vs1001. We will not be using it)

The vs1002 IC does all meaningful communication over the SPI port. It has two submodes if you will, one being SCI (Serial Command Interface) and the other being SDI (Serial Data Interface). SCI is for things like play control, reading and writing registers and small technical changes. Conversely, SDI is there for MP3 data and a few testing modes.

Since the AVR has only one SPI bus, we will be sharing the CS (Chip Select) line with both submodes.
Continue reading ‘Using the vs1002 MP3 IC with an AVR’