(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!)
Blabber about computing and electronics.
(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!)
I 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:
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’
In 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’
For those of you that don’t know, the AppleTV is a small, low powered OSX-running PC that has been built specifically for streaming and playing videos to a TV via WiFi. It has HDMI, component, optical audio, 802.11n and is completely fanless (yay!). Thanks to a few people (notably Turbo and the NitoTV team), the AppleTV has been opened for development.
Although I didn’t realise it at first, writing a portable driver for the USB13700 in python was a very good idea. There is a USB port on the back of the AppleTV that is initally disabled. If I remember correctly, all set top boxes sold in the US need an external debug port to be approved by the FCC (or something along those lines). Since Apple doesn’t want anyone using the port, it is disabled by the Mach kernel after loading. To get around this is quite a complex process and I wont go into it completely here, but follow these steps (google is your friend here): Continue reading ‘USB13700 on AppleTV!’
I have been playing with Henri’s USB13700 graphical LCD controller for some time now on my Windows box. Its a neat little piece of hardware; very flexible and powerful. A few days ago, I set about programming a python pseudo-driver for it so I could use the screen under Linux. The screen is encapsulated in an easy to access class, USB13700. It currently runs quite slow (I am still trying to work out why) but PoC code to draw a moving sine wave follows: Continue reading ‘Using the USB13700 controller in Linux with Python’
It all started a few years ago when I discovered the book Project Arcade: Build your own Arcade Machine! I have always been a closet old-skool gamer and so I bought the book. As soon as I had devoured its information, I began designing my own.
It flopped. Quickly. I never got out of the planning stages for the machine. There was no room at home, and it would end up costing too much. But I did order enough buttons for a two player panel, and the extremely expensive (but high quality) iPac encoder. I ended up drilling a few holes with a spade bit and plonking it all on a piece of wood that I sat between two boxes. That thing was hideous. Continue reading ‘HIDeous Arcade: its not that ugly, is it?’
So I finally bit the bullet and bought myself an ARRR-duino (arduino.cc) from a nice little shop called Little Bird Electronics, which by the way has a really cool design in comparison to other webshops. Even though I already have an AVR development platform (the wonderful STK500), it will be nice to have a simple, no extras needed dev kit with USB support. I know USB is complex and all, but dev kit makers, you are still living in the dark ages. My recent computer breakdown decision to upgrade meant it was time for a QuadCore processor. For this, I needed a motherboard upgrade as well. Props to Murphy’s Law, because my new motherboard has no COM ports.
I’m also pleased that this thing gets its power over USB. There is no need to lug a chunky power brick wherever you take it. So I can make little projects and just plug it into my iPod charger (which I take with me anyway) to power it up. Brilliant.
Now I just have to work out how to program it from my iPod Touch…
Picture copyright Pip 2007
The Tengu is simply a small LED matrix hooked up to a microcontroller and a electret microphone. The cool part comes in when playing music; the Tengu appears to be lip-syncing. After seeing just what it can do, I knew I needed to have one. But why buy one when you can make it yourself?
It was actually surprisingly easy to drive the LED matrix. The ‘faces’ are stored as eight chars; one for each line of the matrix. Basic code follows:
/* This file assumes that the NPN-transistors are hooked up to PORTB and the cathodes are connected to PORTD */ #include <avr/io.h> void output_matrix (unsigned char matrix[8]); unsigned char mouth_closed[] = {0x00, 0x66, 0x66, 0x00, 0x7E, 0x00, 0x00, 0x00}; unsigned char mouth_pursed[] = {0x00, 0x66, 0x66, 0x00, 0x7E, 0x7E, 0x00, 0x00}; unsigned char mouth_open[] = {0x00, 0x66, 0x66, 0x00, 0x7E, 0x81, 0x7E, 0x00}; unsigned char mouth_large[] = {0x00, 0x66, 0x66, 0x00, 0x7E, 0x81, 0x81, 0x7E}; unsigned char mouth_big_smile[] = {0x00, 0x66, 0x66, 0x00, 0x7E, 0x42, 0x42, 0x3C}; unsigned char mouth_smile[] = {0x00, 0x66, 0x66, 0x00, 0x42, 0x42, 0x3C, 0x00}; unsigned char mouth_surprise[] = {0x00, 0x66, 0x66, 0x00, 0x7E, 0x42, 0x42, 0x7E}; int main (void) { DDRB = 0xFF; DDRD = 0xFF; /* Ports are all output */ while (1) { output_matrix(mouth_open); /* Forever print the face */ } return 0; } void output_matrix (unsigned char matrix[8]) { int x; /* Loop control variable */ for (x = 0; x < 8; x++) { /* For each LED in the array */ PORTB = (1 << x); /* Turn on the NPN connected to the 'x' row */ PORTD = matrix[x]; /* Output data */ } }
I haven’t yet been able to test it with a microphone because my new motherboard does not have any COM ports, so I can’t program any of my AVRs on my STK500. But cables are coming in from eBay soon, so I should have it running sometime in the near future (maybe even make some PCBs!).