The Mystery Of A Particular ATtiny85 Fuse

First-timers playing with 8-bit micros such as the AVR and PIC will at some point in their lives, find themselves locked out of their MCUs. This is usually attributed to badly configured fuses that disable certain IO functions rending the device unprogrammable via conventional ICSP methods. [Uri Shaked] shares his story of how his ATtiny85 got locked and became the subject of a lengthy investigation into fuse bit configurations.

[Uri]’s journey started when he accidentally left some pins of the device connected to a second board while he was flashing the firmware. He quickly researched online for a solution for the problem and it turns out, there are a number of recipes to resolve the issue. As it turns out, his problem was not so straight-forward and warranted more digging. [Uri] ended setting up a High Voltage Programming serial programming setup and then probing the communications. He discovered that the chip refused to reset its fuses and would reject attempts to set fuses.

Further investigation of the fuse bits and reading them proved useful in understanding that the memory protection features were preventing alteration of the device. The quick-fix was to erase the ATtiny and things were back to normal thereafter. [Uri] details his pursuit of reading and comparing fuse bits from the impacted chip against a fresh device which is where he makes the discovery. The write-up is a case study in the investigation into the idiosyncrasies of device programming and will be a great resource for many and reduce hair loss for some.

Once you get your hands on an ATTINY, there are a number of small experiments to be done to cure boredom. Be sure to share your experiments and stories with us to inspire the masses.

Motorized Magic Over HDMI

There is a certain warmth that seems to emanate from stereo receivers of the 70s, 80s, and 90s. Despite their large footprint and considerable heft, the soft glow of the indicator lights and solid kerthunk of switches provide a sense of coziness. When [Tom] recently swapped his receiver for a 1970s Pioneer SX-950, he found himself getting up from the couch to adjust the volume when watching TV far too often for his liking. Resolving to do something about it, he added some magic in the form of a motorized volume knob. One of the coolest tricks for stereos was to have a small motor attached to the volume knob so that it could turn the volume up or down via a remote.

The first obstacle came when [Tom] had to forgo the center tap on the potentiometer to get a motorized one. This meant the volume compensation feature would be disabled, which is but a small price to pay for convenience. After scouring the internet, he finally had the part in hand only to discover some troublesome capacitors in the way. The new pot had a rather large motor hanging off the back that the previous one didn’t have. Fortunately, there was a good bit of space between the PCB and the bottom of the chassis, so Tom was able to just flip the capacitors to the underside of the board and bend them on their sides.

The next problem to solve was how to change the volume remotely. IR was considered as well as optical cable control signals. What [Tom] did instead was to implement HDMI CEC (consumer electronics control). CEC was well documented and seemed simple to implement on an ATTINY4313 with the help of a half-H driver. The CEC protocol implemented by [Tom’s] TV seemed to be very sensitive to timing, so an external crystal was used to get more precise timing and additional handshaking was implemented to get the TV to accept the microcontroller as valid. A few fail-safes were added to make sure the motor didn’t burn out if something went wrong with the CEC protocol and a nice enclosure wrapped up the build quite nicely.

We’ve seen CEC implemented before on a PIC 18F87J50, but as a sender of CEC commands not a receiver. [Tom’s] code is available on GitHub and might prove useful if you’re looking to implement CEC on an AVR.

Thanks [Tom] for sending this one in!

Tiny Mario Clone On A Tiny Processor

We’ve become used to seeing retro games running on commodity microcontrollers where once they would have required the bleeding-edge console hardware of their day. [Duncan]’s Mario clone takes the genre a little further, using not a processor with plenty of pins for peripherals, but instead the humble ATtiny85. Its eight pins drive two OLED displays, and accept input from the buttons of a cheap Nintendo-like controller.

The write-up is split between software and hardware sections, with all the software itself available from a GitHub repository. He’s bit-banging the i2C for the displays for an impressive turn of speed, and the ATtiny’s lack of pins is addressed by clever use of resistive dividers to present a different voltage for each button pressed. With a truth table of voltages he’s even able to detect multiple simultaneous button presses. Music is achieved with the chip’s limited resources by storing the sounds in EEPROM, and clocked it at 16 MHz for smooth gameplay.

The whole is mounted inside the shell of the controller, with its USB guts removed and replaced by a smart custom PCB. An unexpected problem with ground plane fill caused a temporary roadblock reading the buttons, but the finished product is a very Nintendo-like experience. We like it.

Minimal TinyAVR 0 Programming

