Ambitious ATtiny85 Board Tests A Beginner’s Skills

[Chris O’Riley] has been playing around with Arduinos for around a year, and decided he wanted a breadboardable ATtiny85 in order to prototype using the actual controller that would be used in the final project. He wants to use it to interface with a Bosch BMP280 pressure sensor, but for now it stands alone.

It’s a simple board with the Tiny85, 3.3 V and 5 V regulators, a power LED, as well as the usual resistors and caps [Ed: not resistor sand caps]. The double-sided PCB [Chris] milled himself — he’s an illustrator and photographer by day, so it’s no surprise the board turned out gorgeous. He designed the board in Illustrator after taking a stab at Eagle, then ran it through his CNC to mill the circuits using a .017 inch end mill as well as drilling the vias. He add solder paste using the tip of a knife, but after messing around with an iron, he ended up investing in a hot air rework station.

We love our Tiny85s here on Hackaday. Check out the ATtiny85 gaming console, the NTSC-generating ATTiny85, and making DIY I2C devices with the chip.

Saturday clock - 1 CPU clock cycle per day

Saturday Clock: An 0.000011574Hz ATtiny85 Clock

In these times when we try to squeeze out extra clock cycles by adding more cores to our CPUs and by enlisting the aid of GPUs, [Ido Gendel] thought it would be fun to go in the exact opposite direction, supply a clock to the ATtiny85 that cycles only once per day, or at 0.000011574Hz. What application could this have? Well, if he could do it in seven instructions or less, how about turning on an LED at sunset Friday evening, to indicate the start of the Jewish Shabbat (Saturday), and turn it off again at sunset Saturday evening.

Notice the subtlety. A clock that cycles once per day means you can execute at most one instruction per day. Luckily on AVR microcontrollers, the instructions he needed can execute in just one cycle. That of course meant diving down into assembly code. [Ido] wasn’t an assembly wizard, so to find the instructions, he compiled C code and examined the resulting assembly until he found what he needed. One instruction turns on the LED and the instruction immediately following turns it off again, which normally would make it happen too fast for the human eye to register. But the instruction to turn it on runs on Friday evening and the very next instruction, the one that turns it off, doesn’t run until Saturday evening. Do you feel like you’re in a science fiction story watching time slowed down? Freaky. A few NOPs and the jump for the loop take up the remaining five cycles for the week.

For the source of the clock he chose to use an LDR to detect when the light level dropped at the end of the day. The problem he immediately ran into was that clouds, bird shadows, and so on, also cause drops in the light level. The solution he found was to widen the light and dark range by adding a TLV3702 push-pull output comparator and some resistors. [Ido] gives a detailed explanation of the circuit in the video after the break.

Continue reading “Saturday Clock: An 0.000011574Hz ATtiny85 Clock”

Making A Spectrum Analyzer The Wrong Way On An ATtiny85

Everyone’s a critic, but it’s hard to argue with success. And that’s exactly what [agp.cooper] has with his ATtiny85-based spectrum analyzer devices.

The “normal” way to build a spectrum analyzer is to collect a bunch of samples and run a Fast Fourier Transform (FFT) on them all in one shot. As the name implies, the FFT is fast, and the result is the frequency components of the sampled data. [agp.cooper]’s “wrong” way to do it takes the Goertzel algorithm, which is used for detecting the intensity of a particular frequency, and scanning across the frequency range of interest. It’s a lot slower than a single FFT but, importantly for the ATtiny85 that he implements this on, it’s less demanding of the RAM.

Continue reading “Making A Spectrum Analyzer The Wrong Way On An ATtiny85”

DIY I2C Devices With ATtiny85

[Pawel] has a weather station, and its nerve-center is a Raspberry Pi. He wanted to include a light sensor but the problem is, the Pi doesn’t have a built-in ADC to read the voltage off the light-dependent resistor that he (presumably) had in his junk box. You can, of course, buy I2C ADC chips and modules, but when you’ve already got a microcontroller that has ADC peripherals on board, why bother?

