tinyDriver – ATtiny84 platform without Arduino

You don’t need an Arduino for everything! Or do you? This is an argument that plays out here quite often. Whatever the outcome, most folks agree that once you’ve dipped your feet in the shallow end of the pool, the real fun is when you dive into the deep end.

[Mahesh Venkitachalam] designed tinyDriver, an experimental Open Source breakout board for the Atmel ATtiny84 chip. His idea was to create a convenient platform which can be used to understand microcontrollers in-depth, by letting users dive under the hood and make use of the various features of the chip such as timers, PWM, interrupts, ADC, and digital I/O. The ATtiny84 is cheap and simple enough for starters. Add a low-cost AVR programmer, install the free and cross-platform avr-gcc and avrdude tool chain, read up the data sheet, learn some C programming and start experimenting. Rinse and repeat and you’ll be a pro at it soon. He’s got a few starter projects documented on his website to get you going.

The hardware is open source, and the Git repository contains the hardware source and example code. If you’re a hardware noob, he’s thoughtfully added a PTC resettable fuse and reverse polarity protection on the board to make sure you don’t release the magic blue smoke prematurely. All of the I/O’s are broken out on a header, and the motor driver and RGB LED can be disabled when not needed. The board isn’t hand-assembly friendly, but he plans to crowd fund it shortly. If you want to move beyond the Arduino platform, projects like the tinyDriver are the way to go.

The HackadayPrize2016 is Sponsored by:

Flashing Chips With A CNC

[Eberhard] needed to flash several hundred ATMegas for a project he was working on. This was a problem, but the task did have a few things going for it that made automation easy. The boards the ‘Megas were soldered to weren’t depanelized yet, and he had a neat and weird bed of nails programming connector. There was also a CNC machine close by. This sounds like the ideal situation for automation, and it turns out the setup was pretty easy.

The boards in question were for FPV/radio control telemetry adapter and thankfully the assembly house didn’t depanelize the 40 PCBs on each board before shipping them out. A very cool ATMega flashing tool handled the electrical connections between the computer and the microcontroller, but a real, live human being was still required to move this flashing tool from one chip to the next, upload the firmware, and repeat the process all over again.

The solution came by putting a few metal pins in the bed of a CNC mill, 3D print an adapter for the flashing tool, and writing a little code to move the flashing tool from one chip to the next. An extremely simple app takes care of moving the programmer to an unflashed chip, uploading the firmware, and continuing on to the next chip.

There’s still some work to be done that would basically tie together the Gcode and AVRdude commands into a single interface, but even now a complete panel of 40 PCBs can be programmed in a little over 10 minutes. You can check out a video of that below.

Continue reading “Flashing Chips With A CNC”

Automated programming and testing jig built with Raspberry Pi


[Doug Jackson] makes word clocks, and he must be doing quite a bit of business. We say that because he put together a programming and test bed for the clock circuit boards.

This is a great example to follow if you’re doing any kind of volume assembly. The jig lets the populated PCB snap into place, making all the necessary electrical connections. This was made possible by a package of goods he picked up on eBay which included rubber spacers to separate the board from the acrylic mounting plate, pogo pins to make the electrical connections, and a spring-loaded board clamp seen to the left in this image.

The switch in the lower right connects power to the board and pulls a Raspberry Pi GPIO pin high. The Python script running on the RPi polls that pin, executing a bash script which programs the ATmega169 microcontroller using the GPIO version of AVRdude. We looked through his Python script and didn’t see code for testing the boards. But the image above shows a “Passed” message on the screen that isn’t in his script. We would wager he has another version that takes the hardware through a self test routine.

We first saw one of [Doug’s] word clocks back in 2009 and then again a few months later. The look of the clock is fantastic and it’s nice to see the project is still going strong.

Programming microcontrollers with a Raspi


The advent of the Arduino brought the world of microcontrollers to hobbyists, students, and artist the world over. Right now we’re in the midst of a new expansion in hobbyist electronics with the Raspberry Pi, but we can’t expect everyone to stay in the comfortable, complex, and power-hungry world of Linux forever, can we? Eventually all those tinkerers will want to program a microcontroller, and if they already have a Raspberry Pi, why not use that?

