Android phone controls Arduino over wifi

We recently did a little demo to send data to an Arduino with a TCP/IP Shield (using ATC-1000M) from an Android device via Wifi.
The Android phone in this demo uses Android Scripting Environment (ASE). It is available on Android Market for free.
Videos and source code after the break.
Here is a short video demonstration of blinking the Arduino LED using Android.
// By 7
// Version 00.08.01
#include <SoftwareSerial.h>
#define rxPin 0
#define txPin 1
#define ledPin 13
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
void setup()
{
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
mySerial.begin(9600);
}
void loop()
{
char c = mySerial.read();
if(c=='A')
digitalWrite(ledPin, HIGH);
if(c=='B')
digitalWrite(ledPin, LOW);
}
Arduino Simple Source Code
'''
This is used to send a
character to the Arduino
via Wifi
By 7
'''
import android, socket
droid = android.Android()
STR_SEND_A='positive'
STR_SEND_B='negative'
STR_EXIT='neutral'
def test_alert_dialog_with_buttons():
title = 'Alert'
message = ('What do yo want to Send?')
droid.dialogCreateAlert(title, message)
droid.dialogSetPositiveButtonText('A')
droid.dialogSetNegativeButtonText('B')
droid.dialogSetNeutralButtonText('Exit')
droid.dialogShow()
response = droid.dialogGetResponse().result
return response['which']
#Change this depending on the IP and Port of the ATC-1000M
HOST='192.168.7.3'
PORT=23
boolExit=False
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
try:
s.connect((HOST,PORT))
while(boolExit==False):
res=test_alert_dialog_with_buttons()
if(res==STR_SEND_A):
s.send('A')
if(res==STR_SEND_B):
s.send('B')
if(res==STR_EXIT):
boolExit=True
finally:
s.close()
print 'Done! Thank You!'
Python for Android Source Code
This entry was posted in Android, Arduino and tagged ACT-1000M, WiFi.

Comments
Would have been impressive if the WIFI hardware was connected to and controlled by the microcontroller.
^^ actually, that would be next (hopefully)
seven! seven! seven!
I have one question, why did you use a software serial instead of the hardware UART which is available for pin 0 and 1?
Can you sell for me Android sourcecode “Android phone controls Arduino over wifi “.
Thanks.
Link died.
Can you upload again or sell for me android code wifi.
Thanks a lots.
the link is deleted but the code is still posted above.
Nice! Have you seen anything like this using the iPhone?
i like your idea much.. dear plz can you send me android code for this project. asaleemj@gmail.com is my id i will be so much thankfull you..:)
Hi.
Can you send me too your android code on e-mail: uso567@list.ru.
Cheers,
Ufo
Can you please send me the source code. I would appreciate that. My email is mirza.ramicic@hotmail.com . Thank you in advance!
this is what i was looking for..i want to do an application with 4 bottons that controls 2 dc motors connected to an arduino mega via wifi..can u send me the android source code please. Mrad.13@hotmail.com
thank u in advance :)
Good day!
Can you also share with the android source code. dude_jhun15@yahoo.com
Thanks a lot…
how to transfer data from arduino to android?
can u email to me the android source code.. im really appreciated your helps.. im developing arduino project now.. tq
Can you send me too your android code on e-mail:avionica1@yahoo.com.mx
Thanks a lot.