DHCP: Web clients which require no manual configuration

The test_dhcp_www_client_adc0.c and test_dhcp_www_client_pushbutton.c example are pure web-clients (a.k.a "web browsers") that configure them self via dhcp.

That is: you just connect the board with an ethernet cable to your DSL router and everything else is automatic. No manual configuration needed.

All the clients write for testing purposes to a publicly available web page at http://tuxgraphics.org/cgi-bin/upld

You can use the sdat cgi-script provided in the ../cgi-script directory, install it on your own web server and up-load data to your web server. Just replace in the C-code the WEBSERVER_VHOST with the name of your own server. Search further down in the C-code for upld and replace it by sdat.

test_dhcp_www_client_pushbutton

The test_dhcp_www_client_pushbutton.c example writes an entry on a web page at http://tuxgraphics.org/cgi-bin/upld whenever a button is pressed.

When you connect pin PD6 with GND then it will upload a line to the upld page that should look like this:
70.80.220.56 :: 2012-01-28 18:08 GMT :: action=btn :: ethbrd_ip=10.0.0.30 :: pw=sec ::
The ethbrd_ip is the IP address that your DSL router gave to the board via DHCP.

There are two LEDs you can connect to the circuit to be able to see what is going on.

LED1 between PB1 and Vcc: this LED will be on during transactions and go back off when the transaction is finished. Transactions are e.g: get IP via dhcp, resolve tuxgraphics.org via DNS, start a browse to upload data to http://tuxgraphics.org/cgi-bin/upld

LED2 between PD0 and Vcc: this LED will only go on if the DHCP server did not provide a gateway IP address. This software needs absolutely a gateway IP address and can not function without it.

test_dhcp_www_client_adc0

test_dhcp_www_client_adc0.c takes periodic measurements of analog voltages. It writes an entry with the voltage onto the web page at http://tuxgraphics.org/cgi-bin/upld at start-up and afterwards every 60min. It logs analog voltages read from pin ADC0. The voltage range is 0-1.1V but you can add a voltage divider to measure any higher DC voltage by adding a voltage divider: http://tuxgraphics.org/toolbox/circuit-design-calculator.html I recommend to dimension the divider such that the sum of the two resistors (R1 + R2) is in the range from 100K to 500K.

The test_dhcp_www_client_adc0.c is more sophisticated. It can not only communicate with the upld/sdat utility on a server in the internet but as well with a server in your local LAN. You man specify an IP address in the host part of the URL (aka webserver_vhost).

There are two LEDs you can connect to the circuit to be able to see what is going on.

LED1 between PB1 and Vcc: this LED will be on during transactions and go back off when the transaction is finished. Transactions are e.g: get IP via dhcp, resolve tuxgraphics.org via DNS, start a browse to upload data to http://tuxgraphics.org/cgi-bin/upld

LED2 between PD0 and Vcc: this LED will only go on if the DHCP server did not provide a gateway IP address.

Using the software

test_dhcp_www_client_pushbutton:
  1. Connect the board to your network. Power it up and load the software.

  2. Connect pin PD6 and GND.

  3. Point your web browser to http://tuxgraphics.org/cgi-bin/upld. The site filters data by originating IP. The originating is the external address of the DSL router were the web client is connected. If you use the same router to get onto the internet then the IP address suggested is already the correct one. Just click "show". You should see an entry generated by the board.



test_dhcp_www_client_adc0:
  1. Connect the board to your network. Power it up and load the software.

  2. Provide a voltage between 0 and 1.1V to pin ADC0. A voltage of 0 will result in an ADC reading of 0 and a voltage of 1.1V will map to 1023. To measure higher voltages you can add a voltage divider (http://tuxgraphics.org/toolbox/circuit-design-calculator.html). Just for testing purposes you can as well connect nothing to ADC0 and it will pick-up random electric fields out of the "air".

  3. Point your web browser to http://tuxgraphics.org/cgi-bin/upld. The site filters data by originating IP. The originating is the external address of the DSL router were the web client is connected. If you use the same router to get onto the internet then the IP address suggested is already the correct one. Just click "show". You should see an entry generated by the board.

Compiling and loading the code into the tuxgraphics ethernet board

Please see the top level README.htm file for details.
© tuxgraphics