Welcome! Log In Create A New Profile

Advanced

Using the full graphic smart controller outside of 3d printing, without the RAMPS board

Posted by dailafing 
Using the full graphic smart controller outside of 3d printing, without the RAMPS board
December 18, 2014 03:41PM
I'd like to find out the correct pins to use for the u8g library, so that I can use my display, buzzer and encoder in other Arduino Sketches....

I understand the programming aspect, but I'm really strugeling to know:

"Which of my pins are (sck, mosi, cs [, reset]) or more specifically, (E, RW, RS, RST)?

I've been looking through the Marlin firmware to try and find where the pins get assigned, but with so far no luck because I'm pretty new to Arduino.

I'm hoping someone can simply tell me......

Your constructor should look like: "U8GLIB_ST7920_128X64_1X u8g(17, 23, 50, 16);"

Or whatever the numbers should be for my setup...

My current setup is working with the Marlin firmware, but with the Ramps board removed....
I'm currently pluged into:
  • TX2 16
  • RX2 17
  • Digital 23
  • 5v
  • Ground
And I have my Buzzer and Encoder Click in Digital 35 & 37

But what each line to 16, 17 and 23 is I dont know.... More confusingly, I tried them in all arrangements in my constructor declaration, but I'm still not getting a Hello World...

My code is included, just in case someone spots a bug...

#include "U8glib.h"
#include 

//Pins to try:
  //16, 17, 23
  //U8GLIB_DOGM128(cs, a0 [, reset])
//U8GLIB_NHD27OLED_2X_BW u8g(16, 17, 23);
U8GLIB_ST7920_128X64_1X u8g(17, 23, 16);

void setup()
{
}

void loop()
{
  // picture loop
  u8g.firstPage();  
  do {
    draw();
  } while( u8g.nextPage() );
  
  // rebuild the picture after some delay
  delay(1000);
}

void draw(void) {
  // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  u8g.drawStr( 0, 20, "Hello World!");
}
Re: Using the full graphic smart controller outside of 3d printing, without the RAMPS board
December 18, 2014 07:16PM
I've used 12864 displays, but not with u8glib. According to [mssystems.emscom.net], the pin numbers you pass to u8glib need to be connected to the EN, RW and RS pins of the 12864 display in that order. You also need to put the display into serial mode by grounding the PSB pin, and you need to connect the RST pin to +5V unless you are driving it from another pin on the Mega.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Hi there dc42, I think those pins are already in the correct place since I traced each pin from the ramps board so that I could just connect directly to the Arduino.
My theory being; If I can view the marlin firmware on the LCD, then I know my wires re in the right place as far as Marlin is concerned...
So If I knew which pins Marlin uses to talk to the LCD, then I'd know what to send to u8glib...

Aside from that, do you have any recommendation for which library I should use?
My intention is to have a menu system navigated with the said Encoder, and then to have 240v relays switch on and off...
So if you have an alternative solution for my project, please leave me some information...

Thank you
Re: Using the full graphic smart controller outside of 3d printing, without the RAMPS board
December 21, 2014 03:52PM
If you want to get advice on using these displays with u8glib, then I suggest you head over to the Displays section of the Arduino forum, [forum.arduino.cc]. If you want to try my library, it's at [github.com] along with a sample sketch. If you go up a level, you can find my rotary encoder library for Arduino as well.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Sorry, only registered users may post in this forum.

Click here to login