Text

AVR debugWire on Linux

Here’s a mini-howto on how to debug 8-bit AVRs with debugWire on Linux. The examples below apply to the AVR Dragon programmer and ATtiny85 microcontroller, but should work with other supported hardware as well.

NB: target must be powered off an external supply, not from the AVR Dragon! See this post.

Enter debugWire mode

$ avrdude -c dragon_isp -p attiny85 -P usb -U hfuse:w:0x9f:m

Now power-cycle the target.

Do some debugging

$ avarice -g -w -P attiny85 :4242
...
Preparing the target device for On Chip Debugging.
Waiting for connection on port 4242.

$ avr-gdb hello.elf 
...
(gdb) target remote :4242
Remote debugging using :4242
0x00000000 in __vectors ()
(gdb)

Enter ISP mode

$ avrdude -c dragon_isp -P usb -p t85
avrdude: jtagmkII_setparm(): bad response to set parameter command: RSP_FAILED
avrdude: jtagmkII_getsync(): ISP activation failed, trying debugWire
avrdude: Target prepared for ISP, signed off.
avrdude: Please restart avrdude without power-cycling the target.

Target is now temporarily in ISP mode until it is power-cycled again.

$ avrdude -c dragon_isp -P usb -p t85 -v
...
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.15s

avrdude: Device signature = 0x1e930b
avrdude: safemode: lfuse reads as 62
avrdude: safemode: hfuse reads as 9F
avrdude: safemode: efuse reads as FF
...

You can now reprogram the fuses to disable debugWire.

Tags: AVR
Text

I have graduated!

It’s been over four months since my last post. A lot has happened since then, but most importantly: I have graduated and now proudly hold a Master’s degree in Computer Science!

Needless to say, I have been quite busy working on my thesis these past months. Titled Evolutionary Music Composition - A Quantitative Approach, it explores the use of Artificial Evolution for the automatic generation of novel music. Here are two sample melodies: “Zelda” (evolved from scratch) and “Let It Be” (inspired by The Beatles’ song).

It has been quite a journey and I can’t help but feel a bit sad that my time as a student is over. But who knows, I might return to academia one day…

Apart from graduating, I have also…

  • Spent the Easter holidays in Tanzania on Safari. Photos will eventually appear on Flickr.
  • Attended GECCO 2011 in Dublin, where I presented a poster related to my thesis.
  • Traveled the north-western coast of Norway, camping along the way.

At the time of writing, I’m in Berlin attending The Desktop Summit 2011 :)

After that an exciting job at ARM awaits!

Text

Alarm Clock 0.3.2 “Indicate this” released!

This release adds support for application indicators and includes various bug fixes:

  • Add support for application indicators
  • Countdown label for application indicator
  • New status icon indicating triggered alarms

Bugs fixed:

565302 - Add countdown label (for application indicator)
610632 - Create ~/.config/autostart if it doesn’t exist
671962 - Add support for libnotify 0.7
682999 - Properly stop triggered alarms that are not playing sound
704956 - Add support for application indicators
706832 - Clicking on status icon should bring up list instead of snoozing

Please see the Alarm Clock website for details on how to get it!

Tags: alarm-clock
Video

Game of Life on the Blinken Button wearable 8x8 LED Matrix.

World is bounded instead of infinite. Random initialization, hours of fun!

Code at GitHub.

Text

Building the Nimbus Mk I

After posting my Nimbus video, people have asked if I could provide more details on the robot’s design and components. This post attempts to give a more thorough overview than the video does, in case you’d like to build your own :-)

Robot: white

Arduino based

Robot: tilted

The robot is based on the Arduino platform which sports an ATmega328 microcontroller running at 16MHz. The Arduino was chosen not only for its ease of use, but also because of the numerous expansion shields available. Nimbus Mk I has one such shield, the Ardumoto Motor Driver Shield, which controls the two DC motors. Other shields can be added as needed, and they stack on top of each other. For instance, I’m currently experimenting with the XBee shield which adds wireless communication.

Motors & wheels

Nimbus can move around thanks to two Micro Metal Gearmotors from Pololu. The motors come in a variety of power and gear ratios which determines the speed and torque of the robot. Early prototypes used the 30:1 motors, but I found that they were be a bit too fast, giving Nimbus a hard time to react quickly enough to sensor input. Instead I settled on the 50:1 variant, which are a bit slower and allows for more fine-grained control.

The motors are mounted on the chassis with a pair of Micro Metal Gearmotor Brackets. The wheels attached to the motors are the 32x7mm Pololu wheels and a 3/8” ball caster is mounted in the front for easy maneuvering.

Sensors - Sharp GP2Y0A21YK

Robot: off

Three infrared proximity sensors serve as Nimbus’ eyes into the world. They are the popular Sharp GP2Y0A21YK which can sense distances between 10mm and 80mm. Other models are also available with different range configurations. Care must be taken when using these sensors though, as their output is non-linear. Acroname Robotics has an excellent article which explains how these sensors work, and how to make sense of their output.

Chassis

Robot: bottom view

The round chassis is one of the few custom made parts on Nimbus. The disc is 128mm in diameter, with slots cut out for the two wheels on each side. It was designed using Inkscape, which allowed me to test out the placement of the components in the correct scale. Early prototypes used a cardboard version of the chassis, which helped discover any mechanical issues early on.

The complete design can be downloaded here (SVG) or as PDF.

When I was satisfied with the design, I printed it out and headed over to the Cybernetics workshop at my university. The friendly fellows there were happy to cut it out for me in super-strong Polycarbonate and drill out the holes.

I’m in the process of making the chassis available for manufacturing through Ponoko - the personal factory. I’ll make a new post soonish :-)

Battery & power supply

The battery is a standard 2-cell 800mAh LiPo with a nominal voltage of 7.4V. These can be purchased from most RC hobby shops. Any battery pack will work though, as long as it supplies a voltage between 7 and 12 volts.

Robot: power supply

Since LiPos should not be charged below 3.0V per cell, the voltage is continuously monitored. A simple voltage divider halves the voltage so it can be read by one of the analog inputs of the Arduino. When the analog reading is below a 3.2V threshold, the robot stops and blinks its LED to indicate that it’s out of power and needs to be recharged. The power supply also includes a power switch, a status LED and Vcc/GND outputs. Everything is put together on a round 1” protoboard.

Here are the schematics.

RGB LED

Mounted through a hole in the center of the chassis is an RGB LED. It serves both as a great debugging tool and as Nimbus’ aura :-) The LED is controlled by three PWM outputs of the Arduino, allowing to display any color. As with the power supply, the circuit is mounted on a round 1” protoboard with three appropriate current-limiting resistors.

List of components

Here’s the full list of the major components, excluding common stuff like wires, screws, resistors and such.

The Code

Finally, the code is up at GitHub for your forking pleasure.

Feel free to post any questions in the comments :-)