LedP10 : Arduino library for P10 LED Display Panels


An arduino library, written to drive popular HUB12 based single color P10 LED display panels. It uses TimerOne and SPI library of arduino.


 Library features:

      • Can drive up to 320×16 pixels (10 Panels connected in cascade)
      • Supports dual line display, i.e. one panel divided into two.
      • Supports dynamic screen refresh. You can program to display dynamic content on the panels.
      • Supports different scroll speeds.
      • Static and scrolling text mode. Can switch from one to another at run time.
      • Supports only text based content right now.
      • 256 step Brightness control.

downloadLedP10 Library


Installation :

  • Unzip the LedP10 archive inside any directory on your machine.
  • Read the readme Install file.
  • Copy LedP10 folder into /Arduino/libraries of your arduino installation.
  • Open arduino IDE. (You need to reopen it after installing the LedP10 library).
  • In Arduino IDE, goto File > Examples > LedP10
  • You will find a few example program to demonstrate the usage of our library.
  • Build your own project by modifying these examples in the way you want.

Suggested Wiring to run example codes

p10 Wiring LedP10 Arduino Library

p10 Wiring LedP10 Arduino Library


LedP10 Example Codes:

Our library provides following examples that you can use to design your own LED sign board display systems:

Example -1 : Static Display with dynamic content

/*
 LedP10 Example Program
 Reads the value from ADC Channel A0 and Display on P10
 */
#include "TimerOne.h"
#include "SPI.h"
#include "LedP10.h"
 
LedP10 myled;
void setup()
{
     myled.init(3,4,8,9,1);
     /*
      P10 Select Line A - Arduino Pin 3
      P10 Select Line B - Arduino Pin 4
      P10 Store Line    - Arduino Pin 8
      P10 OE Line       - Arduino Pin 9
      No. of Panels     - 1 (Can be up to 10)
     */
}
void loop()
{
      int sensorValue = analogRead(A0);
      // Display sensorValue statically in single line with font 0
      myled.showmsg_single_static(sensorValue,0);
      delay(500);
}

Example 2 – Static Display with dynamic content

/*
 * This example displays an integer counter value.
 * showmsg_single_static function takes two arguments
 * first argument can be an interger value or a pointer to character string or a string in double quotes.
 * second argument is to select font, for which rwo values i.e. 0 and 1 are supported.
 */

#include "TimerOne.h"
#include "SPI.h"
#include "ledP10.h"
 
int num1=0;
LedP10 myled;

void setup() 
{
    myled.init(3,4,8,9,1);
      /*
      P10 Select Line A - Arduino Pin 3
      P10 Select Line B - Arduino Pin 4
      P10 Store Line    - Arduino Pin 8
      P10 OE Line       - Arduino Pin 9
      No. of Panels     - 1 (Can be up to 10)
      */
}
void loop() 
{
    myled.showmsg_single_static(num1,0);
    num1+=1;
    delay(500);
}

Example 3 – Double line static display

/*To display two counters of height 8 pixels.
function showmsg_double_static takes three arguments, first two can be either pointer to string or integer independently. Third argument is to select font for which only one value is supported currently i.e. 0.*/

#include "TimerOne.h"
#include "SPI.h"
#include "ledP10.h"
int num1=0,num2=1;
LedP10 myled;

void setup() 
{
      myled.init(3,4,8,9,1);
      /*
      P10 Select Line A - Arduino Pin 3
      P10 Select Line B - Arduino Pin 4
      P10 Store Line    - Arduino Pin 8
      P10 OE Line       - Arduino Pin 9
      No. of Panels     - 1 (Can be up to 10)
      */
} 
void loop() 
{ 
      myled.showmsg_double_static(num1,num2,0); 
      num1+=1; 
      num2+=2; 
      delay(500); 
}

Example 4 – Single line and double line scrolling text

/*This example illustrates two user funcions of LedP10 library

First function-showmsg_single_scroll is for scroling of single message on P10 panel with 4 arguments which are message, no. of times of message scrolling, speed and font.

for message, pointer to a character string can be passed. For continuously running the message, INF can be passed in second argument, speed can be in range of 0-30, and font can be 0 or 1 as two type of fonts are currently supported for full screen messages. 


For second function-showmsg_double_scroll, there would be 7 arguments, 2 for messages, two for no. of times of message scrolling, two for speed, and last one for font. 

Specification being same as for single scrolling function, except only one font id provided for double scrolling and it's value should be 0.*/
 
#include "TimerOne.h"
#include  "SPI.h"
#include  "ledP10.h"

LedP10 myled;

void setup() 
{
   myled.init(3,4,8,9,5);
       /*
      P10 Select Line A - Arduino Pin 3
      P10 Select Line B - Arduino Pin 4
      P10 Store Line    - Arduino Pin 8
      P10 OE Line       - Arduino Pin 9
      No. of Panels     - 5 (Can be up to 10)
      */

 
   myled.showmsg_single_scroll("this is single led test",2,3,0);
   delay(6000);
   myled.showmsg_double_scroll("this is double led test1","this is double led test2",10,INF,3,1,0); 
}

void loop() 
{
 
}

Example 5 – Brightness control

/*This example is to illustrate the use of the functon <setbrightness(uint8_t brightness)>, this function takes one argument of type uint8_t, it's value can be from 0 to 255, 255 being highest brightness and 0 is lowest.

this function can be called anytime after or before calling any other function of LedP10 library. 

In this example brightness reduces when counter 'num1' reaches value of 50.
*/

#include "TimerOne.h"
#include "SPI.h"
#include "ledP10.h"
int num1=0;
LedP10 myled;

void setup() 
{
    myled.init(3,4,8,9 ,1);
}
void loop() 
{
   if(num1==50)
   {
      myled.setbrightness(50);
   }
   myled.showmsg_single_static(num1,0);
   num1+=1;
   delay(500);
}

Comment below to report any issues and bugs related to this Arduino library.


Ads:

Outdoor P10 Single Color RED panel 32x16 High Quality P10 LED Panel with connectors [Buy in India]
ZH-UN LED Panel Display Controller LED Display controller card [Buy in India]
SMPS 5V Output 5V / 5A or 5V/10A SMPS [Buy in India]
Arduino_Uno_-_R3 Arduino UNO R3 [Buy in India]

About author

Devesh Samaiya

Chief Tinkerer at Lonely Night Projects

Leave a reply

Your email address will not be published. Required fields are marked *

42 − = 38