[Kevin] wanted to turn his Raspi into an AVR development workstation, without using any external programmers. He decided to use the Raspi’s SPI port to talk to an AVR microcontroller and was able to make the electrical connections with just a few bits of wire an a handful of resistors.

For the software, [Kevin] added support for SPI to avrdude, available on his git. Theoretically, this should work with any AVR microcontroller with the most popular ATMegas and ATtinys we’ve come to love. It doesn’t support the very weird chips that use TPI programming, but it’s still extremely useful.

Rolling your own minimal USB to serial Arduino programmer


[Hans Peter] wanted to move away from using full Arduino boards in his projects. One of the components he rarely used after the development stage is the USB hardware. Once the firmware is flashed to the chip he didn’t need it any longer. So he tried his hand with some really small SMD parts by building this USB to serial Arduino programmer.

The chip he went with isn’t the FTDI part we’re used to. Instead of using an FT232RL, he opted for its smaller cousin the FT230x. This chip doesn’t fully implement the communications protocol of the 232, but it does work with AVRdude and that’s all that really matters. Above you can see [Hans’] creation next to the official Arduino USB-to-serial programmer. He used the same connection scheme, but went with an edge connector for the USB instead of using a mini-B jack.

It’s pretty impressive to see his prototyping work with the 16-pin QFN package. He soldered it dead-bug style to a couple of SIL pin headers in order to test it on a breadboard. The first board he assembled was too loose in the USB port, but he added some tape to the back to make it thicker, and coated the edge connector traces with a bit of solder and that did the trick.

USB Keyboard Becomes an AVR Programmer

[Steve] created an AVR programmer using an old USB keyboard. We feature a bunch of AVR programmers, but this one is made from parts that many people will have lying around. There are two components: the controller PCB from a USB keyboard, and an optocoupler for emulating key presses.

In order to send data to the AVR, [Steve] used the LED outputs on the keyboard. These LEDs can easily be toggled according to the HID device specification. They provide a 5 volt output with current limiting resistors, which means they can be connected directly to the target AVR.

Reading data is a bit more complex. The optocoupler tricks the keyboard into believing that a single key has been pressed, firing off a data transfer. The MISO pin on the AVR is connected to the row and column of the shift key, which is read by the driver.

On the software side [Steve] created an avrdude interface driver. This allows the programmer to be used with avrdude, just like any other programmer. [Steve] does point out that it isn’t the fastest programmer since the keyboard tries to debounce the MISO input, greatly limiting the speed. However, since it’s made from stuff you might have in your junk bin, it’s a neat hack.

AVR fuse bits explained

Every AVR microcontroller, from the ATtiny in your thermostat to the ATMega in your Arduino, stores its configuration in a series of fuse bits. These fuse bits control settings such as the multiplier of the internal oscillator (and thus the speed of the chip), or if the reset pin can be used as a GPIO pin. [YS] just put up an awesome tutorial for understanding these fuse/lock bits, and it’s just the reference guide you’ll need when you find your AVR is running 8 times slower than you would like.

As an example, [YS] uses the ATMega48 default settings. From the factory, the ‘Mega48 ships with it’s fuse bits set to use an 8MHz internal RC oscillator with the CKDIV8 bit set. This results in the chip operating at 1MHz, a bit slow for [YS]’ liking.

By looking at the datasheet for the ATMega48, [YS] found the CKDIV8 fuse was the 7th bit in the low fuse byte. From the factory, the default value for this byte is 0b01100010. To remove the ‘divide clock by 8’ bit, [YS] needed to change the low byte to 0b11100010, or 0xE2. This is done via AVRdude by appending lfuse:w:0xE2:m to the commands entered when programming.

Fuse bits don’t need to be scary. As long as you can convert between binary and hex, can remember there are 7 bits in a byte (remember to start counting from 0), and have access to an easy to use fuse calculator, it’s possible to change all the settings on any AVR you have on hand.