I have spent a fair amount of time with 8-bit AVR microcontrollers and one of the cooler things has been the V-USB library which implements low-speed USB with clever (and very time-critical) bit-banging. The popularity of my USB tutorials is a testament to its usefulness, and I’ve gotten lots of mileage out of that.
There are, however, some limitations to software USB with such a low spec microcontroller. USB communication hogs up the MCU completely during USB communication, which means you lose dozens of microseconds in random (or in many cases 8 ms) intervals. This rules out things like software UART at reasonable speeds (which I discovered when trying to implement MIDI on Adafruit Trinket). And more powerful ATmega328-based dev boards like Pro Trinket start to get quite large.
Not so with this tiny beauty shown in the image. It’s a ATmega32U4 based board, where the U4 means it has hardware USB support. The form factor is extremely compact 12 pin header length, which leaves 5 rows free on the smallest prototyping breadboards. That means you can have a DIP8 component with a few resistors on the same breadboard (such as a 6N137 optocoupler which is nice for MIDI… ;).
And the best part is, that because the chip is flashed with same firmware used in Arduino Leonardo (and a largely matching pinout), you can use Arduino for programming, and
avrdude supports it out of the box.
Actually, scratch the above statement. The best part is the price. The board is based on Sparkfun Pro Micro 16 MHz, but it’s actually a Chinese clone, which you can get for $4 via DealExtreme and from quite many places in AliExpress: Just search for ATmega32U4 and they will come up. This means you can just order five and solder them into whatever project you’ll make permanently. And unlike Arduino Micro (for which clones exist as well), this has the micro-USB port already in place.
Using Pro Micro without Arduino IDE
Now you can just follow SparkFun’s instructions on how to use that thing on Arduino (short version: select Leonardo as board type, and look up the schematic if you are unsure which pins are connected to LEDs, etc.). But if you’re like me and want to get to raw metal,
avrdude is the way to go. Here’s a simple blinky demo:
Continue reading USB Mouse with ATmega32U4 Pro Micro Clone and LUFA
As if I didn’t have enough things on my “to try when I have the time” list already, I recently did a little shopping in both Adafruit and SparkFun. Both had several nifty breakout boards available that promised to speed up and streamline my breadboard projects a lot. In addition to some SMD breakouts that are still in their sealed bags, here’s what I got:
I had a lot of fun soldering the breadboard headers to these little guys. Many are for future projects, like the frequency generator which I’m planning to use for some RFID experiments, and some are just to avoid stripping apart stuff like the connector breakouts. As today’s main topic, I’m covering the DS1307 realtime clock (RTC) breakout in more detail. If you are interested in some of the other items, drop me a comment and I’ll get back to it!
DS1307 Realtime Clock
A realtime clock is simply something that keeps record of the time. Usually, these types of clocks are paired with a small coin cell battery that enables them to keep on counting even if the rest of the circuit is powered of. Such is the case with this breakout, too. Adafruit has an excellent tutorial covering the assembly of this device, all you need is some solder and an iron.
After getting it together, it took me a while to get it working. I used Bus Pirate to communicate with the chip, with the following connections:
Continue reading Breakout Bonanza and DS1307 Realtime Clock
I have been wanting to try this one out ever since I soldered together my USB password generator six months ago, just to realize that I would’ve actually liked to make a few changes to the firmware. The problem with my design was, that I had managed to pack everything so tightly, that there was no hope of reaching the ATtiny85 pins via normal methods to reprogram it.
I initially tried to use a 8-pin DIP socket and press it against the MCU, but it soon became apparent, that I could not keep it stable for all the pins to keep contact long enough. Lacking proper microhooks, I had to postpone the idea shown in the above photo until I just recently put my hand on this set of IC hooks from SparkFun.
The five IC hooks came one hook short of the six needed by the ISP header, but fortunately/unfortunately one of the pins was impossible to access even with these tiny hooks, so I manually held a yellow jumper wire against the MISO pin while running avrdude. Did it work? Look for yourself:
Definitely not rocket science, but for $4.95, I’d say it’s a pretty good deal!