RAMPS compatible LCD controller module (HC3DPR0005)

Products related to 3D printing and CNC machines.
admin
Site Admin
Posts: 865
Joined: Sun Aug 05, 2012 4:02 pm

RAMPS compatible LCD controller module (HC3DPR0005)

Post by admin » Fri Jan 10, 2014 5:09 pm

Image
All items shown above picture are included.
Image
RAMPS shield and Mega not included
Image

Description:
This controller is designed to be used with a RepRap RAMPS interface board such as our RAMPS compatible shield (HC3DPR0002). Using this module allows you to print your designs without requiring a computer be connected to your printer. The module contains and 20 x 4 line backlit LCD display, buzzer, SD card reader, and control inputs. The module also includes cables and adapter board for solder-less connection to a RAMPS shield. Power is taken directly from the RAMPS shield so no additional cabling is required.

Although this module is designed to be used with a RAMPS shield and 3D printer, it can of course be used for any project where a panel mounted display and control input is required. An Arduino test sketch is available which will demonstrate how to use the module in your own projects.

Schematics:
RAMPS_LCD_Controller_Schematic.pdf
RAMPS_LCD_Controller_Adapter_Schematic.pdf
Arduino test sketch:

Code: Select all

/* FILE:    ARD_RAMPS_LCD_Panel_Test.pde
   DATE:    09/01/14
   VERSION: 0.1

This sketch will test all of the components of the RAMPS compatible LCD panel.
It assumes that the panel will be connected to an Arduino Mega and RAMPS shield.
However this sketch is useful if you are not intending to use it with a 3D printer
as an example of how to access the various components.

To run this test you will need to insert and SD card with a text file named 
'test.txt'. The test will display on the LCD the first 20 characters contained
within this file. You will also be prompted, via the LCD screen, to adjust the 
controls of the panel.

The sketch will perform the following tests:

Buzzer test: The buzzer will beep twice
SD Card test: Will attempt to read the contents of the test.txt file on the SD card
Dial button check: Will prompt you to press the panels dial
Reset button test: Will prompt you to press the button labelled reset on the panel
Dial CW rotate test: Will prompt you to turn the dial clockwise until count = 10
Dial CCW rotate test: Will prompt you to turn the dial counter-clockwise until count = 0

There will be a 4 second delay between each test.


You may copy, alter and reuse this code in any way you like but please leave 
reference to hobbycomponents.com in your comments if you redistribute this code. 
This software may not be used by other sellers.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS LTD MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS LTD SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.
*/

/* Include the LCD Library */
#include <LiquidCrystal.h>

/* Include the SD card library */
#include <SD.h>

/* DIO pin used to control the SD card readers CS pin */
#define SD_CARD_CD_DIO 53 

/* Rotary encoder (dial) pins */
#define ROT_EN_A 31
#define ROT_EN_B 33

/* Rotary encoder button pin */
#define BUTTON_DIO 35
#define BUZZER_DIO 37

/* Reset button pin */
#define RESET_DIO 41

/* LCD display pins */
#define LCD_RS 16
#define LCD_EN 17
#define LCD_D4 23
#define LCD_D5 25
#define LCD_D6 27
#define LCD_D7 29


/* Create an instance of the LCD library. */
LiquidCrystal lcd(LCD_RS, LCD_EN, LCD_D4, LCD_D5, LCD_D6, LCD_D7);

/* Create an instance of the SD card library */
File SDFileData;


void setup() 
{
  /* Initialise the LCD */
  lcd.begin(20, 4);
  
  /* Configure the pins used to read the status of the panel dial 
     and buttons */
  pinMode(BUZZER_DIO, OUTPUT);    
  pinMode(BUTTON_DIO, INPUT);   
  digitalWrite(BUTTON_DIO, HIGH); 
  pinMode(RESET_DIO, INPUT);   
  digitalWrite(RESET_DIO, HIGH); 
  pinMode(ROT_EN_A,INPUT);
  pinMode(ROT_EN_B,INPUT);
  digitalWrite(ROT_EN_A, HIGH);
  digitalWrite(ROT_EN_B, HIGH);
}


