Pages: [1]   Go Down
Author Topic: The opposite approach to over internet control of arduino  (Read 932 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please forgive me if this is a arduino networking noob question but I can't find an answer. I have a couple years experience with simple arduino projects but this is my first networking one. I find all kinds of examples of people controlling an arduino by hosting a website on the device itself, my question is can I host the site elsewhere and have the arduino monitor a mySQL database (or something similar) for changes. Why would I want to do this?.. I'm a web designer for a company that hosts its own sites. We have 5 static IPs. At home (where the arduino is) I don't have a static IP and I'd prefer not to use a service to mimic one. Thanks Guys.
Logged

Poole, Dorset, UK
Offline Offline
Edison Member
*
Karma: 52
Posts: 2318
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, and it's a far better way of doing things than putting "server" on an Arduino.

Basically What you need is an application on your PC/real server which will talk to the Arduino over the coms port/Ethernet/WiFi or what ever. I can't see why you would want an Arduino to Monitor an R-DB.

Mark
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I didn't know there was a way to send information to the arduino without it having a static IP. The idea was a website with a simple interface that would change the values of a database then whenever the arduino queried the DB it would turn on a light or adjust the thermostat. (Yes this is another home automation project) If I can send an arduino a command directly that's perfect. How would I do that. If it changes your answer, I am talking about an arduino with an Ethernet shield connected to a router not an arduino connected to a computer.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I found the answer... I've been looking for four days and finally found something I can build off of. Thank you for your guidance it helped me find my answer. Anyone else looking for the method for the same approach I found it here... http://bildr.org/2011/06/arduino-ethernet-client/
Logged

Poole, Dorset, UK
Offline Offline
Edison Member
*
Karma: 52
Posts: 2318
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've never configured ethernet, so I'd look at having the Arduino make the connection to the static IP on startup. And having an app on a free port on the server.

Mark
Logged

UK
Offline Offline
God Member
*****
Karma: 17
Posts: 568
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Use a normal web page to post data into your database.

Create a web service that exposes the data you want, in response to a specific GET request.

Have your Arduino running as a web client and periodically poll the web service. If there is data for the Arduino then it can parse the web service response and act on the data.

Decide on your polling interval based on how fast you need the Arduino to act to new commands posted into your database.

Once the Arduino has carried out the command you can even have it post back, again via a web service, into your database to confirm receipt and action to close the communication loop.

All nice and simple stuff for any web developer. :-)
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

can I ... have the arduino monitor a mySQL database (or something similar) for changes.

And do what with them?

The Arduino can be a client just as easily as a server, although it's not obvious so far whether that's a sensible solution to your problem because you haven't explained what the problem is.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sure PerterH,
"Do what with them?" This is a home automation project so trip relays for the most part.

The Problem: I don't have a static IP to serve a website from the arduino at home nor do I want to use a service to simulate having a static IP. I do have Static IPs at work I can use. So, I wanted to know how to use it as a client to access a DB instead of serving a website from it.

I'm going to do exactly as tack said.
Logged

0
Offline Offline
Edison Member
*
Karma: 8
Posts: 1249
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Im new to all this Arduino network/ethernet stuff as well..

but wouldnt the Arduino need an Ethernet shield then?  in any fashion?  to be able to 'connect' to this web service/site that is remotely hosted?


On the opposite side.. (and Windows based only)  which is a bit different than your scenario as you have/want your web servers t be in another location form the Arduino..

but I have installed WAMP server locally on a PC.....
created a FLASH based GUI/interface that allows me to send RGB values to a PHP script.. that in turn dumps the data to a com port that Arduino is listening to....

works great normally anywhere inside the LAN.. if I wanted to open it up the public.. I only need ot log-into my router...and forward any HTTP traffic to the machine with the WAMP (web) server running control the Arduino from the 'net'..
Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

xl97,
I am using an ethernet shield. I just didn't want to host the site on the arduino.
Logged

Poole, Dorset, UK
Offline Offline
Edison Member
*
Karma: 52
Posts: 2318
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but wouldnt the Arduino need an Ethernet shield then?  in any fashion?  to be able to 'connect' to this web service/site that is remotely hosted?

Yes, but as the OP said he was using ethernet it was safe to assume that he was using an ethernet shield.

Mark
Logged

Pages: [1]   Go Up
Jump to: