http://tuxgraphics.org/electronics
Using the tuxgraphics embedded web server to control scientific equipment
Abstract:
This article describes a more advanced version of the "switch on/off software" for the tuxgraphics
ethernet board. This software is based on HTTP/TCP with an atmega88
microcontroller but provides more features.
_________________ _________________ _________________
|
Under extreme conditions
The Forschungszentrum Jülich (http://www.fz-juelich.de/portal/home), a major research center in Germany, needed
a small ethernet board to control scientific instruments for high altitude
atmospheric research on the out side of an airplane. The special atmospheric
research airplane
has its own web page at http://www.halo.dlr.de/.
The High Altitude and Long Range research aircraft, photo with permission of Dr.
Ziereis from the DLR.
We knew that the
tuxgraphics web server would be a reliable and performing server at room
temperature but would it be able to control million dollar equipment on the
outside of a special high altitude airplane? Would it still work at -40'C or
colder?
I looked the datasheets for all the components on the tuxgraphics
ethernet board and it seemed possible if we would replace some of the components
with special versions
rated for industrial and military use.
Fortunately this request came in Canadian winter month February. In January and
February we can get some days with a light wind from the north and then the
temperature can suddenly drop to -30'C on the outside of our balcony. Perfect
test conditions! We built
a special version of the tuxgraphics ethernet board with components rated for
extreme temperatures. I took the board and a can of ice spray. I went outside
to connect it to ethernet and power.
Most electronic components and even the PCBs are made of compound materials
with many different temperature coefficients. One could expect some problems if
this goes all of a sudden from +25'C to -40'C.
It was night and freezing cold, -26'C. I had gloves and my warmest jacket on. The web
server was still functioning very well. Now I took the can of ice spray and
cooled it down until the board had well below -40'C. Amazingly this board
was still functional!
I started to feel cold too. Let's go for a real shock test. Let's go back inside.
The board was so cold that
the humidity of the air in the room would turn it immediately into something that
looked like a snow ball. .... the board was still functioning.
Once the board had completely defrosted I took a magnifying glass and looked
at it carefully. Everything was normal. Test passed!
What the software can do
The software is conceptually similar to the software described in the
article
HTTP/TCP with an atmega88
microcontroller. It offers however some interesting additions:
- The possibility to switch on/off 4 digital io ports
- The possibility to read two digital inputs
- The possibility to read two analog inputs
- The possibility to change the IP address without re-compiling the
software.
The digital inputs are adapted for 3.3V logic but the board can easily
inter-work with 5V or other logic levels if you put 470 Ohm or 1K Ohm
resistor in series with the digital inputs. This offers also some protection
against accidental over-voltage.
The analog input lines use 1.1V as reference voltage. In other words
1.1V corresponds to a read-out of 1023 and 0V to a read-out of 0. To
adapt to other voltage levels one can add a voltage divider in-front.
I recommend to use for this resistors somewhere in the range from 10kOhm to
500kOhm. There is enough space left in the software to add also add some conversion
formula in the microcontroller and display directly values that
make sense to the user.
Screen shot of the web interface
Adding your own ideas to the board
The tuxgraphics ethernet board has a dot-matrix field to add own components.
You can add e.g amplifiers or output drivers. In this specific case
we add transistors and protection diodes to be able to control relays.
The circuit diagram with the appropriate transistors to drive relays. Click to
get a printable PDF version.
The possibility to change the IP address
This software has also the possibility to change the IP address
at run-time without recompiling and loading new software into the
microcontroller.
To do this you just set a jumper wire on the board and power cycle it
to bring it into the IP address change mode. After that you
point your web browser to it and you can change the IP address. A
detailed step by step description of this procedure is included
in the software archive in a
sub-directory called "hardware".
You should however keep in mind that every ethernet equipment on the same
LAN needs its own MAC-address. If you want to connect a second
board to the same LAN then you need to change the MAC address in the software
before loading it into the microcontroller.
Pulling automatically measurement data
The web page of this sever is simple enough to be able to
read it with a script. So you can take a command line web-browser like
wget, lynx, w3m and grep to periodically pull measurements and fill a spreadsheet.
Those command line tool are available for Linux, Mac any Unix system
but some of them also for Windows (see e.g http://gnuwin32.sourceforge.net/packages/wget.htm
or http://home.pacific.net.sg/~kennethkwok/lynx/ and http://gnuwin32.sourceforge.net/packages/grep.htm).
Here is an example reading the line with the string "ADC0" every 120sec:
#!/bin/sh
while true; do
date
lynx -dump http://10.0.0.29 | grep ADC0
sleep 120
done
Password protection/login page
As of software version eth_rem_dev_tcp_eqCtl-2.18 there is also an optional
password protection. It is optional because you can decide at compile time
if you want that feature or not. Open file main.c and change the line with
LOGINPAGE as needed:
// set this to 1 if you want a login page, otherwise to 0
#define LOGINPAGE 1
This gives you then a password protection. The password
becomes part of the URL. This is useful if you want to access the
page from your mobile phone because you can bookmark it and you avoid
typing.
Optional: login page with password protection
With the password protection in place this is also a very useful software
for remote control of things like heating or air conditioning in your home.
You can activate it before you leave from work and save a lot of energy.
Conclusion
This is just one more example on how to use the web server. With a
bit of C-programming knowledge you can always adapt the system to
your own needs. It is good to have examples at hand from
where you can copy pieces of code. Just read over main.c and you will
probably understand how it works. The code presented here is small
enough to still run on an atmega88 chip. Bigger chips like atmega168 and
atmega328 will of course work too.
References/Download
© Guido Socher, tuxgraphics.org
2009-05-12, generated by tuxgrparser version 2.56