0

I want to control my Adruino through Internet without Ethernet or wifi shield. So what are the ways I can do?

0

Guess you need to use a pc, and a program to receive commands and send them along to the arduino by serial.

  • So can you tell me how to do that..... – user18794 Mar 19 '16 at 9:20
  • You need a backend that will listen for incoming commands. You can start with Django or Ruby on Rails or some microframework. The backend residing on PC should forward commands to Arduino board. – IOB Toolkit Team Mar 19 '16 at 10:55
0

You need access to the Internet. Since you dont want to use an Ethernet or WiFi shield/module, then, for the most part, you are left with:

  • Using a GSM module with the Arduino to receive data over the Internet
  • Using a PC as a web server to receive data over the internet and forward it to the Arduino over a wired connection (UART) or a wireless connection (e.g. bluetooth)

The most direct would be the second method over UART. So it could be seen like this: Client/Sending PC -> Over the Internet -> Server/Receiving PC -> Over UART -> Arduino. So you are now faced with 3 main interfaces: Internet->PC for the server and client as well as the PC->Arduino interface on the server/receiver side.

To handle the Internet -> PC interface for the client, the client PC would need to run a program that will connect to the server PC over the Internet (using the server's public IP) and send the Arduino control data. Similarly, the Internet-PC interface for the server PC would require a constantly-running server program that will listen for incoming connections from the client PC and receive the data being sent. Assuming you know Python, with Python you can have both programs up and running within minutes. This site should help with the programs.

Note that port forwarding will need to be implemented on the router on the server side so that packets from outside its local network can get to it, given that its behind a router. This software can help with setting port forwarding rules.

The PC->Arduino interface will require the pyserial package (if you're still using Python). Pyserial can be used to forward the control data received over the internet, to the Arduino over Serial UART. This site should help with using Pyserial for Python 3. Search for other tutorials.

Finally, the Arduino itself must regularly check the Serial buffer for any received characters from the PC. It must then act on the received data, depending on rules you should have established. A simple example would be: 'a' = Write HIGH to pin 13. This means if ASCII char 'a' were received over Serial, the Arduino would interpret this to mean a command to digitalWrite(13, HIGH). You can make use of the built-in serialEvent() to regularly poll the serial buffer. A simple sketch to illustrate this:

void setup(){
  pinMode(13, OUTPUT);
  Serial.begin(9600);
}

void loop(){}

void serialEvent(){
  if (Serial.read() == 'a') 
    digitalwrite(13, HIGH);
  else  //any other character turns off the LED
    digitalWrite(13, LOW);
}

This is, by no means, the only way to do this, only very straightforward IMO. For example, you could also upload your control data to some cheap server and have your PC regularly poll that server for any new commands. Of course, this would be greatly simplified if you decided to use a WiFi module, like the cheap ESP-01, directly with the Arduino.

  • I heard that through Processing IDE we can connect with adruino. How how it is possible? – user18794 Mar 20 '16 at 11:44
  • @user18794 yeah, i forgot that...you could use Processing to receive data over the web and then send this control data to the Arduino over UART. Check here (processing.org/reference/libraries/net) for more details on using Processing for the web. – TisteAndii Mar 20 '16 at 14:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.