Morse Code With Capacitive Touch!
by OnTheBrink in Circuits > Electronics
2593 Views, 14 Favorites, 0 Comments
Morse Code With Capacitive Touch!

Hello! Today, I will show you how to make a capacitive touch morse code machine! Its pretty cool and fun for a basic arduino project. Its fairly easy and the learning about capacitive touch switches is a road that takes you to many places. Enjoy!
Note: Operation
For those of you who don't know how to use a captive touch switch, here are some instructions for operation.
- Turn on your Arduino
- Upload the Code(step 4)
- It should be working, so if you touch the aluminum foil, you should hear a little beep from the speaker.
- Combine the beeps to make awesome morse code messages!
Parts

For this instructable, you will need:
- Arduino Uno(1)
- Arduino IDE
- Breadboard(1)
- piezo speaker/element(1)
- jumper wires(several)
- aluminum foil square(1)
- Resistor(doesn't really matter which one, just sort of low)(1)
- A Great mind!!(2)
Assembly


So the assembly is pretty simple. The awesome sauce file is a fritzing file so it may be easier to look at it than read and follow my instructions. OK, so the circuit assembly instructions go as follows:
- Connect one of the "ground" ports of the UNO to one of the power buses on the breadboard.
- Connect pin Digital pin 12 to one of the wire busses on your breadboard.
- Connect the positive wire of the speaker/piezo buzzer/element to pin 12's wire bus on the breadboard.
- Connect the negative lead of the speaker/piezo buzzer/element to the same power bus that you negatively charged back in step one.
- Now connect digital pin 2 to some wire bus on the breadboard.
- Connect digital pin 4 to a wire bus close to the one you connected digital pin 2 to.
- Bridge the two wires with a resistor, which means place one lead in the same bus as digital pin 2 is in and connect the other lead of the resistor to the same bus that digital pin 4 is in.
- Now connect one lead of one of the jumpers to the same bus that digital pin 2 is in and connect the other lead to a piece of metal foil.
Now you have finished the written instructions I put some pictures to aid in the process because I am not sure how clear the directions. Now comes programming, which is in the next step.
Downloads
Programming

So, programming is pretty simple. You have to access the capacitive touch library ad then use some functions and then blah blah Boom! You have a capacitive touch morse code thingymahoozit! The code is below.
#include
capSensor = CapacitiveSensor(4,2);
int threshold=1000;
const int ledPin=12;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT); }
void loop() {
long sensorValue = capSensor.capacitiveSensor(30);
Serial.println(sensorValue);
if(sensorValue > threshold) {
digitalWrite(ledPin, HIGH); }
else { digitalWrite(ledPin, LOW); }
delay(10); }
The program can be found easily in examples under starter kit and #13. It is meant for an LED, but it works for a speaker too. Now for mods!
Note: The image does not show the code!!!!!
Mods Galore!

This creation is very moddable! You can use a variety of speaker elements and piezo elements. You could add a potentiometer to adjust volume or add LEDs to create a light show. You can modify the code and add certain notes for the speaker to play if you include the note library. You can modify it easily and create a whole range of cool creations. If you build something really cool, post a pic in the comment spot below. Have fun!-DerpyCyclops