Sunday, March 15, 2009

AVR programming and effect automation...

If there's one thing I'm really bad at, really really really bad at, when it comes to electronics, it's control logic. The little bits that need specific timing, when to do such thing and when not to do it, if voltage dips below X then do so-and-so, etc, that kind of crap. Using traditional logic chips, I just can't get my head around it. Ever. I've also been wanting to integrate more automation in my synths/pedals. Thus, easy to program AVR microcontrollers have been interesting me as of late.

Here is the kit I've just purchased (thing on the left):



I did a lot of Basic programming in school. QBasic, Visual Basic, etc. It's pretty easy stuff compared to assembly or even C. Microcontrollers at first seemed daunting to me because I wasn't prepared to learn any good language, but then I found out that these little AVR chips can be programmed from a Basic environment called BASCOM! It took me a few days to get serial com to work (had to go out and buy a serial PCI card, the USB-to-serial adapter I had was rubbish, I found out days later). Once I was up and running though, it was pretty easy to get basic things going. Blinking lights, input, potentiometer reading (ADC) and PWM (sPitting out Waves that I can use for Modulation or whatever).

The little project in the photo is something I started today. It's one push-button, two potentiometers and a LED, all hooked up to the programmer. I got it so that pushing the button will make the MCU go into "record mode", where it will record pot-twisting for up to several seconds (one byte per sample at 60 sampels a second). As soon as I let go of the button, or if the severa lsecond limit runs out, it loops the recorded twisting which can be observed through the LED! The other pot can adjust the speed of playback/record.

This opens up all sorts of fun additions to effects! I could for instance "record" a certain knob on a delay or synth, and have it automatically loop! Exciting stuff! Once content with my program, pop the chip out of the programmer (that long chip in the center) and stick it in my own circuit. Done!

They make smaller chips. I'll get different sizes depending on how I need them.