There are smaller microcontrollers than the ATtiny13. Some ARM chips will fit on the head of a large pin, and even in Atmel world, the ATtiny10 comes in a tiny SOT-23-6 package – a size normally reserved for surface mount transistors. The ‘tiny13, though, can be programmed with just about any ISP and comes in an 8-pin DIP. It’s the bare minimum if you’re looking to break out of the world of Arduino, and you can do some pretty cool things with it, like playing some holiday audio with an SPI Flash chip.
[Vinod] tried opening up a cheap camera pen, but in the course of disassembly a few traces broke. He was now left with a 4Mbit SPI Flash chip. This was obviously the time to investigate what could be done with a small microcontroller and a huge amount of Flash. and the Attiny13 audio player was born.
The circuit uses one PWM for audio out, and reads audio directly from the Flash chip. The UART on board the ‘tiny13 is used to update the Flash, and there’s also a switch to select between play and record. If you’re counting, that means there are 4 pins for the Flash, 2 pins for the UART, 1 for the switch, one for the audio output, and the power and ground rails, all in an 8-pin package. That’s a pretty cool way to use one pin for two different functions.
You can check out a video of the project in action below.
Continue reading “Holiday Cheer From The ATtiny13”
Class D amps are simple – just take an input, and use that to modulate a square wave with PWM. Send this PWM signal to a MOSFET or something, and you have the simplest class D amp in existence. They’re so simple, you can buy a class D amp chip for $3, but [George] thought that would be too easy. Instead, he built his own with an ATTiny and an H-bridge motor driver. No surprise, it works, but what’s interesting is what effect the code on the ATtiny can have on the quality of the audio coming out of the speaker.
The microcontroller chosen for this project was the ATtiny 461, a part we don’t see much, but still exactly what you’d expect from an ATtiny. The heavy lifting part of this build is an L298 chip found on eBay for a few dollars. This dual H-bridge is usually used for driving motors, but [George] found a home for it in the power section of an amplifier.
The ATtiny is clocked at 16 MHz, making the ADC clock run at 1 MHz. A 10-bit precision conversion takes place, and this value sets the PWM duty cycle. Timer1 in the chip is set up to run at 32 MHz, and by counting this timer up to 1023 gives this amp its PWM cycle speed of 31.25 kHz. That’s right in the neighborhood of what a class D amp should run at, and the code is only about 30 lines. It can’t get simpler than that.
[George] put up a video of this amp in operation, and despite not following the standard design of a Class D amp, it sounds pretty good. You can see that video below.
Continue reading “Class D Amp with an H-Bridge”
Back in the bad ‘ol days of computing, hard drives cost as much as a car, and floppy drives were incredibly expensive. The solution to this data storage problem offered by all the manufacturers was simple – an audio cassette. It’s an elegant solution to a storage problem, and something that has applications today.
[Jari] was working on a wearable message badge with an 8-pin ATTiny. To get data onto this device, he looked at his options and couldn’t find anything good; USB needs two pins and the firmware takes up 1/4 of the Flash, UART isn’t available on every computer, and Bluetooth and WiFi are expensive and complicated. This left using audio to send digital data as the simplest solution.
[Jari] went through a ton of Wikipedia articles to figure out the best modulation scheme for transferring data with audio. What he came up with is very simple: just a square wave that’s changed by turning a pin off and on. When the audio is three samples long without crossing zero, the data is 0. When it’s five samples long without crossing zero, the data is 1. There’s a 17-sample long sync pulse, and with a small circuit that acts as a zero crossing detector, [Jari] had a simple circuit that would transfer data easily and cheaply.
All the code for this extremely cheap modem is available on GitHub.
The typical way of doing a low battery detector is throwing a comparator in the circuit, setting it to measure a certain threshold voltage, and sending that signal off to a microcontroller or other circuit to notify someone the battery is going dead. [Josh] has a simpler way using an 8-bit AVR and zero other parts.
The chip [Josh] is using is the ATtiny84. The ADC in this chip is usually used to measure an unknown voltage against a reference voltage. The trick [Josh] is using is to do this in reverse: The internal 1.1 Volt reference voltage is measured against an unknown scale, namely the input voltage.
The value provided by the ADC on the chip will always be Vin times 1024 over the reference voltage. Since Vin will be 1.1 V in this case, the ADC value is known, it’s only a matter of doing some 6th grade algebra to determine the value of the input voltage.
[Josh] put together a small demonstration where the chip blinks out the number of volts its receiving from a bench power supply. By blinking a LED, it can blink out the current value of VCC as integers, but by using this technique you should be able to get a fairly fine-grained reading of what VCC actually is. Video below.
Continue reading “Adding a Battery Gauge to a Project With Zero Parts”
[JP] was looking for a bicycle light to do some night biking around his home. He found a reasonably priced light that suited his needs, but when he started using it he found that the controller was a little lackluster. To solve some of its problems, he ended up building his own lighting controller from scratch.
The original controller’s main problem was that the it didn’t debounce the input from the single pushbutton. This meant that a single press of the button might cause it to cycle through two or three different modes, which was inconvenient and annoying. The new controller took care of this along with implementing several new brightness modes and a “strobe” mode for commuting to work to help alert other drivers of [JP]’s presence on his bicycle.
While [JP] notes that an Arduino would have been very easy to use in this situation, it wouldn’t have fit in the original enclosure. He went with an 8-pin ATtiny45, which was perfectly sized for what he needed. Everything fit together perfectly and is much more useful than the original. Maybe next he could pair it with a light that is even brighter than the one he’s currently using.
If you want to program an AVR chip as inexpensively as possible, then [Ian’s] solution might just be for you. He built an AVR programmer using only four components. This design is based on the vusbtiny AVR programmer design, with a few components left out.
[Ian’s] design leaves out two of the resistors and two diodes, leaving just four components. These include a 1.5k resistor, a small capacitor, a USB connector, a six pin header, and an ATtiny45. He admits that this may not be exactly up to USB spec, but it does work.
This is one of those projects that is really an exercise in “will it work?” more than anything else. The fact that you need to first program an AVR chip means that this wouldn’t be useful in a pinch, because you would already have to have a working programmer. Nonetheless, it’s always fun to see what can be done with as little as possible.
A few days ago we saw what would have been a killer Kickstarter a few years ago. It was the smallest conceivable ATtiny85 microcontroller board, with resistors, diodes, a USB connector, and eight pins for plugging into a breadboard. It’s a shame this design wasn’t around for the great Arduino Minification of Kickstarter in late 2011; it would have easily netted a few hundred thousand dollars, a TED talk, and a TechCrunch biopic.
[AtomSoftTech] has thrown his gauntlet down and created an even smaller ‘tiny85 board. it measures 0.4in by 0.3in, including the passives, reset switch, and USB connector. To put that in perspective, the PDIP package of the ‘tiny85 measures 0.4 x 0.4. How is [Atom] getting away with this? Cheating, splitting the circuit onto two stacked boards, or knowing the right components, depending on how you look at it.
[Atom] is using a few interesting components in this build. The USB connector is a surface mount vertical part, making the USB cord stick out the top of this uC board. The reset button is extremely small as well, sticking out of the interior layer of the PCB sandwich.
[AtomSoft] has the project up on OSH Park ($1.55 for three. How cool is that?), and we assume he’ll be selling the official World’s Smallest Arduino-compatible board at Tindie in time.