Tag Archives: Halloween knock box

Atmel’s tinyAVR is a Maker favorite

Earlier this week, Atmel expanded its low-power 8-bit tinyAVR family with the addition of the ATtiny441 and ATtiny841. According to Atmel’s Director of Flash-based MCUs Ingar Fredriksen, the 8-bit AVR microcontrollers are ideal for cost-effective consumer applications and a wide range of Maker projects.

Indeed, the new ATtiny 441/841 MCUs boast higher system integration with intuitive tools and peripherals to help facilitate optimized performance with lower power consumption. In addition, the ultra-low power 14-pin tinyAVR MCUs deliver enhanced analog and communication capabilities for an overall lower system cost in a smaller package.

As noted above, Atmel’s ATtiny MCU lineup is routinely tapped by both DIY Makers and professional engineers to power a wide range of projects. To be sure, quite a number of devices and platforms built around Atmel’s ATtiny have surfaced on Bits & Pieces in recent months including:

* The PC knock sensor – This project allows users to turn their PCs on and off with a simple knock sensor. The entire platform, costing the Maker a grand total of $10, is built around Atmel’s ATtiny45 MCU which emulates a PS/2 device.

* Halloween knock box – Powered by Atmel’s versatile ATtiny45 (or 85) microcontroller (MCU), the Halloween Knock Box box is fairly easy to put together. Additional key components include a piezo element (amplifier) for the knock sensor and a motor to provide the knocking feedback.

* Twinkling jack-o-lanterns – This project uses very few components: four slightly depleted AA batteries, a super bright LED, 680 ohm resistor and a little custom code set on an 8-pin Atmel ATtiny13.

* ATtiny85 ISP! – The open source ATtiny85 ISP! can probably best be described as a breakout prototyping board for Atmel’s ATtiny85/45/25 lineup. The ATtiny85 ISP! allows Makers to take advantage of the ATtiny85 chip’s potential, while using the familiar Arduino IDE and harnessing support from the Arduino community.

* Cuboino (Digital Cuboro) – This version of Cuboro is a tangible, digital extension of the classic marble puzzle game. Designed by Felix Heibeck of the University of Bremen, Cuboino is powered by Atmel’s versatile ATtiny85 MCU.

* ATtiny logic analyzer – The ATtiny2313-based logic analyzer is capable of capturing at 50+ kHz, more than enough for a PS/2 port. This project combines an Atmel MCU, breadboard and FTDI for unlimited-length logic capturing with a PC.

2D-Lux smart LED disk (SLEDD) – NliteN’s 2D-Lux Smart LED Disk (SLEDD) is a dimmable 60W-incandescent-replacement LED smart “bulb” equipped with an Atmel AVR microcontroller (ATtiny85), USB interface and hardware-expansion pins.

Digital tic-tac-toe – Powered by the ATtiny85, this modern implementation of the classic game boasts an AI mechanism capable of making defending or winning moves against a human opponent.

Long-term LED blinker – ATtiny10 runs an LED blinker for at least 6 months.

Adafruit’Gemma & Trinket – Uber-mini microcontroller boards built around the ATtiny85.

Pressure sensitive floor – This ActiveFloor comprises a total of twenty-one 2′x4′ tiles, each one including 8 pressure-sensitive resistors and an ATtiny84-based platform.

Chiptunes player – A tiny chip tunes player built around Atmel’s Attiny9.

Duo Mini computer – A DIY computer powered by the ATtiny84.

Nixie clock – This slick retro Nixie Clock is equipped with an ATtiny1634 MCU.

As previously discussed on Bits & Pieces, all tinyAVRs are based on the same architecture and compatible with other AVR devices. Features like integrated ADC, EEPROM memory and brownout detectors allow users to design applications without adding external components. The tinyAVR is also equipped with flash memory and on-chip debug for fast, secure, cost-effective in-circuit upgrades.

“The tinyAVR offers an advanced combination of miniaturization, processing power, analog performance and system-level integration. Simply put, the tinyAVR is the most compact device in the AVR family and the only device capable of operating at just 0.7V. And there’s nothing really tiny about that,” an Atmel engineer explained. “Plus, tinyAVR designs can be coupled with Atmel’s CryptoAuthentication tech for an extra level of security. The AVR CPU gives the tinyAVR devices the same high performance as our larger AVR devices. Flexible and versatile, they feature high code efficiency that lets them fit a broad range of applications.”

As expected, tinyAVR offers a high level of integration, with each pin boasting multiple uses as I/O, ADC and PWM. To be sure, even the reset pin can be reconfigured as an I/O pin. Oh, and yes, the tinyAVR also features a Universal Serial Interface (USI) which can be used as SPI, UART or TWI.

