Racing The Beam On An ATtiny

For the last thirty or so years, the demoscene community has been stretching what is possible on computer systems with carefully crafted assembly and weird graphical tricks. What’s more impressive is hand-crafted assembly code pushing the boundaries of what is possible using a microcontroller. Especially small microcontrollers. In what is probably the most impressive demo we’ve seen use this particular chip, [AtomicZombie] is bouncing boing balls on an ATtiny85. It’s an impressive bit of assembly work, and the video is some of the most impressive stuff we’ve ever seen on a microcontroller this small.

First, the hardware. This is just about the simplest circuit you can build with an ATtiny85. There’s an ISP header, a VGA port with a few resistors, a 1/8″ audio jack driven by a transistor, and most importantly, a 40MHz crystal. Yes, this ATtiny is running far faster than the official spec allows, but it works.

The firmware for this build is entirely assembly, but surprisingly not that much assembly. It’s even less if you exclude the hundred or so lines of definitions for the Boing balls.

The resulting code spits out VGA at 204×240 resolution and sixty frames per second. These are eight color sprites, with Alpha, and there’s four-channel sound. This is, as far as we’re aware, the limit of what an ATtiny can do, and an excellent example of what you can do if you buckle down and write some really tight assembly.

Continue reading “Racing The Beam On An ATtiny”

Tiny Function Generator On The ATtiny85, Complete With OLED

It’s easy to have a soft spot for “mini” yet perfectly functional versions of electronic workbench tools, like [David Johnson-Davies]’s Tiny Function Generator which uses an ATtiny85 to generate different waveforms at up to 5 kHz. It’s complete with a small OLED display to show the waveform and frequency selected. One of the reasons projects like this are great is not only because they tend to show off some software, but because they are great examples of the kind of fantastic possibilities that are open to anyone who wants to develop an idea. For example, it wasn’t all that long ago that OLEDs were exotic beasts. Today, they’re available off the shelf with simple interfaces and sample code.

The Tiny Function Generator uses a method called DDS (Direct Digital Synthesis) on an ATtiny85 microcontroller, which [David] wrote up in an earlier post of his about waveform generation on an ATtiny85. With a few extra components like a rotary encoder and OLED display, the Tiny Function Generator fits on a small breadboard. He goes into detail regarding the waveform generation as well as making big text on the small OLED and reading the rotary encoder reliably. His schematic and source code are both available from his site.

Small but functional microcontroller-based electronic equipment are nifty projects, and other examples include the xprotolab and the AVR-based Transistor Tester (which as a project has evolved into a general purpose part identifier.)

These Small PCBs Are Made For Model Rocketry

Model rocketry hobbyists are familiar with the need to roll their own solutions when putting high-tech features into rockets, and a desire to include a microcontroller in a rocket while still keeping things flexible and modular is what led [concretedog] to design a system using 22 mm diameter stackable PCBs designed to easily fit inside rocket bodies. The system uses a couple of 2 mm threaded rods for robust mounting and provides an ATTiny85 microcontroller, power control, and an optional small prototyping area. Making self-contained modular sleds that fit easily into rocket bodies (or any tube with a roughly one-inch inner diameter) is much easier as a result.

The original goal was to ease the prototyping of microcontroller-driven functions like delayed ignition or altimeter triggers in small Estes rockets, but [concretedog] felt there were probably other uses for the boards as well and made the design files available on GitHub. (Thanks!)

We have seen stackable PCBs for rocketry before with the amazingly polished M3 Avionics project, but [concretedog]’s design is much more accessible to some hobbyist-level tinkering; especially since the ATTiny85 can be programmed using the Arduino IDE and the boards themselves are just an order from OSH Park away.

[via Dangerous Prototypes Blog]

 

Debugging An Arduino With An Arduino

As every Hackaday reader knows, and tells us at every opportunity in the comments, adding an Arduino to your project instantly makes it twice as cool. But what if, in the course of adding an Arduino to your project, you run into a problem and need to debug the code? What if you could use a second Arduino to debug the first? That would bring your project up to two Arduinos, instantly making it four times as awesome as before you started! Who could say no to such exponential gains?

Debugging an ATTiny85

Not [Wayne Holder], that’s for sure. He writes in to let us know about a project he’s been working on for a while that allows you to debug the execution of code on an Arduino with a second Arduino. In fact, the target chip could even be another AVR series microcontroller such as a the ATTiny85. With his software you can single-step through the code, view and modify values in memory, set breakpoints, and even disassemble the code. Not everything is working fully yet, but what he has so far is very impressive.

The trick is exploiting a feature known as “debugWIRE” that’s included in many AVR microcontrollers. Unfortunately documentation on this feature is hard to come by, but with some work [Wayne] has managed to figure out how most of it works and create an Arduino Sketch that lets the user interact with the target chip using a simple menu system over the serial monitor, similar to the Bus Pirate.