When [Alain] wanted to use some of the new TinyAVR 0 chips — specifically, the Attiny406 — it seemed overkill to use the Windows IDE. There are plenty of sources of information on programming other AVR chips using simple command line tools, but not for these newer 0-series parts which use a new programming protocol known as UPDI. That led to a deep diving into how to program a TinyAVR 0 with a text editor, makefile, and USB-to-serial cable.

The Attiny406 has 4K of flash, 256 bytes of RAM and can run at 20 MHz with no external clock. You might think programming would be similar to a regular AVR part, but these tiny devices use UPDI (Unified Programming and Debug Interface) which uses 3 pins for programming. Older devices used different protocols.

It is very easy to create a UPDI programmer. A USB to logic-level serial cable and a 4.7K resistor is all it takes. There’s Python code that knows how to drive the protocol, too. You can also use the logic-level serial port on the Raspberry Pi with some device tree modifications explained in the code’s documentation.

[Alain] made a nice breakout board for the device. It fits a breadboard, allows for 5V or 3.3V operation, and has an LED and switch. Nothing fancy, but handy. Once you know how to ship a hex file to the chip, the rest is pretty standard. While the AVR version of gcc doesn’t cross-compile for the ATTiny out of the box, there is a device pack from Microchip that enables that feature.

The trend is to go to bigger processors, not smaller, but when you need to cram something in a small space, save a few pennies per unit, or draw very little power, these tiny processors can be just the ticket. The processors may be small, but if you work you can do some pretty big things with them.

Rapid Charging Supercapacitors

Battery technology is the talk of the town right now, as it’s the main bottleneck holding up progress on many facets of renewable energy. There are other technologies available for energy storage, though, and while they might seem like drop-in replacements for batteries they can have some peculiar behaviors. Supercapacitors, for example, have a completely different set of requirements for charging compared to batteries, and behave in peculiar ways compared to batteries.

This project from [sciencedude1990] shows off some of the quirks of supercapacitors by showing one method of rapidly charging one. One of the most critical differences between batteries and supercapacitors is that supercapacitors’ charge state can be easily related to voltage, and they will discharge effectively all the way to zero volts without damage. This behavior has to be accounted for in the charging circuit. The charging circuit here uses an ATtiny13A and a MP18021 half-bridge gate driver to charge the capacitor, and also is programmed in a way that allows for three steps for charging the capacitor. This helps mitigate the its peculiar behavior compared to a battery, and also allows the 450 farad capacitor to charge from 0.7V to 2.8V in about three minutes.

If you haven’t used a supercapacitor like this in place of a lithium battery, it’s definitely worth trying out in some situations. Capacitors tolerate temperature extremes better than batteries, and provided you have good DC regulation can often provide power more reliably than batteries in some situations. You can also combine supercapacitors with batteries to get the benefits of both types of energy storage devices.

Putting The Firmware In Your Firmware

Performing over-the-air updates of devices in the field can be a tricky business. Reliability and recovery is of course key, but even getting the right bits to the right storage sectors can be a challenge. Recently I’ve been working on a project which called for the design of a new pathway to update some small microcontrollers which were decidedly inconvenient.

There are many pieces to a project like this; a bootloader to perform the actual updating, a robust communication protocol, recovery pathways, a file transfer mechanism, and more. What made these micros particularly inconvenient was that they weren’t network-connected themselves, but required a hop through another intermediate controller, which itself was also not connected to the network. Predictably, the otherwise simple “file transfer” step quickly ballooned out into a complex onion of tasks to complete before the rest of the project could continue. As they say, it’s micros all the way down.

The system de jour

Continue reading “Putting The Firmware In Your Firmware”

Solar Satellite Glows At Night

They say that imitation is the sincerest form of flattery. If we were going to imitate one of master circuit sculptor Mohite Bhoite’s creations, we’d probably pick the little blinky solar satellite as a jumping off point just like [richardsappia] did. It’s cute, it’s functional, and it involves solar power and supercapacitors. What more could you want?

SATtiny is a pummer, which is BEAM robotics speak for a bot that soaks up the sun all day and blinks (or ‘pumms’, we suppose) for as long as it can throughout the night on the juice it collected. This one uses four mini solar panels to charge up a 4 F supercapacitor.

At the controls is an ATtiny25V, which checks every eight seconds to see if the supercapacitor is charging or not as long as there is enough light. Once night has fallen, the two red LEDs will pumm like a pair of chums until the power runs out. Check out the brief demo after the break.

Would you rather have something more nightstand-friendly? Here’s a mini night light sculpture with a friendly glow. If you haven’t started your entry into our Circuit Sculpture Challenge, there’s still plenty of time — the contest runs until November 10th.

Continue reading “Solar Satellite Glows At Night”