/* Main program loop */
void loop() 
{
  /* Output the test message to the LCD */
  lcd.setCursor(2,0); 
  lcd.print("HOBBY COMPONENTS");
  lcd.setCursor(2,1); 
  lcd.print("RAMPS LCD PANEL");
  lcd.setCursor(4,2); 
  lcd.print("HC3DPR0005");
  lcd.setCursor(8,3); 
  lcd.print("TEST");
  
  /* Wait 4 seconds */
  delay(4000);
 
  /* Buzzer test */
  BuzzerCheck();
  
  /* SD card read test */
  SDCardCheck();
  delay(4000);
  
  /* Control check */
  ControlCheck();
  delay(4000);
  
  /* All done! */
  lcd.clear();
  lcd.setCursor(3,1); 
  lcd.print("TEST COMPLETE");
  
  while(1);
}

/* Test the buzzer by beeping twice */
void BuzzerCheck(void)
{
  lcd.clear();
  lcd.setCursor(4,1); 
  lcd.print("BUZZER CHECK");
  
  digitalWrite(BUZZER_DIO, HIGH);
  delay(300);
  digitalWrite(BUZZER_DIO, LOW);
  delay(300); 
  digitalWrite(BUZZER_DIO, HIGH);
  delay(300);
  digitalWrite(BUZZER_DIO, LOW); 
}

/* Test the SD card by reading the contents of a file named test.txt */
void SDCardCheck(void)
{
  byte index;
  char SDCardText[]= "                    ";
  
  /* Display new test */
  lcd.clear();
  lcd.setCursor(3,0); 
  lcd.print("SD CARD CHECK");
  lcd.setCursor(0,1); 
  lcd.print("Initiliasing.."); 
  
  /* Initialise the SD card */
  if (!SD.begin(SD_CARD_CD_DIO)) 
  {
    /* If there was an error output this to the LCD */
    lcd.setCursor(14,1); 
    lcd.print("ERROR!"); 
    lcd.setCursor(0,3); 
    lcd.print("SD Card not detected");
  }else
  {
    lcd.setCursor(14,1); 
    lcd.print("OK! ");
  }
  
 
   /* Check if the text file exists */
   if(SD.exists("test.txt"))
   {
     lcd.setCursor(0,2); 
     lcd.print("test.txt contents:");

     /* The file exists so open it */
     SDFileData = SD.open("test.txt");
     
     /* Sequentially read the data from the file and store the first 20 characters */
     for (index = 0; index < 20; index++)
     {
       if (SDFileData.available())
         SDCardText[index] = SDFileData.read();
     }
     
     /* Display the contents on the LCD */
     lcd.setCursor(0,3); 
     lcd.print(SDCardText);
  
   }else
   {
     lcd.setCursor(0,2); 
     lcd.print("test.txt missing");   
   }
   
   /* Close the file */
   SDFileData.close();  
}

