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.
“Download and place in your Arduino’s Library folder and restart the IDE before continuing. Test using this code; open up the serial monitor and make sure the speed is set to 115200 baud,” he explained on a recent MakeUseOf blog post.
“With any luck, you should see some distance measurements being send back to you at a pretty high speed. You may find a variance of 1 or 2 centimeters, but this is fine. Try running your hand in front of the sensor, moving it up and down to observe the changing readings.”
According to Bruce, the code should be fairly simple to understand.
“There are a few declaration of relevant pins at the start, including a maximum distance – this may vary according to the exact sensor you have, but as long as you’re able to get less than 1 meter readings accurately, you should be fine,” he added.
Interested in learning more about the simple alarm system described below? You can find detailed instructions on MakeUseOf here.