Introduction: Transmitting Data From Android to Arduino Through Audio Jack
With this project you can send bytes from android to arduino using only an audio jack connector.
How it works?
Basicly ,android sends a "morse" audio signal to arduino.Arduino in the other hand decode the morse code to a byte.That simple.
Parts you need:
1 Arduino uno R3
1 phone with android os
1 old earplugs (without mic is better because its easy to find the wire for gnd )
some wires (better if you use a breadboard with some jumpers)
Step 1: Hook Up Schematic
You need to connect analog pin A1 to gnd with a resistor.(pulldown).Cut the earplugs so you have only the audio jack with 10 cm wires.After you find the gnd wire of audio jack ,connect it with arduino gnd.The other wire of audio jack connect it with analog pin A1.The electronic part of the project is finished
Now lets go to the software part.
Step 2: Setting Up and Running
First, download and install the small apk i made .(the apk is not signed so you need to enable Unknown sources in settings)..
Second upload the arduino sketch(android.ino) to your arduino.
Open the android application (adr).Now connect the audio jack to android.Increase the phone volume to maximum.
Press the reset button on arduino(do this step every time audio jack is reconnected or every time you reopen the apk)
Now to check that everything is ok, touch the green screen on android" Push to send 125". If arduinos led on pin 13 turn on, than everything is good to go.
You can send numbers from 1 to 256 to arduino.The number 125 is for the led but you can change that in arduino.ino
For sending other numbers just write the number on the textbox and click on update.You will see that the green screen changed.Now click on the green screen to send it.
Connect arduino with pc and open Serial monitor .The numbers you send will appear on screen.
Step 3: Applications and Other Projects
You can send 256 numbers to arduino, which mean 256 instruction(every number can be assigned to a specified instruction).In simple words , you can controll electronic stuff with an android phone.
But this project has a lot of other application.
It doesnt matter where the sound comes from in the audio jack, if the signal is the same arduino will recognise it.For example: If you remove audio jack and push the green screen , you will hear a noise signal.If you record that signal in your pc , phone or other devices, and you play it to arduino audio jack, arduino will still decode that signal.
What does that mean?
Well ,one exaple: imagine two phones , one is the sending part with the audio to play(phone A), and the other is connected to arduino with the audio jack(phone B).Phone A calls phone B.Now phone A is speaking with phone B.Everything in the microphone of phone A goes to phone B audio jack, which goes to arduino.Now you can send commands to arduino through phone communication.
For the source code of apk:
Download adr.rar, unzip and open it in Android Studio
I hope this helps you in your future projects :)