/* Check the dial and push buttons */
void ControlCheck(void)
{
  byte DialPos = 0;
  byte Last_DialPos = 0;
  byte DialCount = 0;
  
  /* Display new test */
  lcd.clear();
  lcd.setCursor(3,0); 
  lcd.print("CONTROL CHECK");
 
  /* Prompt the user to press the dial */
  lcd.setCursor(0,2); 
  lcd.print("Press dial:");
  
  /* Wait for the dial to be pressed */
  while(digitalRead(BUTTON_DIO));
  
  lcd.setCursor(12,2); 
  lcd.print("PASS"); 
  
  delay(4000);

  /* Prompt the user to press the button marked reset */  
  lcd.setCursor(0,2); 
  lcd.print("Press reset btn:    ");
  
  /* Wait for button to be pressed */
  while(digitalRead(RESET_DIO));
  
  lcd.setCursor(16,2); 
  lcd.print("PASS"); 
  
  delay(4000);
 
  /* Prompt the user to turn the dial clockwise by 10 positions */ 
  lcd.setCursor(0,2); 
  lcd.print("Rotate Dial CW:     ");

  /* Run this loop until the dial is turned 10 positions */
  while(DialCount <= 9)
  {
    /* Read the status of the dial */
    DialPos = (digitalRead(ROT_EN_B) << 1) | digitalRead(ROT_EN_A);
  
    /* Is the dial being turned clockwise ? */
    if (DialPos == 3 && Last_DialPos == 1)
    {
      /* If so increase the dial counter and display it */
      DialCount++;
      lcd.setCursor(16,2); 
      lcd.print(DialCount);
    }
  
    /* If the dial counter reaches a value of 10 then the test has passed */
    if (DialCount >= 10)
    {
      lcd.setCursor(16,2); 
      lcd.print("PASS");
    } 
    /* Remember the last position of the dial so we know when it has changed */
    Last_DialPos = DialPos;
  }

  delay(4000);
  DialCount = 10;
  lcd.setCursor(0,2); 
  
  /* Now instruct the user to rotate the dial counter-clockwise */
  lcd.print("Rotate Dial CCW:    ");
  
  /* Run this loop until the dial is turned 10 positions */
  while(DialCount)
  {
    /* Read the status of the dial */
    DialPos = (digitalRead(ROT_EN_B) << 1) | digitalRead(ROT_EN_A);
  
    /* Is the dial being turned counter-clockwise ? */
    if (DialPos == 3 && Last_DialPos == 2)
    {
      /* If so decrease the dial counter and display it */
      DialCount--;
      lcd.setCursor(17,2); 
      lcd.print(DialCount);
    }
  
    /* If the dial counter reaches a value of 0 then the test has passed */
    if (DialCount == 0)
    {
      lcd.setCursor(16,2); 
      lcd.print("PASS");
    } 
  
    /* Remember the last position of the dial so we know when it has changed */
    Last_DialPos = DialPos;
  }
}


FAQ:

How do I configure the Marlin firmware to use this panel?
In the Configuration.h file find the following line:

Code: Select all

//LCD and SD support
//#define ULTRA_LCD
and change to:

Code: Select all

//LCD and SD support
#define ULTRA_LCD
Then find the following lines:

Code: Select all

  #ifdef ULTRA_LCD
  #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
    #define LCD_WIDTH 20
    #define LCD_HEIGHT 5
  #else
    #define LCD_WIDTH 16
    #define LCD_HEIGHT 2
and change the last two lines to:

Code: Select all

    #define LCD_WIDTH 20
    #define LCD_HEIGHT 4
Remember to select the correct motherboard also in this file otherwise you won't see anything on the display! E.g. if using with a mega and our RAMPS 1.4 shield find the following line:

Code: Select all

#define MOTHERBOARD 7
and change it to:

Code: Select all

#define MOTHERBOARD 33
You do not have the required permissions to view the files attached to this post.

jonnblanchard
Posts: 1
Joined: Wed Jul 30, 2014 3:52 pm

Re: RAMPS compatible LCD controller module (HC3DPR0005)

Post by jonnblanchard » Wed Jul 30, 2014 3:57 pm

I've got the display working but I can't seem to get the encoder working in Marlin - i've defined the board as a NEWPANEL and set the following up in Pins.h:

#define BTN_EN1 31
#define BTN_EN2 33
#define BTN_ENC 35

When the board first boots I can use the encoder to change the flow rate, however, if I then push the encoder button to enter the menu the encoder no longer works, although I can still switch in and out of the menu with the button

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: RAMPS compatible LCD controller module (HC3DPR0005)

Post by andrew » Thu Jul 31, 2014 7:06 am

I've taken a closer look at the Marlin firmware and it looks to me like the RepRap discount smart controller has the correct settings. With a default copy of the firmware can you uncomment the following line in the Configuaration.h file:

#define REPRAP_DISCOUNT_SMART_CONTROLLER

I can't confirm this fully works right now because we don't currently have one hooked up to a Marlin printer but I can navigate the menu's OK. If you can let me know if it has solved your problem I'll update the FAQ.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

ThierryM
Posts: 9
Joined: Sun Jan 04, 2015 2:47 pm
Location: France

Re: RAMPS compatible LCD controller module (HC3DPR0005)

