Go Down

Topic: Excellent Arduino Ethernet Shield Web Server Tutorial (Read 204818 times) previous topic - next topic

CatweazleNZ

All

I have released the source code for my Arduino home automation system web server which runs at http://www.2wg.co.nz. There is 34 pages of documentation and 11,000 line of source code.

My web server implementation (which is quite substantial) is my own and manifests as a set of individual purpose specific procedures (functional decomposition) - each of which should be easy enough to understand. The source code includes quite a lot of additional technical documentation using comments.

You can download the source code and documentation from the application website. Access the SD card web page and browse to the PUBLIC folder/subdirectory. A message on the dashboard/main web page will tell you what files to download.

You may have to be a little patient - the system is single threaded and will ignore you for a few seconds if it is serving up a big file to someone else.

Cheers

Catweazle NZ

thaslemanasreen


lucas10880

Oi pessoal então , eu uma ideia de um projeto mais não sei muito como posso desenvolver gostaria que se um de você pudesse me ajudar eu ia agradecer , o projeto é o seguinte é uma pagina que terá um campo  de texto e o usuário ira digitar alguma coisa e o site ira responder sendo assim os dois iram efetuar uma conversa homem vs maquina mas esse robô (pagina) não poderá enviar a mesma resposta sempre então eu imaginei o cérebro dele como se fosse uma roleta porque quando o usuário digitar alguma coisa ai vai automaticamente vai girar uma roleta invisível  e vai dar uma resposta e se ele perguntar a mesma coisa de novo a roleta vai girar outra vez e vai cair em outra resposta

mega-hz

Hello,

i am making a housecontrol, the arduino webserver is based on the starting-electronics server.
But there are many changes:

Because of selfdestroying an mem-hungry sd-cards i removed this and let website run of my home-linux server.
The arduino only gets und puts the IO-Datas, like Inputs, Outputs,Can-Bus and analog values.
On the 1. Arduino (there are 2!) there is a 32xOutputSHield (74595) and a 32xInput-Shield(74165), an MCP2515 CAN-Bus Shield and a Ethernet.
The 2nd Arduino has only a EthernetShield and measures the voltage/current/Power of my PVs.
Both Arduinos are polled from my Webserver, the Website with JS.
This works fine sofar.

I tryed to put all 3 (server, arduin1, arduino2) to access on internet with a dyndns sort of service.
That runs too, but every 2-3seconds, when polling, my FritzBox Router (also for IP-Phone) makes a audio-blank on the phone for half a sec. So that seems to be to much traffic for back & forwarding....

So i renamed the Connections to the local IPs, runs well, but only local.

The Website is not very nice, it is just a test for the functional, i will make a nice one soon.

My Problem is:
The System is working getting and putting datas to/from arduinos and display them on the website.
BUT, THAT is only one Part, the main part is missing yet:
The Part of making some actions when there are some states of the data! The brain!
(If sun = true, turn off outside light...)
On the Arduinos is not enough memory to do that, so i had some ideas to do that and would like to hear,
what suggestions you may have!

1. Another Arduino connected with I2C gets data , makes actions and rules, sends data.
2. Make a Python programm on my debian server for sending the html and js and making actions and rules
3. Make a C++ programm on my debian server for s..........
4. ???

any ideas?