[Pawel] wired up a tremendously simple circuit, downloaded some I2C slave-mode code, and added an LED for good measure. It’s all up on GitHub if you’re interested.

cropped_shot_2016-10-21-112958
Bright by Day, Dark by Night!

We’re covering this because we rarely see people coding for I2C slave devices. Everyone and their mom uses I2C to connect to sensors, for which the Arduino “Wire” library or “i2c-tools” on the Pi do just fine. But what do you do when you want to make the I2C device? [Pawel]’s project makes use of TinyWireS, a slave-mode SPI and I2C library for AVR ATtiny Arduino projects.

Here, [Pawel] just wanted a light sensor. But if you’re building your own devices, the sky is the limit. What’s the most esoteric I2C sensor that you can imagine? (And is it really the case that we haven’t seen an I2C slave device hack since 2010?)

Tiny ATtiny85 Game Console

[Ilya Titov] has made a game console. Not just any game console, but an extremely small ATtiny85-based console suitable for putting on a key ring and assembled into a very professional product with PCB and 3D printed case. This is a project that has been on the go since 2014, but the most recent update is a new version designed for tighter and more easy assembly.

All construction is through-hole rather than SMD, and aside from the ATtiny85 the console uses an OLED screen, piezo buzzer, tactile switches and a handful of passive components. Power comes from a single CR2032 coin cell which sits under the screen. Best of all the PCB design is available as a PDF and the 3D printed case can be found on Thingiverse.

There are two games for the console, as well as the Breakout clone whose code is in the 2014 piece linked above he’s written UFO Escape, an obstacle-avoiding side-scroller. You’ll have to burn both game and 8MHz internal clock bootloader to the ATtiny85 yourself. There are no cartridges with this console, though if the processor sits in a DIP socket the game can be changed over simply by swapping processors programmed with the appropriate game.

He’s produced a full assembly video with some UFO Escape gameplay thrown in, shown here below the break.

Continue reading “Tiny ATtiny85 Game Console”

ATtiny85 Does Over The Air NTSC

[CNLohr] has made a habit of using ATtiny microcontrollers for everything, and one of his most popular projects is using an ATTiny85 to generate NTSC video. With a $2 microcontroller and eight pins, [CNLohr] can put text and simple graphics on any TV. He’s back at it again, only this time the microcontroller isn’t plugged into the TV.

The ATtiny in this project is overclocked to 30MHz or so using the on-chip PLL. That, plus a few wires of sufficient length means this chip can generate and broadcast NTSC video.

[CNLohr] mentions that it should be possible to use this board to transmit closed captioning directly to a TV. If you’re looking for the simplest way to display text on a monitor with an AVR, there ‘ya go: a microcontroller and two wires. He’s unable to actually test this, as he lost the remote for his tiny TV from the turn of the millennium. Because there’s no way for [CNLohr] to enable closed captioning on his TV, he can’t build the obvious application for this circuit – a closed caption Twitter bot. That doesn’t mean you can’t.

Video below.

Continue reading “ATtiny85 Does Over The Air NTSC”

A protoboard layout for an ATtiny85 door chime

AES-CMAC On An ATtiny85

[Blancmange] built a custom door chime using an ATtiny85. Unlike most commercial products out there, this one actually tries to be secure, using AES-CMAC for message signing.

The hardware is pretty simple, and a protoboard layout is shown in the image above. It uses the ATtiny85 for control, with an LM380N audio amplifier, and a low cost 315 MHz receiver.

The more impressive part of the build is the firmware. Using AVR assembly, [Blancmange] managed to fit everything into the 8 Kbytes of flash on the ATtiny85. This includes an implementation of AES-CMAC, an AES cypher based message authentication code. The transmitting device signs the request with a key shared between both devices, and the receiver verifies that the message is from a trusted transmitter.

Fortunately, the assembly code is very well commented. If you’ve ever wanted to take a look into some complex ASM assembly, this is a great project to check out. The source code has been released into the public domain, so the rest of us can implement crypto on this cheap microcontroller with much less effort.