Fighting with computers

Computers are not always friendly.

Monday, June 16, 2008

Single data packet TCP


For Ethernet enabled devices I've used in the past (and I was happy with) the cores from Rabbit Semiconductor. They offer a lot of data and program memory and a royalty-free TCP/IP stack.

Not in the same league but still surprisingly useful is the Ethernet shield I've bought from Nuelectronics (a UK-based company). The shield plugs-in nicely on an Arduino board and it can easily allow you to create a simple network appliance.

In the picture I have my sample system that using a DS18B20 digital temperature sensor offers the temperature reading as a web page.

All the code used is the sample code and TCP/IP library provided by Nuelectronics. I had some minor trouble with my setup as I am using the so-called parasitic power on the temperature sensor and a few lines of code where added to the original code to make it work. The symptom of the problem is that I was getting +85.00 C no matter what the temperature was. The cause was that the sensor did not get enough power from the 1-wire bus pull-up resistor. After adding these three code lines:
digitalWrite(TEMP_PIN,HIGH);
pinMode(TEMP_PIN,OUTPUT);
delay(700);

Add them just before the second call to OneWireReset to fix the problem, thus providing enough energy for the conversion to take place.

If all you need is an web-based thermometer you can buy the whole thing for less than 30 UK pounds.

In my case I needed the Ethernet interface for another project but I like the idea of the Internet thermometer (so I can see what's going on with my office's air conditioning).

Interestingly enough, the TCP protocol implementation I've used is based on the idea of just having a single data segment and then closing the connection. It keeps many things simpler and faster so the code can fit in a much smaller footprint.

I'm using a USB port to power this project but an external power supply is possible too.

0 Comments:

Post a Comment

<< Home