A blog of robotics, electronics, mechanics, programming, and engineering.
Pictures, source code, circuit diagrams, ideas, thoughts, drawings, sketches and real-life goofups.
Thursday, July 28, 2011
mbed.org now supports version control
After beta testing, mbed.org has released version control. That is a huge step forward for the usefulness and usability of an already excellent, powerful, cloud-based IDE. I can't wait to give the new feature a try!
Friday, July 22, 2011
Getting Started With ATtiny13, ATtiny85
I've been wanting to play with 8-pin AVRs for awhile and finally got around to it.
Here's what's involved in downloading code to an ATtiny13, ATtiny85, and other AVR microprocessors. In this example, the ATtiny13 resides on a solderless breadboard for prototyping though you could simplify and (shameless promotion) buy my ATtiny breakout boards. :)
AVR's ISP cables have 6 pins: reset, clock (SCK), data to the chip (MOSI), data from the chip (MISO), as well as Vdd and GND. Follow the diagrams on my guide for AVRISP Pinout for 8-pin, 14-pin, 20-pin ATtiny and ATmega328P.

As mentioned (shameless promotion) my eeZee Tiny includes AVRISP header, caps, reset switch and pullup. Add power and start programming. Get the kit from my store on Tindie.
I'm currently using Eclipse with AVR plug-in as my IDE as the editor is significantly better. To use the Pololu AVR Programmer, Configure plug-in that you're using an AVRISP Mk II on whatever serial port is allocated to the programmer.
The ATtiny13 is has very little flash or RAM but you'd be surprised at what you can do with it. It does have a timer with PWM modes and a multi-channel ADC. The form factor is, well, tiny, and the 8-pin AVRs are a great addition to the geek arsenal. I've been using 8-pin and 14-pin ATtinys quite a bit lately.
Did this help you? If so, do me a favor and share via redit, twitter, Google+, etc. Thanks!
Here's what's involved in downloading code to an ATtiny13, ATtiny85, and other AVR microprocessors. In this example, the ATtiny13 resides on a solderless breadboard for prototyping though you could simplify and (shameless promotion) buy my ATtiny breakout boards. :)
Pinouts For In-System Programming
We'll use In-System Programming (ISP), a feature on all the AVR ATtiny and ATmega MCUs (as far as I know). It's a serial protocol, but unlike RS-232, there's a clock signal along with the TX and RX signals.AVR's ISP cables have 6 pins: reset, clock (SCK), data to the chip (MOSI), data from the chip (MISO), as well as Vdd and GND. Follow the diagrams on my guide for AVRISP Pinout for 8-pin, 14-pin, 20-pin ATtiny and ATmega328P.
AVR Programmers
You can use Pololu's inexpensive USB AVR programmer, PGM03A, as I did. It's a great programmer and I used the older version of it for a few years before upgrading. Plug the 6-pin ribbon cable into the programmer, then use jumper wires (I use these jumpers from hacktronics.com) to connect to the ATtiny on the breadboard. Add power (the newer PGM03A has 5V/GND pins) and you're ready to start programming. I've also used a JTAG ICE MkII which is expensive but has worked very well, too.
As mentioned (shameless promotion) my eeZee Tiny includes AVRISP header, caps, reset switch and pullup. Add power and start programming. Get the kit from my store on Tindie.
Choosing an IDE
I decided to try AVRstudio 4 for the first time and Pololu has a tutorial on using AVRstudio with their programmer. It's easy to use an AVR programmer/debugger, as you might imagine. AVRstudio has nice debug features that accelerate troubleshooting in certain circumstances.I'm currently using Eclipse with AVR plug-in as my IDE as the editor is significantly better. To use the Pololu AVR Programmer, Configure plug-in that you're using an AVRISP Mk II on whatever serial port is allocated to the programmer.
Blink an LED on ATtiny
The embedded programming version of hello world, as you probably know, is blinking an LED. We'll cast off the fluffy, protective blanket of Arduino and try this, AVR-style. It's not as easy, but it's not very hard either.#include <avr io.h>
#include <avr interrupt.h>
#include <avr sleep.h>
#include <util delay.h>
/** ATtiny13 hello world; blink LED on Pin 2
*
* Michael Shimniok - http://www.bot-thoughts.com
*/
int main(int argc, char **argv)
{
DDRB |= _BV(3); // PB3 (pin2) as output
while (1) {
PORTB |= _BV(3); // turn on LED
_delay_ms(500);
PORTB &= ~_BV(3); // turn off LED
_delay_ms(500);
}
}
Additional Tips
To avoid programming glitches, keep the ATtiny13 clock speed up (9.6MHz, maybe even disable CLKDIV8) or reduce the programming speed.The ATtiny13 is has very little flash or RAM but you'd be surprised at what you can do with it. It does have a timer with PWM modes and a multi-channel ADC. The form factor is, well, tiny, and the 8-pin AVRs are a great addition to the geek arsenal. I've been using 8-pin and 14-pin ATtinys quite a bit lately.
Did this help you? If so, do me a favor and share via redit, twitter, Google+, etc. Thanks!
Friday, July 1, 2011
Cheap But Excellent Batch PCB Fabrication
I was reading a recent blog post on Life of Kenneth and saw a reference to DorkbotPDX batch PCB fabrication named Laen has been coordinating for some years now. It's know nown as:
OSHPark.com
The printed circuit boards are made in the USA, the costs are $5/sq in with no setup fee for two-layer PCB designs. Four layer boards run more but still quite affordable. You order PCBs in sets of three. And the soldermask is a nice, custom purple! ooooo....!
| Image from DorkbotPDX pcb fabrication ordering site |
I've been using DorkbotPDX now OSHpark for a year or so now and have done probably a dozen printed circuit board layouts. Every one has come back with excellent quality. The silk screening is very detailed, the plating is fantastic, the soldermask are always right on. That's what you get when it's made in the USA.
| My Toshiba Camera Breakout PCB |
![]() |
| Home DIY PCB Fabrication top, DorkbotPDX bottom |
Laen reports a very low error rate of about 1 in 10,000. Can't say enough good things about this service and I often prefer to wait a few weeks and just have the board fabricated than etching my own single-layer PCB at home.
![]() |
| MiniProp: Propeller breakout. QFP 0.6mm pitch |
| ARM LPC2103 breakout PCB. QFP 0.5mm pitch |
![]() |
| Ultra-Micro Lost Model Alarms |
| SMT version of AVRcam. QFP 0.6mm pitch |
Subscribe to:
Posts (Atom)