[Wayne] goes into plenty of detail on his site and in the video included after the break, showing many of the functions he’s got working so far in his software against an ATTiny85. If you spend a lot of time working on AVR projects, this looks like something you might want to keep installed on an Arduino in your tool bag for the future.

Debugging microcontroller projects can be a huge time saver when your code starts running on real hardware, but often takes some hacking to get working.

Continue reading “Debugging An Arduino With An Arduino”

A Game That Does More With Less

[David Johnson-Davies] created a minimal Secret Maze Game using a single ATTiny85 and a few common components. This simple game uses four buttons, four LEDs, and a small speaker. The player moves in the four cardinal directions using buttons, and the LEDs show walls and corridors. If an LED is lit, it means the path in that direction is blocked by a wall, and attempting to move in that direction will make a beep. When the player reaches the exit, a short victory tune chirps from the speaker.

Sample maze. A 16×16 matrix is allocated for maze designs.

Since the ATTiny85 has only five I/O lines, [David] had to get a bit clever to read four buttons, display output on four LEDs, and drive a little speaker. The solution was to dedicate one pin to the speaker and the other four to charlieplexing, which is a method of driving more LEDs than you have pins. It takes advantage of the fact that most microcontroller pins can easily switch state between output high, output low, or low-impedance high-impedance input.

As for the buttons, [David] charlieplexed them as well. Instead of putting an LED in a charlieplexed “cell”, the cell contains a diode and an SPST switch in series with the diode. To read the state of the switch, one I/O line is first driven low and the other I/O line is made an input with a pullup. A closed switch reads low on the input, and an open switch reads high. With charlieplexing, four pins is sufficient for up to twelve LEDs (or buttons) in any combination, which is more than enough for the Secret Maze.

Charlieplexing is also what’s behind this 110 LED micro-marquee display, or this elegant 7-segment display concept that takes advantage of modern PCB manufacturing options.

Environmentally Aware Jewelry Gets Attention

We didn’t include a “Most Ornate” category in this year’s Coin Cell Challenge, but if we had, the environmentally reactive jewelry created by [Maxim Krentovskiy] would certainly be the one to beat. Combining traditional jewelry materials with an Arduino-compatible microcontroller, RGB LEDs, and environmental sensors; the pieces are able to glow and change color based on environmental factors. Sort of like a “mood ring” for the microcontroller generation.

[Maxim] originally looked for a turn-key solution for his reactive jewelry project, but found that everything out there wasn’t quite what he was looking for. It was all either too big or too complicated. His list of requirements was relatively short and existing MCU boards were simply designed for more than what he needed.

On his 30 x 30 mm PCB [Maxim] has included the bare essentials to get an environmentally aware wearable up and running. Alongside the ATtiny85 MCU is a handful of RGB LEDs (with expansion capability to add more), as well as analog light and temperature sensors. With data from the sensors, the ATtiny85 can come up with different colors and blink frequencies for the LEDs, ranging from a randomized light show to a useful interpretation of the local environment.

It’s not much of a stretch to imagine practical applications for this technology. Consider a bracelet that starts flashing red when the wearer’s body temperature gets too high. Making assistive technology visually appealing is always a challenge, and there’s undoubtedly a market for pieces of jewelry that can communicate a person’s physical condition even when they themselves may be unable to.

Form or function, life saving or complete novelty, there’s still time to enter your own project in the 2017 Coin Cell Challenge.

Minimizing ESP8266 Battery Drain

[Alex Jensen] wanted to build a battery-powered weather station, using an ESP8266 breakout board to connect to WiFi. However, [Alex]’s research revealed that the ESP chip uses around 70mA per hour when the radio is on — meaning that he’d have to change batteries a lot more than he wanted to. He really wanted a low power rig such that he’d only have to change batteries every 2 years on a pair of AAs.

The two considerations would be, how often does the ESP get powered up for data transmissions — and how often the weather station’s ATtiny85 takes sensor readings. Waking up the ESP from sleep mode takes about 16mA — plus, once awake it takes about 3 seconds to reconnect, precious time at 70mA. However, by using a static IP address he was able to pare that down to half a second, with one more second to do the actual data transmission. In addition to the hourly WiFi connection, the Tiny85 must be powered, though its relatively modest 1.5mA per hour doesn’t amount to much, even with the chip awake for 36 hours during the year. All told, the various components came to around 500 mAh per year, so using a pair of AA batteries should keep the rig going for years.

We’re intrigued by stories of hackers eking out every last drop of power to make their projects work. We’ve posted about ESPs low-power mode before, and what can be more low-power than a watch running off a coin cell?