The Start

Hi, What and Why

Plug it in

Rule number 1

Water Sensor

Sound Sensor


Tri Colour LED

RTC (Real Time Clock) DS1302

RTC (Real Time Clock) DS3231

Matrix LED step 1


Stepper Motor

LCD revisited with PCF8574T

Humidity Sensor

Shift Register

RFID tags (RC-522)

7 Segment display

Ultrasonic distance sensor

5V regulator

analogRead and analogWrite

Wiring an Array of Switches

The next step

Other things I have bought

Infra red and Processing

Programming a separate arduino chip

Creating your own PCB

L293D for a DC motor

4 digit 7 segment display

Starting with motors

RF433 Wireless Comms

Sort a character array

More stuff

I2C devices (SDA,SCL)

I2C scanner

SPI devices (MOSI,MISO)

HMC5883L Compass

MMA7361 Accelerometer

Added projects

Message Display System

4WD robot car
4WD robot car II

4WD robot car COMPLETE

MP3 Player

Project to store and display historical messages

Most systems produce messages that give the user feedback and error messages. A user needs to see what happened in the past - for example, if a system fell over this afternoon, it's essential to see the messages from this morning, to work out what happened.

The 16 x 2 LCD screen allows 2 messages to appear at once, one on each line. This is nowhere near enough to work out where an error may have occurred.

This system stores 10 messages, and allows the user to scroll up and down the list using a switch. It can easily be extended to store and display as many messages as you wish.

This code I developed myself, and I put it into the public domain. If you find it useful, I'd appreciate a feedback message.

// Display up to 10 messages on a 16x2 LCD
// Author  : Paul Goodliffe
// Contact :
// Date    : May 2014
// Licence : Public domain freeware.
// Connect up the LCD for usual display purposes
// Connect a switch to arduino pin 7 to scroll upwards thru the messages
// Connect a switch to arduino pin 6 to scroll down thru the messages
// Call the function addMessage() to write a message. Up to 10 are stored.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5,4,3,2);

int msgUpPin = 7;    // The switch to scroll messages UP is on pin 7
int msgUpBtn = 0;    // the value that is read from that switch
int msgDownPin = 6;  // The switch to scroll messages DOWN is on pin 6
int msgDownBtn = 0;  // the value that is read from that switch

int numMsgsInArray = 0; // This has a maximum of 10 messages
String messages[10];    // because we've defined 10 Strings

int msg_num = 1;        // This is between 1 and 10, reflecting which message number is printed on the LCD

void setup() {

  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  pinMode(msgUpPin, INPUT);
  pinMode(msgDownPin, INPUT);
                        // Add a couple of sample messages, so that we see something.
  addMessage("first message Hello");
  addMessage("second message World");
  addMessage("the third msg");
  Serial.begin(9600);    // Only needed if you want to view the messages on your monitor as well
  printMessages();       // start off by printing the first message on the LCD

void loop() {
  delay(40); // Slow the machine down to a sensible state, run eg. 25 times per sec
  // Put the rest of your code here, using function addMessage() to send a message when you wish.

 void checkDownButton()
  msgDownBtn = digitalRead(msgDownPin);
  if (msgDownBtn == HIGH)
        if (msg_num < 1)
            msg_num = 1;

void checkUpButton()
msgUpBtn = digitalRead(msgUpPin);
  if (msgUpBtn == HIGH)
        if (msg_num > numMsgsInArray)
            msg_num = numMsgsInArray;

void addMessage(char *newMsg)
   if (numMsgsInArray >= 11)
     { // To shift the messages up in the array,
       // get the length of the string and reserve it,
       // Then shift the msg to the reserved space.
       // Note that I have used "human values" so that "number of messages" is correct (between 1 and 10), and
       // the code subtracts 1, to point to the correct array entry (between 0 and 9).
       for (int i = 1; i <= 9; i++)
          int tmp1Length = (messages[i].length());
          messages[i-1] = messages[i];
     numMsgsInArray = 10;

  int strLength = strlen(newMsg)+1; //Include space for \0
  messages[numMsgsInArray-1] = newMsg;

void printMessages()
  // If you want to see the messages on your serial monitor (eg for testing the code)
  Serial.println("Now it is");
  for (int i = 1; i <= numMsgsInArray; i++)
  // Now, print the messages out to the LCD screen.
  lcd.setCursor(0, 0);
  // Print the next message on the following line, if it exists
   lcd.setCursor(0, 1);
  if (msg_num < numMsgsInArray)
  delay(300); // Give the user time to lift their finger off the button
Wired up and working. 7 segment LED

The wiring:
The LCD is connected as before, see here.

Violet and Blue are connected to pins 6 and 7, the switches. The default state is a drop down resistor to ground. The 'switch' in this case is the spare red cable, connected via a resistor to +5V. In this testing phase, I simply touch the spare cable to the drop down resistor to simulate a switch push.