Updating firmware on AVR chips

Posted in Autonomous Bassline on May 10th, 2010 by Dann Green – Be the first to comment

A number of 4ms devices use an AVR microcontroller. These chips run a small program. On most 4ms devices that use an AVR chip, there’s a 6-pin header (2 rows of 3 pins) near the chip. This header lets you update, upgrade, or hack the AVR chip.

Here’s how to do it:

You will need…

  • ISP (In-circuit Programmer): I recommend the AVR ISP MKII available from Mouser for $34, or elsewhere sometimes cheaper! In Europe, try Farnell
  • A computer with a USB port. Windows actually has the most seamless installer, but I also use Mac and Linux to burn code just fine. Download and install one of these:
    • Windows: AVR Studio 4, download it from atmel.com. Scroll down and get the latest version (4.18, build 684). You’ll have to “register” by typing in a real or fake name and address.
    • Mac OS X: OSX-AVR which is actually Crosspack
    • Linux: You just need the avrdude program to burn code, but can install the whole avr-gcc toolchain if you might be compiling your own firmware.
  • The hex file: This is the actual file that contains the firmware update. If you’re upgrading a device, this will be available for download on the device’s web page. If you’re an advanced hacker, you’ll probably compile your own code using avr-gcc (part of AVR Studio) which will generate a hex file for you. The file should end in .hex

Detailed instructions:

PLuig the AVR ISP mkII into the 6-pin header of your device, making sure to line the red stripe up with the printed white box on the PCB

Plug the AVR ISP mkII into the 6-pin header of your device, making sure to line the red stripe up with the printed white box on the PCB

Windows (AVR Studio 4):

  1. Download and install AVR Studio 4 from atmel.com. Make sure you are downloading AVRStudio4Setup.exe, not just a service pack upgrade!
  2. Run the installer and click OK/Next to everything. Yes, you want the “Jungo/USB” driver to be installed.
  3. Plug in your AVR ISP mkII into the USB port and make sure Windows finds and automatically installs the drivers. The green light near the USB plug should come on.
  4. Power your device up (that is, plug your Rotating Clock Divider into your Eurorack system, or power up your Bend Matrix, etc…). Your device should be running normally, but don’t plug any patch cables into it
  5. Plug the 6-pin ISP header of the AVRISP mkII into your device. Note the orientation: the red stripe should go towards the white box that’s printed on the PCB: see photo above.
  6. The light near the 6-pin cable on the AVRISP mkII should turn green, indicating that it detects power. If you plugged it in backwards, it might flash orange. Nothing’s damaged, just flip it around…
  7. Run AVRStudio 4
  8. Click the little “AVR Programmer” icon: AVR Programmer
  9. If it doesn’t automatically detect your AVR ISP mkII, then select it from the box on the left, and click “USB”, and then click “Connect…”
  10. Click on the “Main” tab, and select “ISP mode” from the bottom box. Click “Settings” and choose an ISP Frequency of 125kHz.
  11. Select “ATmega168″ for the RCD, or ATtiny84 for the ABG, or ATmega32 for the BM, from the top drop-down box. Click “Read Signature” and it should say “Signature matches device”
  12. Click the “Program” tab. Under “Flash” click the “…” button next to “Input HEX File” (the top one). Make sure you’re not under EEPROM! Select your hex file that you downloaded (or compiled yourself)
  13. Now, click “Program” (again, under the Flash section, not under the EEPROM section). It should give you no errors at the bottom of the window
  14. Unplug your ISP 6-pin header and you should be good to go!

Please let me know if you have any problems!