The website is here: http://mega-hz.dnshome.de:84/
(But ithink you won't be able to see the data, because of local arduino-ip's.

And The Sketch is here: http://www.mega-hz.de/Arduino/WEB-IO/_home-sys_arduino_no_sd.ino
 
Wolfram.



rockwallaby

I can see this thread has gone off topic, please excuse me also.  :smiley-confuse:
Wolfram, I looked at your website but as you say, I did not see any real time data.

To give you an idea of what I do for my own off grid system, which was to use an Arduino to do all the low level I/O control and to develop an application for a small GNU/Linux board to be the web server.

The GNU/Linux board communicates to the Arduino using Modbus protocol to get and set data.
The GNU/Linux system logs all data to SQLite3 database for historical purposes.

The Arduino controls MOSFETs for each solar PV panel connected to the LiFeYPO4 battery system.
The Arduino also communicates with a BMS (Battery Management System) via CanBus.

My project started initially with a Freetronics Ether-Mega, with onboard Ethernet, but now I use an Arduino DUE, using the inbuilt CanBus controllers to talk to the BMS.

The Arduino is a Modbus slave, being polled by the GNU/Linux board acting as Modbus master and web server, all coded up in C, and being translated across to C++.

The web application is a single page application using a framework to make application navigation very fast, with all real time data being ask for via AJAX calls.

The key points are, use the Arduino as a low levl I/O controller and leave the more complex stuff like internet connections and long term historical data storage to a small GNU/Linux system. Use a good data protocol like Modbus between Arduino and GNU/Linux system.

My signature is my GNU/Linux system web server as mentioned above. It points to my renewable energy system still being developed when I have time.

So, my suggestion for you is to go with choice number 2 or 3.  :)
_____________
Paul - VK7KPA
Paul - VK7KPA

mega-hz

that sounds very nice!
I have great interest to see more of it!

>The GNU/Linux system logs all data to SQLite3 database for historical purposes.

do you have a link for that?
datalogging for long run is also my goal!

rockwallaby

Wolfram wrote:
Quote
The GNU/Linux system logs all data to SQLite3 database for historical purposes.
Unfortunately, not really, I just programmed it up into my application, QuadlogSCADA.

But for SQLite3, here is an entry point to the SQLite3 site which describes some things about where it using it might be appropriate.

To give you an idea of how I went about things:
In terms of SQLite3, data that is configured to be logged will be stored to SQLite3 database each log period, say every one second for example. The logged data can then be requested via a connected HTTP client through the application for a start period and number of records, which is then sent back through to the HTTP client as CSV as a AJAX request reply to be stored in a json model in the client side JavaScript SPA, which then can then be displayed using HighCharts JavaScript charting library.

SQLite3 is a nice easy to use and lightweight library that is fairly easy to integrate into many different coding platforms, whether that be C or C++ or Python or in fact, many others.
_____________
Paul - VK7KPA
Paul - VK7KPA

Hazza

Hi, As usual like most pots here I am new to Arduino .  I am trying to use two UNO with Ethernet boards to communicate.  to test my config I am using the Ethernet example UDPSendReceiveString and Ethernet lib 2.  When I compile the Send part it fails  on line "import hypermedia.net.*";

Also there seems to be code missing from this example like IP address assignment etc.

can anyone shed any light where I am going wrong.
/*

  Processing sketch to run with this example
 =====================================================

 // Processing UDP example to send and receive string data from Arduino
 // press any key to send the "Hello Arduino" message


 import hypermedia.net.*;

 UDP udp;  // define the UDP object

 void setup() {
 udp = new UDP( this, 6000 );  // create a new datagram connection on port 6000
 //udp.log( true );       // <-- printout the connection activity
 udp.listen( true );           // and wait for incoming message
 }

 void draw()
 {
 }

 void keyPressed() {
 String ip       = "192.168.1.177";   // the remote IP address
 int port        = 8888;      // the destination port

 udp.send("Hello World", ip, port );   // the message to send

 }

 void receive( byte[] data ) {          // <-- default handler
 //void receive( byte[] data, String ip, int port ) {   // <-- extended handler

 for(int i=0; i < data.length; i++)
 print(char(data));
 println();
 }
 */

 

josemigu


A simple question:

If my ISP (Internet Service Provider) as Movistar or another in your country, change constantly mi public IP, so how can i connect to the web server? In a wide area network.

Example: if the web server is in my house in Chile, and i go to  holyday in Brazil.. how i can connect?

Saludos desde Concepción, Chile.!


kazkaslengvo

A simple question:

If my ISP (Internet Service Provider) as Movistar or another in your country, change constantly mi public IP, so how can i connect to the web server? In a wide area network.

Example: if the web server is in my house in Chile, and i go to  holyday in Brazil.. how i can connect?

Saludos desde Concepción, Chile.!


dynamic dns

Go Up