Arduino Ethernet Shield hooked up to LED message display

This hack allows you to display messages to a standard Amplus LED Message Display from Clas Ohlsson. The display is controlled by a remote control and via a RJ14 cable plugged into the screen. Serial data is transmitted from cable to the screen. The LED Message display expects the message you pass to it to be encrypted with a check sum. With the help of Rasmus blog post I could generate this checksum in Arduino. I turned his Perl code into Arduino code that you can see below.

  1. int stringToInt(String thisString) {
  2.   String letters = " !’#$%&’()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[/]^_`abcdefghijklmnopqrstuvwxyz{|}~";
  3.  
  4.   int newstr = 32 + letters.indexOf(thisString);
  5.  
  6.   return newstr;
  7. }
  8.  
  9. String generateMessage(String inputString) {
  10.  
  11.   byte checksum = 0×74;
  12.   int i;
  13.  
  14.   for(i = 0;i < inputString.length();i++) {
  15.       String currentChar    = inputString.substring(i,i+1);
  16.       int asciiChar         = stringToInt(currentChar);
  17.       checksum = checksum ^ asciiChar;
  18.   }
  19.  
  20.    String hexStr =  String(checksum, HEX);
  21.    hexStr.toUpperCase();
  22.    
  23.    String message = "<ID00><L1><PA><FE><MA><WC><FE>" + inputString + hexStr + "<E>";
  24.    return message;
  25.    
  26. }
  27.  
  28. String myString = "My led display message here";
  29.  String mess = generateMessage(myString);
  30.   Serial.print(mess);

Control servo motor

The servo motor can be controlled by using the servo library(Servo.h) in Arduino IDE. Plug in the control wire of the servo motor into one of the PWM pins. Attach the servo object to that pin.

  1. Servo servoMotor;
  2. servoMotor.attach(9);

To rotate the servo motor pass in a number between 0 and 180. The servo motor can only move up to 180 degrees.

  1. myservo.write(90);
  2. delay(2000);
  3. myservo.write(180);
  4. delay(2000);

Control relay with TIP120

Control Omron G5LE-1 relay that requires 12V to switch the relay on and off. The relay it self is turning a 220VAC circuit on and off.

Use transistor as switch for 9V curcuit

With the circuit below you can control a 9V circuit by using a simple PNP transistor(bc557) to turn it on and off. The digital output nr 3 on the Arduino board controls the transistor.

PNP transistor


Turn the motor on with this code:

  1. void setup() {                
  2.   pinMode(13, OUTPUT);    
  3. }
  4.  
  5. void loop() {
  6.   digitalWrite(13, HIGH); // Turn on motor
  7.   delay(5000);
  8.   digitalWrite(13, LOW); // Turn off motor
  9.   delay(5000);      
  10. }

DC motor

You will need:
- DC Motor
- Power diod
- TIP 120

Turn the motor on with this code:

  1. void setup() {                
  2.   pinMode(8, OUTPUT);    
  3. }
  4.  
  5. void loop() {
  6.   digitalWrite(8, HIGH); // Turn on motor
  7.   delay(5000);
  8.   digitalWrite(8, LOW); // Turn off motor
  9.   delay(5000);      
  10. }

Flex sensor

To get the values from the flex sensor you need a 22K resistor.

  1. void setup() {
  2.       Serial.begin(9600);
  3. }
  4.  
  5. void loop() {
  6.       int sensorValue = analogRead(A0);
  7.       Serial.println(sensorValue, DEC);
  8. }