Mac OSX (Crosspack):

  1. Download and install Crosspack from here: http://www.obdev.at/products/crosspack/index.html]
  2. Download the hex file for your upgrade. Save the file in your Home directory, so you can find it easily with the Terminal.
  3. Plug in your AVR ISP mkII. The green light by the USB plug might not come on.
  4. Do steps 4, 5, and 6 of the Windows installation (power up your device, plug in the AVR ISP mkII, make sure the green light comes on)
  5. Open up your Terminal program (in Utilities folder)
  6. In Terminal, type “ls” and hit enter. You should see the name of the hex file that you saved in your Home directory (along with everything else in your Home directory). If not, you didn’t save it in the right place.
  7. Now tell it to burn the code. For the RCD, type this command:
    avrdude -P usb -c avrispmkII -p atmega168  -U flash:w:clocker.hex -v -v

    And press enter. This assumes your hex file is named “clocker.hex”. It should say “avrdude: Thank you” and have no errors above that. If all goes well, unplug your 6-pin cable and your RCD is updated!

    If you’re using a fresh chip, you’ll need to use this command to burn the fuses:

    avrdude -P usb -c avrispmkII -p atmega168 -U hfuse:w:0xd7:m -U lfuse:w:0xef:m -U efuse:w:0x01:m -U flash:w:clocker.hex

Linux:

  1. Install avrdude. You can probably install it with your package manager, such as Aptitude: (type “sudo aptitude install avrdude”), or Ubuntu’s Synaptic
  2. Follow the OSX instructions starting at step 2. Hint, if avrdude is not finding a usb connection, you might need to type “sudo” before the avrdude commands. Then it’ll ask you for your password before running avrdude.

Solar Pump display panel design

Posted in Uncategorized on March 22nd, 2010 by Dann Green – Be the first to comment
4435547099_cb89302c52_b

Solar charging station at the Austin fire station Trinity/4th

Sol Design Lab’s Solar Pump, a solar-powered charging station for mobile electronics, was an official part of South-by-Southwest this year. The stations have standard outlets, so anyone can walk up and charge a cell phone, laptop, or even an electric bike or scooter. The power comes from solar panels on the roof of the stations, so there’s no charge for charging (sorry… couldn’t resist). Refurbished 1950’s gas pumps provide a retro-future look that catch the public’s eye and twists the concept of “fill-up station”.

We set up three stations throughout Austin, including a large station downtown by the convention center, a smaller “pump” outside the South Lamar Alamo theater, and a mobile “pump” at Auditorium Shores. The Solar Pump grew out of Beth Ferguson’s MFA project, and these represent the third generation of prototypes.

LED display panel

LED display panel

My main role was the design and construction of the digital display, which used LEDs to indicate solar panel voltage, power output (to the inverter) and battery bank voltage. More technical details below….

Each station is a little bit different, with either 2 or 4 deep cycle 100AH 12V batteries creating a 24V system. A 1100W inverter supplies standard 110VAC power to the user through a GFCI outlet (including a big red Emergency-Stop button!). Between 2 and 4 bi-facial Sanyo solar panels charge the batteries through a Morningstar charge controller. We used the Pentametrix system to read the shunts and voltages, and then send that data digitally over RS-232 to the custom digital display module.

Solar charging station at the Austin fire station Trinity/4th

Gotta love that E-stop button!

solarpump

Solar Pump at Alamo Drafthouse, South Lamar

Tech details

Here’s the schematic:

Front panel schematic

Front panel schematic

Here’s the code (avr-gcc, using AVR Studio 4): solarpumppanel.c

Software

An Atmel AVR ATmega32A chip is at the core, communicating with the Pentametrix meter over a serial cable. The AVR makes a “request” to the Pentametrix every 500mS or so, and the Pentametrix responds with the latest readings: voltage on the solar panels, voltage on the battery bank, and current flowing out of the batteries to the inverter. The AVR then scales and converts these numbers and outputs them to the LED displays. The UART runs at 2400 baud, and the final byte is a checksum. If the checksum is off, or if the AVR doens’t hear a response from the Pentametrix, an error light goes on inside the box. Not terribly useful for debugging on the field, but on the bench this was handy.

Hardware

A Max232 chip handles the RS232 voltages, converting RS232 levels (-7V/+7V) to/from TTL levels (0V/5V). This directly connects to the AVR’s UART pins (RX/TX). These chips rule, they are totally worth the cost and board space.

Driving the LED displays turned out to be a little harder than I originally thought because the super-bright displays we found drop 7.4V, which is obviously higher than the 5V the AVR chip runs on. So I had to use an NPN/PNP transistor pair for each blue LED digit to switch +9V. (Q4/Q4B, Q5/Q5B, Q6/Q6B). This turned out to work well once I became OK with modifying the PCB and changing the code invert the “on” and “off” signals on the AVR pins for the blue digits only.

