Go Down

Topic: Question about arduino communication with smart phone (Read 2899 times) previous topic - next topic

martinb2

Hi ,
I have posted this question on the Networking, Protocols, and Devices forum but there were no answer so maby i have posted this at the wrong section.. so maby can you help me :)
so the thing is that i want to connect my arduino to the internet at home and control the arduino with the smart phone.
BUT! the thing is that i wanna use it when im out side the hose so im gonna use the cellular network
so the question is in which item/module do i need to use to control the arduino with my smart phone when im not home?
i just need to control 5v Relay (Normally open and common) thats it..
one more thing can any one help me with the CODE
Thanks everyone!! :)

pico

First, you need to connect your Arduino to your home LAN in some way. There are a number of ways to do this. Where is the relay that is being controlled in relation to your network? Do you need a wireless connection to your LAN, or can you reach the Arduino with an ethernet cable?

Second, you need to set up port forwarding on your router. This basically means that when outside your LAN, you connect to your public IP address on your router,  connecting on a port that has been configured to connect ("forward") to the LAN IP address and port number of your Arduino. Does that make sense? If not, google "port forwarding" and have a read.

Third, you need to write a program for your Arduino so that a) it can control the relay, and b) it can communicate via the network with an incoming connection (from your smartphone). Probably the most common thing is to set up your Arduino to act as a simple web server, which can report status and take control commands, and connect to it via a web browser on your phone.

So that's the outline. It has been done many times before. The main variations are what hardware you use to connect your Arduino to your LAN, and the specifics of how you write your Arduino program to perform the functions you require.






WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)

martinb2

im gonna use ethernet cable , (maby in the future ill use WIFI module {high costs}) and THANK YOU SO MUCH!!! it was a really helpful information!!
can please some one help me with how i need to write a code that allows me to create a web browser with a 8 functions ON/OFF
Thanks!!!

CatweazleNZ


First, you need to connect your Arduino to your home LAN in some way. There are a number of ways to do this. Where is the relay that is being controlled in relation to your network? Do you need a wireless connection to your LAN, or can you reach the Arduino with an ethernet cable?

Second, you need to set up port forwarding on your router. This basically means that when outside your LAN, you connect to your public IP address on your router,  connecting on a port that has been configured to connect ("forward") to the LAN IP address and port number of your Arduino. Does that make sense? If not, google "port forwarding" and have a read.

Third, you need to write a program for your Arduino so that a) it can control the relay, and b) it can communicate via the network with an incoming connection (from your smartphone). Probably the most common thing is to set up your Arduino to act as a simple web server, which can report status and take control commands, and connect to it via a web browser on your phone.

So that's the outline. It has been done many times before. The main variations are what hardware you use to connect your Arduino to your LAN, and the specifics of how you write your Arduino program to perform the functions you require.


Yep, that is all good. I am implementing a home automation system using Arduino ethernet to publish a simple web site and allowing the various automation functions to be activated by html links on the various web pages.

One of the activities that is implemented on the web site is to fire a relay that opens my garage door. Now when my wife locks herself out of the house she can use her mobile phone to open the garage. Or she can ring me and I will do it from my work place.

If you need some help addressing specific functions you can ask me and I will try to post the relevant code snippets from my application.

Be aware that publishing a web page means that anyone on the WWW can access it. So you will need a display only mode and an operations mode based on some sort of password data entry and (likely) the use of cookies to retain your login mode during an html web broswer session.

Cheers

Catweazle NZ

martinb2

Thanks!!
yes of course the adruino web page have to be protected by a password or something
I need some help with the CODE because i dont really know how to communicate between the Adruino , PC , and the Phone
Im an electrician so the wiring is a piece of cake for me but the code for communicate is little bit a problem for me :\
So thanks again!!! :)

zoomkat

If you want to use the web browser on your smart phone to control things, then having the arduino serve up a control web page is fairly simple. People have previously posted arduino server code that ranges from very simple to super slick and professional. first thing to do is get an Ethernet card and try the web server example code.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

CatweazleNZ


Thanks!!
yes of course the adruino web page have to be protected by a password or something
I need some help with the CODE because i dont really know how to communicate between the Adruino , PC , and the Phone
Im an electrician so the wiring is a piece of cake for me but the code for communicate is little bit a problem for me :\
So thanks again!!! :)

I have published some code related to password control and cookies using arduino web pages over in this thread:

http://forum.arduino.cc//index.php?topic=195685.0

I am a software developer - so if you want to come over to my place and runs wire through my house for the home automation system I am building I might be able to solve your software problems. :)

In reality you can only do simple things with Arduino if you do not have some software development background. The problem with programming is that you need to learn how to implement 1,000 and more common algorithms before you can solve most problems. It is the same as training to be an electrician - there are no short cuts and if an amateur starts playing with mains wiring then they are asking for trouble.

Incidentally my home automation system is over 3600 lines of code and growing.Without a software development background no one is going to get that far into a project. (The code to open/close my garage door using a relay via my mobile phone/any web browser was my starting point but is a small part of the overall thing -  I guess you only need that functionality - times eight.)

Cheers

Catweazle NZ

martinb2

Thanks for the help :) ill would love to come by And run some wires , for me this is simple.. but the programming is really headache..
I have background in plc with the ledder programing like unitronics , siemens, general electric and more..
But the c++ is very difficult for me at least now at the beginning...
Why i haveny used the plc that i mentioned before is because they very expensive.. and can run a probably one big coca-cola factory..
So the adruino can do perfectly with low costs..
So back to my problem i need source code with :
1. Connection to lan + server + little web site (like remote control)
2. The arduino can control 8 relays (5v)

Thanks again , and have a nice day :-)

Arrch


So back to my problem i need source code with :
1. Connection to lan + server + little web site (like remote control)
2. The arduino can control 8 relays (5v)


So you have three options:

1. Find the exact code that fits your needs perfectly. Might take a lot of Googling.
2. Have someone write the code for you. I wouldn't hold your breath unless you're opening your wallet.
2. Find code that demonstrates the concepts of your design and modify it to your liking. Sensible approach.

martinb2

Thanks for the replay , about the 2 option..
How much its gonna cost?


drmpf

#11
Nov 23, 2013, 10:56 pm Last Edit: Nov 23, 2013, 11:12 pm by drmpf Reason: 1
I have written an inexpense the Android mobile app you can use.  www.pfod.com.au
It is very flexible.  Simple text strings in your arduino code control what the mobile displays.
It connnects via wifi/internet  (or bluetooth)  so you can access your arduino ethernet via its ip address.
It includes 128 security so can control things from outside your home via the internet.

Let me know if you need help getting it running.
www.pfod.com.au has a number of example project and there are a number of instructables also for example
http://www.instructables.com/id/How-to-switch-an-Arduino-output-on-and-off-from-yo/
and http://www.instructables.com/id/Arduino-for-Beginners-controlled-by-Android-No-cod/
 
Here is the connection setup screen for wifi with security.


Go Up