On the power side, where most microcontrollers require 1.8V or more to operate, the tinyAVR boosts the voltage from a single AA or AAA battery into a stable 3V supply to power an entire application. So if you do use tinyAVR tech in your next maker, hacked, modded or industrial project, be sure to check out our recently launched AVR Hero Contest! In the meantime, additional information about Atmel’s extensive tinyAVR lineup can be be found here.

Activating a PC with a knock and an ATtiny

A Maker by the name of Joonas has designed a knock sensor to activate his PC. According to the HackADay crew, the entire project cost Joonas a grand total of $10 and is built around Atmel’s ATtiny45 MCU which is tasked with emulating a PS/2 device.


“This takes advantage of his computer’s ability to boot upon receiving PS/2 input,” HackADay’s John Marsh explained. “The build uses a Piezo buzzer and a 1M Ohm resistor as a knock sensor exactly as the official Arduino tutorial demonstrates, [plus] one of those PS/2-to-USB adapters that are most likely lurking in the back corner of every drawer in your office.”

In addition, says Marsh, AVRweb was used to disable the 8X clock divider so there would be sufficient clock cycles for PS/2 communication. Joonas subsequently loaded some test code (final version posted to Github) to ensure the vibrations were being detected correctly.

Readers of Bits & Pieces may also want to check out a recent article about a Halloween Knock Box powered by Atmel’s versatile ATtiny45 (or 85) microcontroller (MCU).

The box is fairly easy to put together, as basic components include an MCU, a piezo element (amplifier) for the knock sensor and a motor to provide the knocking feedback.

Building a Halloween knock box with an Atmel MCU

A Maker by the name of Kyle has constructed a “Halloween knock box” powered by Atmel’s versatile ATtiny45 (or 85) microcontroller. According to Kyle, the box is fairly easy to put together, as basic components include an MCU, a piezo element (amplifier) for the knock sensor and a motor to provide the knocking feedback.

“The motor I originally tried was a cheap 6v [unit] for $2 or $3. Unfortunately, it didn’t have enough torque to move the weighted end and it had several ‘dead’ spots where it wouldn’t engage,” Kyle explained in a recent blog post. “I had even taken careful measurements of the motor’s dimensions and transferred them to Sketch-Up where I created a motor mount and later printed it in ABS. In the end, I rummaged through my junk boxes and found a motor that seemed small enough to fit.”

To make the knocking sound, Kyle took a small section of 12 gauge wire (about 1.5″) and made two loops – one for the knocking end and the other to mount to the motor.

“I used a hammer to tap the loop end of the wire over the motor shaft and used some super strong double stick tape to adhere the motor to the box. I had problems with the motor not returning fast enough and the knocking sound being too quiet,” he continued. “To fix this I put a weight (in this case a bolt) on the end. This gave it more than enough momentum to move the box and allows the motor to return fast. To get rid of that annoying clunk sound when it returns to the resting position, I glued some foam to the back of the weight.”

As noted above, electronic components for the Atmel powered Halloween knock box include a driver for the motor (simple 2n2222 transistor with a protection diode) and an amplifier for the piezo element, the latter of which allows the circuit to detect quieter knocks.

“The amplifier consists of a NTE490 MOSFET which was measured to have a threshold voltage of 1.7v,” said Kyle. “[Meanwhile], the gate is biased at just under 1.7v by a series of 7 diodes and a 11MΩ current limiting resistor. The current is so small that the diodes don’t fully conduct and as such, only drop about 230mV each.”

Once Kyle was satisfied with the operation of the circuit, he drew up a quick board in DipTrace and laid out the board in just under 1.5″x1.0″, allowing it to neatly fit on the smaller side of the box. The board was subsequently etched and populated, with Kyle continuing to test the microcontroller on the breadboard.

“On the software side of things, the microcontroller sleeps while waiting for a knock to trigger an interrupt. Once triggered, TIMER1 begins counting. When the next knock occurs, the current TIMER1 value is recorded in an array and TIMER1 cleared for the next knock. This repeats until either TIMER1 overflows or the array is filled,” he added. “If the overflow event occurs, then the knock timed out and it begins repeating the pattern back with the motor. A special event occurs when either 13 or 20 knocks are registered. When the first occurs, the box plays the Addam’s Family theme song. When the latter occurs, then the box waits for 15 seconds, then randomly begins knocking at the box for 30 second.”

Interested in learning more about building an Atmel powered Halloween knock box? You can check out a detailed breakdown of Kyle’s project here.