The yellow digits drop much less voltage, so I ran them on +5V and only needed on PNP transistor per digit (Q1, Q2, Q3). I’ve used the 2N5401 PNP transistor with good results for switching LED segments in other projects, and also have seen it around in the Peggy project… it’s fast and can drop a good amount of power… a keeper.

Finally, there’s a “bar graph” LED display which is 5 sets of LEDs, with 4 LEDs in parallel in each set. Each LED set is a different type of LED so they have a trimpot to set their brightness. I used the same 2N5401 PNP transistor on a 5V rail for these.

I went super-conservative on the powersupply, dropping the original 24V down to 18V, then to 9V, then to 5V.

Oh did I mention I found Pink LEDs! Yeah!!

Enclosure

Beth and drew up the front panel graphics in Illustrator, and I sheared some panels from 2mm aluminum. I then took that to a friend with a mill, who cut the rectangular holes for the numerical displays. I drilled out the round holes figured out a (perhaps excessively elaborate) way to mount the PCB to the front panel, and bend a flanged box to shield the circuit from the rear. The front panel is the main structural element and is mounted to braces which mounted to the frame of the pump.

I powdercoated the front panels white, and then applied the graphics with a decal, and baked that on. It came out pretty nice!

Guitchurn

Posted in Autonomous Bassline on February 21st, 2010 by Dann Green – Be the first to comment
Making butter and basslines

Making butter and basslines

Michael Merck asked me to collaborate on upgrading his Guitchurn, which was (at the time) an acoustic musical instrument coupled to the shell of a common hand-built olde tyme kitchen appliance. Naturally I thought any cottage churner would enjoy electronic basslines while doing the deed, so we connected an Autonomous Bassline Generator to it for the Cantanker Magazine show (issue 7) at the Big Medium Gallery in October ‘09, and then later at the Creative Research Gallery.

The Guitchurn works by a little paddle on the arm breaking an infrared light beam each time you bring the arm down. The Bassline Generator detects the broken beam and plays the next note in the autonomously-generated melody. So you only get music if you’re making butter and vice-versa.

Bread was set out, with a note asking you to “wait until the butter comes”, which surely was incentive to take a turn on the churn. For some people it was their first time churning butter and playing electronic bass! Imagine! Copious amounts of hand-sanitizer, wine bags hanging from framed art, banana pudding in lettered mugs, and Marcel Duchamp speaking backwards also added to the festivities.

Guitchurn Installation at Big Medium Gallery

Guitchurn Installation at Big Medium Gallery

SimSam

Posted in Uncategorized on January 19th, 2010 by Dann Green – 5 Comments

SimSam 1.0

Unveiled at the beginner’s class at Handmade Music Austin #4, the SimSam (Simple Sampler) is a single-chip “sample-rate cruncher” that’s glitchy as all-get-out but only costs about $8 in parts. It’s an effect with an input and output jack; and it’s a noise-maker since a jumper shorts the output back into the input when nothing is plugged into the input jack. We built 28 SimSams in a couple hours at the workshop.
read more »

Handmade Music Austin #3

Posted in Autonomous Bassline, Handmade Music Austin on December 22nd, 2009 by Dann Green – Be the first to comment


YouTube via EA78751
“Video from Handmade Music Austin #3, Dec. 20th 2009. At this workshop 13 people built the free project, Mini Space Rockers. After that we witnessed live electroacoustic sound by Lustigovi. And then 19 people built the upper division project, Andromeda Mk-4 Analog Bass Drum. And last there was an open jam with DIY bassline and drum machines from this workshop series, plus acid lines from a MIDIbox SID.”

Handmade Music Austin #2 superfun!

Posted in Autonomous Bassline, Handmade Music Austin on December 6th, 2009 by Dann Green – Be the first to comment

It was a success, we built 30 mini-Space-Rockers and 25 Autonomous Bassline Generators (in 5 hours!). Treasure City was there selling some used electronica miscellanica… Douglas Ferguson & Steve Marsh , Red X Red M, and Telepathic Friend rocked the house, and we capped it off with a set using a couple dozen Andromeda Space Rocker devices… yeah!

