Network settings web page FORM using EEPROM to save submit [DONE]

Made it better, follow the link to my project page shown in my very first post Network settings web page FORM using EEPROM to save submit [DONE] - Exhibition / Gallery - Arduino Forum

Hello JO3RI
thankyou or your hard work here, this is exactly what I need to make a PLC network tester, with one small thing missing DHCP/Static choice.
I have been trying, but I can not make this work, it just hangs when DHCP selected. Did you manage to make that work? Why did you remove it?
I have also tried your older code with DHCP but it doesn't seem to stay selected, it changes back to static.
Any help much appreciated

Hi vk5oi,

thanks for trying out my code, now for your question.

There is a reason why I ditched DHCP. for DHCP you'll need the Arduino IDE above 1.0, but when you do, it will not compile because it's confusing DNS for some reason (I don't really know why) and it only is with the byte DNS[] = { , , , }

Now in my code you won't find anything on DNS, but I have been working on this thing for other projects and there it has DNS included (needed for things like twitter lookups). Maybe I should continue my work on this and include a choice on DHCP/STATIC. But I'll have to figure out how to get it working on the new IDE.

this is actually how those setup pages look at this moment:

from my project CastDuino (CastDuino Slave): http://www.jo3ri.be/arduino/projects/castduino

from my project DUAL TANK LEVEL MEASURING: http://www.jo3ri.be/arduino/projects/tank-level-measuring-basic

Now if you're willing to help, I could update the code so you have the choice between static and DHCP.

I need to know some things:

  • do you need other webpages (look at those screenshots, you'll see more pages for your own stuff)
  • do you need that fancy layout (or do you want minimalistic)
  • what Arduino IDE are you using?
  • do you need the DNS ip (without it, it might be quiet simple to add dhcp support)

Hello J03RI
sorry for the delay, life interferes with my fun.
Thanks again, for your work, this is (nearly) perfect for me but I could not possibly achieve this alone. Somehow I just can not get the details right.
To answer your questions.

I need only 1 page, just setup, I will use also an LCD to display IP, Gateway, connection to server (ping) ok, if DHCP or Static etc.
The fancy layout is nice, but I need only basic form for entering data.
I can use IDE 1.0 or 1.0.1
I don't think I need DNS, but...maybe to make my ping function work (for example ping www.google.com) to test internet connectivity.

I hope this is ok? I can try to explain my application further if you need, but what you have done is so close except for DHCP/Static.

Cheers, and thanks
John

I hope this is ok? I can try to explain my application further if you need, but what you have done is so close except for DHCP/Static

.

Ok, I'll continue my work and add dhcp/static switch, but you'll have to give me time.

1 more question. What has to be default? Static or dhcp. You'll have to consider a lot, before deciding.
2nd extra question. Does it have to save settings into EEEprom? Once done, you can't fall back on a simple reset button to go back to default settings (or has this to be a possible selection: save to eeprom/don't save to eeprom)
3th question: why don't I make separate program for your needs, but then I need full explanation of your project, better email about it and we'll work together. info at JO3RI.be

Hi J03RI
Please take all the time you need, I am the one who needs help, I can wait, no problems.
I think I will email, and explain the idea fully.

Cheers
John

Hello JO3RI

thanks for sharing your work!

I used your Webpage with some modifications in my project. Basically, I want to be able to change IP address from browser, transmit some simple data, and have some sensor readings.

I encountered strange bahaviour: first time I load "setup" page, and submit form data, everything works as expected. However, if I use same form to submit data again, values from first submit get transferred. After third try, data from second time finally arrives and so on. Some research showed, that parser gets all values twice: from the form (or request URL) itself, and from "referer" field.

In other words: After we press "submit" button, we also see all form contents in URL in our browser. Next time we press button, we send new form data again, and once more old data as referring URL.

The reason for the bug is that terminate expression in findUntil is wrong, and it leads to referer being parsed. According to Wiki the request line and headers must all end with /r/n. And that's what I see in Wireshark. Now, you look for /n/r, i.e. other way around. I guess, you just took example from TextFinder manual, which was wrong.

I hope I understand everything right. Feel free to correct me, if it's not the case.

Hi AntonG,

Thanks man and you are right. Some time ago, I made an other sketch (a better one) that I'm using in all, but I should make a new one, basic for other people to use, I know and I will. Just need more time.

Have fun and take a look at my other projects: http://www.jo3ri.be

Wow, this sketch goes 99% of the way I need to go for a project i just started working on.

Unfortunately, when I try to compile it in IDE 1.0.1 on Fedora, I get a TON of compilation errors:

hack.cpp:59:1: error: 'prog_char' does not name a type
hack.cpp:60:1: error: 'prog_char' does not name a type
hack.cpp:61:1: error: 'prog_char' does not name a type
hack.cpp:62:1: error: 'prog_char' does not name a type
hack.cpp:63:56: error: variable 'string_table0' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
hack.cpp:63:61: error: 'htmlx0' was not declared in this scope
hack.cpp:63:69: error: 'htmlx1' was not declared in this scope
hack.cpp:63:77: error: 'htmlx2' was not declared in this scope
hack.cpp:63:85: error: 'htmlx3' was not declared in this scope
hack.cpp:65:1: error: 'prog_char' does not name a type
hack.cpp:66:1: error: 'prog_char' does not name a type
hack.cpp:67:1: error: 'prog_char' does not name a type
hack.cpp:68:1: error: 'prog_char' does not name a type
hack.cpp:69:1: error: 'prog_char' does not name a type
hack.cpp:70:1: error: 'prog_char' does not name a type
hack.cpp:71:1: error: 'prog_char' does not name a type
hack.cpp:72:1: error: 'prog_char' does not name a type
hack.cpp:73:56: error: variable 'string_table1' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
hack.cpp:73:61: error: 'htmla0' was not declared in this scope
hack.cpp:73:69: error: 'htmla1' was not declared in this scope
hack.cpp:73:77: error: 'htmla2' was not declared in this scope
hack.cpp:73:85: error: 'htmla3' was not declared in this scope
hack.cpp:73:93: error: 'htmla4' was not declared in this scope
hack.cpp:73:101: error: 'htmla5' was not declared in this scope
hack.cpp:73:109: error: 'htmla6' was not declared in this scope
hack.cpp:73:117: error: 'htmla7' was not declared in this scope
hack.cpp:75:1: error: 'prog_char' does not name a type
hack.cpp:76:1: error: 'prog_char' does not name a type
hack.cpp:77:1: error: 'prog_char' does not name a type

Can someone point me in the right direction?

Hi there,

Using IDE 1.0.1 You'll need the pgmspace.h library: PROGMEM - Arduino Reference

But you will encounter other problems to, better is to upgrade to IDE 1.0.3 (no need to look for pgmspace.h library) or higher and you should be ready to continue

hi
i know this is an old post but is there any way that you can fix your sketch?
won`t work on 1.6.3
thank you

Update to compile with Arduino 1.6.4 / 1.6.5.
Read this to understand the modifications

EthernetSetup1_1.ino (14.1 KB)

In my last post I uploaded a sketch that I use with the ENC28J60 ethernet controller. If you want to use with the WIZ5100 controller (the Arduino official one), just change the line #include <UIPEthernet.h> to #include <Ethernet.h>.

Hello,
I was able to compile in installed IDE (Not stand alone file) ver 1.0.5-r2, using UIPEthernet library.
successfully compiled EthernetSetup1_1 , will be adding more options like selct DHCP and STATIC.
There is a bug in MAC address field. Eg mac: 00:02:8A:FE:0F , leading zeros are omited.
Any one has a fix ?

One more issue I am running into:
After I add some html code in prog_char htmla0 and prog_char htmla1 it does not save first two digits of mac address.

Thanks
Sudheer

Hi, It has been a long time since I visited this forum (very long)

Nice to see people kept working on the code.

Leading zero's is a problem indeed, "posting" a zero = to posting nothing. To be honest, I don't have a clue on how to fix it.

Hello,
to reset the Arduino from Software i use this

So now everytime i press submit it resets the Arduino if there where some changes in the settings.

Edit: At the moment it only works with ip changes, not with Mac changes

Hi I am also using the basic front end of this project for my own..
I made a few discoveries...

Instead of going mad with using progmem to store the HTML, you can use Macro F

client.println(F("HTTP/1.1 200 OK")); //send new page
client.println(F("Content-Type: text/html"));
client.println(F("Connection: close"));  // the connection will be closed after completion of the response

really neatens things up for you ...

Also I was wondering about this soft restart...

I was thinking you could call up a line of assembler that would basically do a direct jump to the program start vector...

Im really pleased with mine so far, in the end mine is a long way from where I started with the code on here, it uses some nice simple CSS, JS and DOM

hello everyone,

in addition to this project I want to form this project to setup server address
which is I want to post sensor data to. but I could not manage to change an store in eeprom web server information which is stored as default string value. anybody can help me to solve this issue..

thanks for help..