Post by ThierryM » Mon Jan 05, 2015 12:29 am

Hi,
I use this module for my Reprap Prusa under Marlin. All is working well except the SD card reader. The card is detected physicaly (card detected) but it can't be read.
I've tried 2 different SD Cards (2 Go Transcend and 16 Go Sandisk) but both aren't working. I think it's not these cards because I can read them with my other LCD controller (Full Graphic Smart Controller).
When I use your Arduino Sketch, I've the same problem (no test.txt file found).
I've found this forum topic : http://forums.reprap.org/read.php?146,238858 where the same problem is described but the solutions haven't worked for me.
Thanks for your help,
Regards,

Thierry
Reprap Prusa V2 + Ramps 1.4 + Marlin with autoleveling bed

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: RAMPS compatible LCD controller module (HC3DPR0005)

Post by andrew » Mon Jan 05, 2015 10:48 am

If the example sketch in the first post isn't working then its likely that its either a problem with the panel or a connection issue. Do you have this connected via a RAMPS shield?
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

ThierryM
Posts: 9
Joined: Sun Jan 04, 2015 2:47 pm
Location: France

Re: RAMPS compatible LCD controller module (HC3DPR0005)

Post by ThierryM » Mon Jan 05, 2015 12:34 pm

Hi,
Thanks for your reply.
Yes it's a connected to a Ramps 1.4 shield with a Taurino Power from RepRapDiscount working under 24V.
I'll install your module with my other Ramps 1.4 and Taurino Classic (currently it's a configuration with a Full Graphic Smart LED Controller and its SD Card reader working) and I'll give you a feedback.
Regards,

Thierry
Reprap Prusa V2 + Ramps 1.4 + Marlin with autoleveling bed

ThierryM
Posts: 9
Joined: Sun Jan 04, 2015 2:47 pm
Location: France

Re: RAMPS compatible LCD controller module (HC3DPR0005)

Post by ThierryM » Mon Jan 05, 2015 8:35 pm

Hi, I've tested this module with an other Ramps 1.4 under 12V and the problem is the same : the card is physically detected but the reading is impossible.
Regards,

Thierry
Reprap Prusa V2 + Ramps 1.4 + Marlin with autoleveling bed

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: RAMPS compatible LCD controller module (HC3DPR0005)

Post by andrew » Tue Jan 06, 2015 9:50 am

Ok, I believe on this panel the software detects the card using a separate pin (D53) to the SPI interface and so the problem must relate to the a connection issue with one of the MOSI, MISO, SCK or 5V/GND connections. If you have a test meter you could try checking the continuity of these connections (especially the ribbon cable). It is a bit awkward to do on this however because each connection has to pass through several different boards and connections. One other thing may be worth doing is reformatting your cards just in case there is something odd about the way they are formatted although this is grasping at straws. Failing this I think we will be looking at returning it I'm afraid.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

ThierryM
Posts: 9
Joined: Sun Jan 04, 2015 2:47 pm
Location: France

Re: RAMPS compatible LCD controller module (HC3DPR0005)

Post by ThierryM » Tue Jan 06, 2015 11:44 am

Hi,
I've reformatted the card in differents formats (Fat16 & Fat32) but the problem is always present. Besides my other LCD controller can read it.
I've an other ribbon câble (working with my Full Graphic LCD controller) and I'll test with it to see if the connections are correct.
Regards,

Thierry
Reprap Prusa V2 + Ramps 1.4 + Marlin with autoleveling bed

ThierryM
Posts: 9
Joined: Sun Jan 04, 2015 2:47 pm
Location: France

Re: RAMPS compatible LCD controller module (HC3DPR0005)

Post by ThierryM » Fri Jan 09, 2015 8:34 pm

Hi,
No problem with the ribbon cables. I can't test with my other jonction board with the Ramps (no same pluggin directions) but with my multimeter I didn't detect any anomaly on it.
Regards,

Thierry
Reprap Prusa V2 + Ramps 1.4 + Marlin with autoleveling bed

Post Reply

Return to “3D Printing / CNC”