Andromeda Space Rockers interactive jam

Posted in Autonomous Bassline on December 6th, 2009 by Dann Green – Be the first to comment

4ms Pedals and Eric Archer teamed up to present an interactive bass&beats installation at the Hope Center last night in Austin, TX. There were four stations around a table, each station had three Andromeda MK analog drum machines and one Autoanomous Bassline Generator. Each station also had four LEDacle bendy-light tentacles courtesy of Bleeplabs, which you could  shine on the photocells to sweep the filter sounds. Each device kept in time with an IR beam, and a MIDI clock ran between each board to bridge Nathan Wooster’s MIDI-IR Sync devices. It was packed!!

We’ll break it out again at the next Handmade Music Austin event Dec. 20 at the Salvage Vanguard Theater…. Maybe some more events too?

Handmade Music Austin #1 video

Posted in Handmade Music Austin on October 29th, 2009 by Dann Green – Be the first to comment

HMA October was a success! Here’s a video… Next one is Sunday November 14, 2009

Autonomous Bassline kit

Posted in Autonomous Bassline on October 26th, 2009 by Dann Green – 4 Comments

I finally finished the ABG kit! The boards are here and we’re ready to roll for the Nov 14 workshop at Handmade Music Austin…

You can purchase the kit, the PCB, or a programmed AVR chip here
Basic Demo:

What it does with default settings:

IR Sync Demo:

Handmade Music Austin

Posted in Autonomous Bassline, Handmade Music Austin on October 1st, 2009 by Dann Green – Be the first to comment

Church of the Friendly Ghost presents

Handmade Music Austin

A series of DIY electronic music workshops, with expert instructors from Bleep Labs, 4ms Pedals, and Eric Archer.

SYNTHS AND DRUM MACHINES?

In a friendly workshop setting, we’ll present a newly-designed series of miniature electronic instruments, called Andromeda Space Rockers. No bigger than a credit card, these projects are designed for DIY’ers like you. They can be built in a couple of hours to make a working drum machine, bass generator, or micro-synthesizer. These fun little instruments love to jam together, and they do it by forming a wireless network to keep the rhythm! They react to the environment as well… for example, the drum machines‘ filter, pitch, and envelope are controlled with light-reactive photocells.

Each workshop will feature a different instrument.
The full series of kits will be available online as well (to be announced soon).

BEGINNERS ARE WELCOME TOO

Basic classes are offered for beginners free of charge, where you can learn to solder and build an easy music project that will prepare you for Andromeda Space Rock.

Or you can skip straight to the ‘Upper Division’ and build one of the Andromeda Space Rockers instruments. Soldering equipment will be provided. To participate in the Upper Division classes you should be familiar with assembling printed circuit boards. An understanding of electronics theory is not required; just patience, hand-eye coordination, and enthusiasm for DIY music.

OPEN JAM AT EVERY WORKSHOP

Of course, there will be an open jam / performance once the instruments are built. We encourage you to bring some pedals and a small amp to plug in your new synth or drum machine and participate in an exciting musical experiment. Huh? Since the Andromeda Space Rockers communicate with each other using infrared wireless, they keep the rhythm automatically – the space will be filled with synchronized sound as you tweak the tones and control the arrangement. The network supports an unlimited number of instruments; we are building a musical organism that reacts to its environment, part human and part machine, and containing the love built into it by your own hands.

Performances are FREE to attend.

CLASS SCHEDULE

All workshops are on Sundays.

4PM – 5:30 Beginner’s Workshop
6PM – 8 Upper Division instrument building class
8:30 – ? Open Jam and featured performance

CLASS DATES

2009

October 18
November 15 (coincides with East Austin Studio Tour)
December 20

2010

January 17
February 28
March 14
April 18

LOCATION

Salvage Vanguard Theatre
2803 Manor Rd
Austin, TX

HOW TO REGISTER

Beginner’s Workshop is free. Upper Division registration is $45 and includes materials. We’re accepting workshop preregistration for Oct 18th and Nov 15th. The first 2 workshops are filling up quickly!

REGISTER VIA EMAIL AT: churchofthefriendlyghost@gmail.com