Posterous theme by Cory Watilo

Arduino telnet client with display.

(download)
My first post ;)

One of my project was to build a Arduino telnet client that also displays the data being distributed.

Telnet is a text based network protocol which can passes data to and from any computer / mobile device (ipod touch, etc...).

 

 

 

Firstly, I had to handle the pinout as the Ethernet shield and Lcd use the same pins. This was quickly fixed by resoldering the display to other pins on the protoboard and changing a line in the code.

All LCD displays that are compatible with the Hitachi HD44780 driver ( the one's with a 16 pin interface), connect to the Arduino in the same way:

  • LCD RS pin to digital pin 12
  • LCD Enable pin to digital pin 11
  • LCD D4 pin to digital pin 5
  • LCD D5 pin to digital pin 4
  • LCD D6 pin to digital pin 3
  • LCD D7 pin to digital pin 2

 

Lcd_schem
(credits to the Arduino team).

 

The library for the display starts off by stating the pinout. :

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

 


All I had to do was to change the serie of number to what was available.  In this case 8,6,5,4,3,2.

Finally I used the example from the Arduino community, "Chat server" to handle the telnet side of the project and than the Liquidcrystal library to talk to the LCD.

Update:  The ipod is running a free application called iTelnet available on the app store.

(download)

 

The code is available after the pagebreak.

If you have any question or enquiry, feel free to post them in the comment.

 

/*

 Telnet display


 

A simple applications that displays any incoming telnet message.


 

 Circuit:

 

 * Ethernet shield attached to pins 10, 11, 12, 13

 

 * Lcd connected to pins 8,6,4,3,2

 Built on David A. Mellis and Tom Igoe 's Chat server example.

 

Many thanks to them.

Paul-Arthur

 

 */

 

 

#include <SPI.h>

#include <Ethernet.h>

#include <LiquidCrystal.h>

LiquidCrystal lcd(8, 6, 5, 4, 3, 2);

// Enter a MAC address and IP address for your controller below.

// The IP address will be dependent on your local network.

// gateway and subnet are optional:

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

byte ip[] = { 192,168,1, 3 };

byte gateway[] = { 192,168,1, 1 };

byte subnet[] = { 255, 255, 0, 0 };

 

 

Server server(23);

boolean gotAMessage = false;

 

void setup() {

 

  lcd.begin(16, 2);

  Ethernet.begin(mac, ip, gateway, subnet);

 

  server.begin();

 

  Serial.begin(9600);

    lcd.println("waiting !!!");

    delay(1000);

    lcd.clear();

    lcd.home();

}

 

void loop() {

 

 

  Client client = server.available();

 

  if (client) {

    if (!gotAMessage) {

      Serial.println("We have a new client");

      client.println("Hello, client!"); 

      lcd.print("active");

      lcd.clear();

      lcd.home();

      gotAMessage = true;

 

 

    }

 

 

    char thisChar = client.read();

 

    server.write(thisChar);

 

    Serial.print(thisChar);

     lcd.print(thisChar);

 

     }

}

 

 

 

 

 

 

 

 

 

 

 

 

 

by

| Viewed
times
Filed under: