The language C++ is big. There is no doubting that. One reason C++ is big is to allow flexibility in the technique used to solve a problem. If you have a really small system you can stick to procedural code encapsulated by classes. A project with a number of similar but slightly different entities might be best addressed through inheritance and polymorphism.
A third technique is using generics, which are implemented in C++ using templates. Templates have some similarities with #define macros but they are a great deal safer. The compiler does not see the code inserted by a macro until after it has been inserted into the source. If the code is bad the error messages can be very confusing since all the developer sees is the macro name. A template is checked for basic syntax errors by the compiler when it is first seen, and again later when the code is instantiated. That first step eliminates a lot of confusion since error messages appear at the location of the problem.
Continue reading “Code Craft – Embedding C++: Templates”
When [Doug] moved into his new house, he found an old alarm panel set up — but it had no monitoring service any more. Not wanting to pay a monthly fee to have it setup, he decided to try interfacing an Arduino with the system in order to push events to the net!
The cool thing is he was actually inspired by another similar project we shared on Hackaday a few years ago entitled Bending a Home Security Control Panel to Your Will. But that project only showed you how to interface the Arduino with the keypad — [Doug] went the extra mile and interfaced directly with the control board for more features.
He’s using an Arduino Uno and an Ethernet breakout board to hook it up to the network. This allows him to send text messages to himself when the alarm system is armed, disarmed, or triggered. All the code is available on GitHub in case you also have a DSC 1550 alarm system.
It’s a pretty slick hack, so don’t forget to check out the video after the break.
Continue reading “Upgrading Your Alarm System With an Arduino”
Here’s another example of how today’s rapid-prototyping technologies are allowing Artists and Craftsmen to create interactive works of art rapidly and easily. [Kati Hyypa] and [Niklas Roy] teamed up to transform a classic painting in to an interactive exhibit. It’s a painting of Adam, Eve and the apple with a joystick attached. Spectators can control the destiny of the apple with the joystick and thus explore the painting.
The “Forbidden Fruit Machine” is based on a painting called “The Fall of Man” created by [Cornelis Cornelisz van Haarlem] in 1592. The painting depicts Eve and Adam in the Garden of Eden, being tempted by the serpent to eat the forbidden fruit. A public domain, high-resolution scan of the painting is available for download from the Rijksmuseum Amsterdam. Starting with that, the arms were edited out, and replaced with articulated versions (mounted on acrylic) driven by servos. The apple was mounted on a X-Y gantry driven by two stepper motors. These are driven by a motor shield, which is controlled by an Arduino Uno. The Uno also controls a Music Maker shield to play the various audio tracks and sound effects. Finally, an additional Arduino Pro-Mini is used to control the LED lighting effects via a Darlington driver and also connect to the end stops for the X-Y gantry. The joystick is connected to the analog ports of the Uno.
The LED’s give clues on where to move the apple using the joystick, and pressing the red button plays an appropriate audio or sound effect. For example, pressing the button over the cat at Eve and Adam’s feet elicits a heart-breaking meow, while letting Eve eat the apple results in an even more dramatic effect including a thunder storm.
The machine is open source with code posted on Github and 3d files on Youmagine. Watch a video after the break. The artist’s names may be familiar to some some readers – that’s because both have had their earlier work featured on our blog, for example this awesome ball sucking machine and another one too.
Continue reading “Forbidden Fruit Machine”
[James] sent us a video of his latest creation: a robotic glockenspiel that’s currently set up to play “Popcorn”. It uses eight servos to drive mallets that strike the tone bars with fast, crisp movements. The servos are driven with a 16-channel I²C servo driver and MIDI shield, which are in turn controlled with an Arduino Uno. The previous incarnation of his autoglockenspiel employed solenoids, dowels, and elastic bands.
[Gershon Kingsley]’s 1969 composition for synthesizer “Popcorn” has been covered by many artists over the years, though perhaps the most popular cut was [Hot Butter]’s 1972 release. Check it out after the break, and dig that lovely cable management. We’d love to see [James]’s autoglockenspiel play “Flight of the Bumblebee” next.
If you’re hungry for more electro-acoustic creations, have a gander at [Aaron Sherwood]’s Magnetophone.
Continue reading “Robotic Glockenspiel Crunches “Popcorn””
We have a pretty good guess where [Krizbleen] hides away any seasonal presents for his family: behind his shiny new secret library door. An experienced woodworker, [Krizbleen] was in the process of finishing the attic in his home when he decided to take advantage of the chimney’s otherwise annoying placement in front of his soon-to-be office. He built a false wall in front of the central chimney obstacle and placed a TV in the middle of the wall (directly in front of the chimney) flanked on either side by a bookcase.
If you touch the secret book or knock out the secret sequence, however, the right-side bookcase slides gently out of the way to reveal [Krizbleen’s] home office. Behind the scenes, a heavy duty linear actuator pushes or pulls the door as necessary, onto which [Krizbleen] expertly mounted the bookcase with some 2″ caster wheels. The actuator expects +24V or -24V to send it moving in one of its two directions, so the Arduino Uno needed a couple of relays to handle the voltage difference.
The effort spent here was immense, but the result is seamless. After borrowing a knock-detection script and hooking up a secondary access button concealed in a book, [Krizbleen] had the secret door he’d always wanted: albeit maybe a bit slow to open and close. You can see a video of its operation below.
Continue reading “Secret Attic Library Door”
Will you be handing out candy on Halloween? Maybe you have a party to attend or kids to take around the neighborhood and can’t be home to answer the bell. You don’t want to be The Dark House With No Candy, ’cause that’s a good way to get TP’d. We’re not exactly sure what [Ben]’s catalyst was aside from trying to avoid tempting would-be thieves with an unattended bowl on the porch. Whatever the reason, we’re happy to present Candy or Death, his gamified candy (or death)-dispensing machine.
Okay, so it only dispenses candy for now. [Ben] hasn’t quite worked the kinks out of his death ray. He designed it to sit behind a porch-facing window so it can’t be messed with. All trick-or-treaters can do is push the button and take the candy. It’s built around a cereal dispenser that’s modified to be cranked by a piece of round rod driven with a NEMA-17 stepper motor and an Arduino Uno with a motor shield. The candy slides down a length of aluminium rain gutter into a plastic stacking bin, and the whole thing is built into a nice wood frame.
A few adjustments were necessary to keep it from jamming. The dispenser’s hopper uses rubber blades to govern the flow, and he ended up removing a few and trimming the others. [Ben] has an album up of all his build pics and put his code on the gits. Stick around to see videos of the machine from the front and rear.
Continue reading “Push Button, Receive Candy (or Death)”
[A Raymond] had some free time at work, and decided to spend it on creating a wireless warning sign. According to his blog profile, he is a PhD student in Applied Physics. His lab utilizes a high-powered laser system. His job is to use said system, but only after it’s brought online by faculty scientists. The status of the laser system is changed by a manual switchbox that controls the warning signs wired around the lab entrances. Unfortunately, if you were in the upstairs office, you only knew this after running downstairs to check. [A Raymond’s] admitted laziness finally got the better of him – he wanted a sign that displayed the laser’s status from the comfort of the office. He had an old sign he could use, but he wanted a way for it to communicate with the switchbox downstairs. After some thought, he decided Bluetooth was the way to go, using a pair of BlueSMiRF Bluetooth modules from Sparkfun and Arduino Uno R3’s.
He constructed a metal box that intercepted the cable from the main switchbox, mounting one BlueSMiRF and Uno into it. Upon learning that the switchbox sends 12V AC signals over three individual status wires, he half-wave rectified the wires and divided their voltages so that the Uno wouldn’t fry. Instead, it determined which status wire that had active voltage. and sent a “g(reen)”, “y(ellow)”, or “r(ed)” signal continuously via Bluetooth. On the receiving end, [A Raymond] gutted the sign and mounted the other BlueSMiRF and Uno into it along with some green, yellow, and red LEDs. The LEDs light up in response to the corresponding Bluetooth signal.
The result is a warning sign that is always up-to-date with the switchbox’s status. We’ve covered projects using Bluetooth before, from plush birds to cameras– [A Raymond’s] wireless sign is in good company. He notes that it’s “missing” a high pitched whining noise when the “Danger” lights are on. If he decides to add an accompanying (annoying) sound, he couldn’t go wrong with something like this. Regardless, we’re sure [A Raymond] is happy that he no longer has to go back and forth between floors before he can use the laser.