Anyone who slings code for a living knows the feeling all too well: your code is running fine and dandy one minute, and the next minute is throwing exceptions. You’d swear on a stack of O’Reilly books that you didn’t change anything, but your program stubbornly refuses to agree. Stumped, you turn to the only one who understands you and pour your heart out to a little yellow rubber duck.
When it comes to debugging tools, this digital replacement for the duck on your desk might be even more helpful. Rubber duck decoding, where actually explaining aloud to an inanimate object how you think the code should run, really works. It’s basically a way to get you to see the mistake you made by explaining it to yourself; the duck or whatever – personally, I use a stuffed pig– is just along for the ride. [platisd] took the idea a step further and made his debugging buddy, which he dubs the “Dialectic Ball,” in the form of a Magic 8-Ball fortune teller. A 3D-printed shell has an ATtiny84, an accelerometer, and an LCD screen. To use it, you state your problem, shake it, and read the random suggestion that pops up. The list has some obvious suggestions, like adding diagnostic print statements or refactoring. Some tips are more personal, like talking to your local guru or getting a cup of coffee to get things going again. The list can be customized for your way of thinking. If nothing else, it’ll be a conversation piece on your desk.
If you’re more interested in prognostication than debugging, we have no shortage of Magic 8-Ball builds to choose from. Here’s one in a heart, one that fits in a business card, and even one that drops F-bombs.
Continue reading “Rubber Duck Debugging the Digital Way”
Here’s a Big Mouth Billy Bass with extra lip thanks to Alexa. If you’re not already familiar, Big Mouth Billy Bass is the shockingly popular singing animatronic fish designed to look like a trophy fish mounted to hang on your wall. In its stock condition, Billy uses a motion sensor to break into song whenever someone walks by. It’s limited to a few songs, unless you like to hack things — in which case it’s a bunch of usable parts wrapped in a humorous fish! Hackaday’s own [Bob Baddeley] combined the fish with an Amazon Echo Dot, connecting the two with an ATtiny84, and having Billy speak for Alexa.
[Bob] had a few problems to solve, including making Billy’s mouth move when there was audio playing, detecting when the Echo was on, moving the motors and playing the audio. After a bit of research and a lot of tweaking, a Fast Fourier Transform algorithm designed for the ATtiny was used was used to get the mouth moving. The mouth didn’t move a lot because of the design of the fish, and [Bob] modified it a bit, but there was only so much he could do.
It’s all well and good for the fish to lie there and sing, but [Bob] wanted Billy to move when Alexa was listening, and in order the detect this, the best bet was to watch for the Dot’s light to turn on. He tried a couple of things but decided that the simplest method was probably the best and ended up just taping a photo-resistor over the LED. Now Billy turns to look at you when you ask Alexa a question.
With a few modifications to the Dot’s enclosure, everything now fits inside the original mounting plaque and, after some holes were drilled so the Dot could hear, working. Billy has gone from just a few songs to an enormous entire library of songs to sing!
We’ve seen Alexa combined with Big Mouth Billy Bass before, but just demos and never an excellent guide like [Bob’s]. The nice thing about this guide is that once you’ve hacked the hardware, it’s a breeze to add new functionality using Alexa skills.
Continue reading “Big Mouth Billy Bass Channels Miley Cyrus”
[Newbrain] had a small problem. He’d turn off the TV, but would leave the sound system turned on. Admittedly, not a big problem, but an annoyance, none the less. He realized the TV had a USB port that went off when it did, so he decided to build something that would sense when the USB port died and fake a button press into the amplifier.
He posted a few ideas online and, honestly, the discussion was at least as interesting as the final project. The common thread was to use an optoisolator to sense the 5 V from the USB port. After that, everyone considered a variety of ICs and discretes and even did some Spice modeling.
In the end, though, [Newbrain] took the easy way out. An ATtiny 84 is probably overkill, but it easy enough to press into service. With only three other components, he built the whole thing into a narrow 24-pin socket and taped it to the back of the audio unit’s wired remote control.
Continue reading “A Real Turn Off”
You don’t need an Arduino for everything! Or do you? This is an argument that plays out here quite often. Whatever the outcome, most folks agree that once you’ve dipped your feet in the shallow end of the pool, the real fun is when you dive into the deep end.
[Mahesh Venkitachalam] designed tinyDriver, an experimental Open Source breakout board for the Atmel ATtiny84 chip. His idea was to create a convenient platform which can be used to understand microcontrollers in-depth, by letting users dive under the hood and make use of the various features of the chip such as timers, PWM, interrupts, ADC, and digital I/O. The ATtiny84 is cheap and simple enough for starters. Add a low-cost AVR programmer, install the free and cross-platform avr-gcc and avrdude tool chain, read up the data sheet, learn some C programming and start experimenting. Rinse and repeat and you’ll be a pro at it soon. He’s got a few starter projects documented on his website to get you going.
The hardware is open source, and the Git repository contains the hardware source and example code. If you’re a hardware noob, he’s thoughtfully added a PTC resettable fuse and reverse polarity protection on the board to make sure you don’t release the magic blue smoke prematurely. All of the I/O’s are broken out on a header, and the motor driver and RGB LED can be disabled when not needed. The board isn’t hand-assembly friendly, but he plans to crowd fund it shortly. If you want to move beyond the Arduino platform, projects like the tinyDriver are the way to go.
A faulty wire, a discarded burning cigarette, or a left-on curling iron can trigger sparks of fire to engulf everything nearby until all that’s left is brittle mounds of smoldering ash. Which is why smoke detectors are so important. They are life saving devices that can wake people up sleeping inside, well before the silent, but deadly carbon monoxide starts to kick in. But what happens if no one is home, and the alarm begins to blare? The place burns down into the ground without the owners knowing.
So when [Martin] purchased a battery-powered smoke detector and rigged it up to notify him exactly when the piezo siren is activated, the evolution of the automatic fire alarm continued into the realm of wireless internet-connected things.
His home automation system (a Raspberry Pi running Node-Red) links to a Funky ATTiny84-based sensor and transmits the data wirelessly, redirecting the information to his phone. SMS messages can be sent, as well as emails and pushbullet notifications. Once the piezo siren starts to sing, the system alerts him that smoke has been detected and that he should check on it as soon as possible.
The electronics fit perfectly inside the case waiting for any smoky disturbance in the room to light up. And what makes this project even better, besides the life saving capabilities and the instant push notifications, is that it was hooked up for the cheap. No need to buy a brand-new, expensive Nest protect, when all it takes it a sensor or two and a Raspberry Pi to hack the fire alarm that already sits in the house.
This video coming up after the break shows how simple it is to make. Continue reading “A Cheap DIY Smoke Detector that Can Save Lives”
Here’s an excuse to eat a bunch of Tic Tac candies: once the container is empty it makes a nice little enclosure for your next project. This particular offering introduces a point-to-point clock project that’s a ton of fun.
[Danny Chouinard] did a lot with very little. You can get the gist of the circuit just by looking at the photos above. it uses a 3×5 Charlieplexed LED display (this is given away by the fact that there’s only a few resistors on the board. A bit difficult to see, but between the resistors and the ATtiny84 there is a clock crystal, and on the back is a little piezo buzzer. The one thing that isn’t completely obvious is the power source. Two AAAA batteries, salvaged from a 9V battery, are able to keep the unit running at an estimated 2 years of moderate use.
The video after the break is worth a look though. It shows the various characters and information that can be flashed on the LED matrix. At first it’s hard to tell that the single user input button is being pressed by [Danny’s] thumb.
If you don’t want to build a clock, there are still plenty of reasons to eat a whole container of these mints. You could replace them with a PIC programmer or a discreet camera.
Continue reading “Tic Tac Clock”
We feature a lot of clock builds on HaD, and the reason is that they are cool. Even simple ones are cool. Not everyone can say they built a clock. [Chris] took a ride on the DIY Clock train and came up with this LED-based clock that is controlled by an ATtiny84 chip.
The clock has 24 LEDs total, 1 for each hour and 1 for every 5 minute increment. The 24 LEDs are arranged in 2 concentric rings. To display the hour, both LEDs at the same angle are lit up. To show the minutes, just the inner LED is lit. The main image above shows 6:40.
If you are familiar with the ATtiny84 you know that it only has 12 in/out pins, which is significantly less than the amount of LEDs that need controlling. [Chris] decided to use some 74HC595 shift registers to increase the IO pins on the ATtiny. The entire build is installed on a protoboard with quite a bit of point-to-point wiring. A simple tinted plastic case finishes the project and gives it a modern look.
[Chris] made the code for his clock available in case any readers are interested in making one.