spooky arduino projects 4 and musical arduino

  
Inside:
Repository
The notes for the fourth and final class are up on the Spooky Arduino class page. At the end of the class, Mark of Machine Project bestowed upon each of the students a merit badge. It was great. Click above for a larger view of the badge. Here`s a quick project using techniques from this week`s class that turns an Arduino board and a few buttons a
spooky arduino projects 4 and musical arduino - schematic

nd piezos into a MIDI drum kit or scary sound trigger. Hide piezo sensors around the house during your Halloween party to trigger scary sounds when people walk around! For the piezo input, the 1M resistor is to bleed off the voltage generated by the piezo when it is struck. The 5. 1v zener diode is there to insure any large voltages don`t make it into the Arduino and blow it out. The code has a few tricks that may not be immediately obvious. First is that to implement a MIDI interface, all you really need is the ability to send serial data at 31, 250 bps. This is easily done with Serial. begin(31250). Once that is done, a complete three-byte MIDI note-on message can be sent with three Serial. print(val, BYTE)  commands. The next tricky bit is that the switches in the above schematic don`t need pull-up resistors. This is because the internal pull-ups in Arduino`s AVR chip are turned on with a digitalWrite(pin, HIGH). This may seem counter-intuitive, doing a digitalWrite() on an input pin, but it`s how the AVR works. The benefit is that you no longer need a resistor to +5V and the effort to wire up each additional button is much lower. By measuring the time it takes for that first big jolt to cross a threshold, you can get an idea as how big the force was. In the code this is represented by reading the analog value and if it`s over the threshold, wait until it drops down again, counting all the while. When I`ve done this...



Leave Comment

characters left:

New Circuits

.