Welcome! Log In Create A New Profile

Advanced

megatronics v2.0 with lcd and keypad from reprapworld

Posted by bartch 
megatronics v2.0 with lcd and keypad from reprapworld
June 18, 2013 07:45AM
Hi all,
for my prusa i3 i want to setup a display and seperate keypad (both from reprapworld) for anonymous printing.
I just can't get it to work. Does somebody has this working and is willing to share the proper settings for the firmware please? I use the latest Repetier firmware and i have a megatronics v2.0
The lcd is this one: lcd reprapworld and the keypad this one: Keypad reprapworld

I don't even know if this is i2c or not..(i actually have no clue what i2c is smiling smiley

Thanks in advance,
Greetings
Bart
Re: megatronics v2.0 with lcd and keypad from reprapworld
June 18, 2013 12:23PM
The keypad does not work. It uses a shifter to handle the pins, which is not supported in the firmware.

The display is a plain lcd display. You simply need to wire it as any other pure lcd and add a poti for contrast. Check for older posts in the repetier forum for examples on how to do the wiring. Then simply set the pins in the firmware, where you connected the corresponding pins from the display, that's all.


Repetier-Software - the home of Repetier-Host (Windows, Linux and Mac OS X) and Repetier-Firmware.
Repetier-Server - the solution to control your printer from everywhere.
Visit us on Facebook and Twitter!
Re: megatronics v2.0 with lcd and keypad from reprapworld
June 19, 2013 09:03AM
Can't help with keypad, but we use LCD with MT2 with no problems (NOW...has been quite a bumpy road making it work).

We changed uiconfig.h as following:

/**
Define the pin
*/
#if UI_DISPLAY_TYPE==3 // I2C Pin configuration
#else // Direct display connections
#define UI_DISPLAY_RS_PIN 14 // PINK.1, 88, D_RS
#define UI_DISPLAY_RW_PIN -1
#define UI_DISPLAY_ENABLE_PIN 15 // PINK.3, 86, D_E
#define UI_DISPLAY_D0_PIN -1 // PINF.5, 92, D_D4
#define UI_DISPLAY_D1_PIN -1 // PINK.2, 87, D_D5
#define UI_DISPLAY_D2_PIN -1 // PINL.5, 40, D_D6
#define UI_DISPLAY_D3_PIN -1 // PINK.4, 85, D_D7
#define UI_DISPLAY_D4_PIN 30 // PINF.5, 92, D_D4
#define UI_DISPLAY_D5_PIN 31 // PINK.2, 87, D_D5
#define UI_DISPLAY_D6_PIN 32 // PINL.5, 40, D_D6
#define UI_DISPLAY_D7_PIN 33 // PINK.4, 85, D_D7
#define UI_DELAYPERCHAR 320


And PINS.H is

/****************************************************************************************
* MegaTronics v2.0
*
****************************************************************************************/
#if MOTHERBOARD == 701
#define KNOWN_BOARD 1


#ifndef __AVR_ATmega2560__
#error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
#endif


#define X_STEP_PIN 26
#define X_DIR_PIN 27
#define X_ENABLE_PIN 25
#define X_MIN_PIN 37
#define X_MAX_PIN 40

#define Y_STEP_PIN 4
#define Y_DIR_PIN 54
#define Y_ENABLE_PIN 5
#define Y_MIN_PIN 41
#define Y_MAX_PIN 38

#define Z_STEP_PIN 56
#define Z_DIR_PIN 60
#define Z_ENABLE_PIN 55
#define Z_MIN_PIN 18
#define Z_MAX_PIN 19

#define E0_STEP_PIN 35
#define E0_DIR_PIN 36
#define E0_ENABLE_PIN 34

#define E1_STEP_PIN 29
#define E1_DIR_PIN 39
#define E1_ENABLE_PIN 28

#define E2_STEP_PIN 23
#define E2_DIR_PIN 24
#define E2_ENABLE_PIN 22

#define SDCARDDETECT -1 // Ramps does not use this port
#define SDPOWER -1
#define SDSS 53

#define LED_PIN 13


#define PS_ON_PIN 12
#define KILL_PIN -1



By the way, contrast is set with a potentiomenter on MT2 board , near the LCD socket.

HTH!
Davide

Edited 1 time(s). Last edit at 06/19/2013 09:04AM by 3ntrlab.


==============================
no toys here...sorry
Re: megatronics v2.0 with lcd and keypad from reprapworld
June 20, 2013 05:16AM
Thank you all for your answers..
Do you think the Repetier firmware will support such a keypad in the near future?? I really hope so, i don't want to go back to Marlin smiling smiley
Re: megatronics v2.0 with lcd and keypad from reprapworld
June 20, 2013 05:25AM
If someone submits a driver or if I get a sample I would include it:-) If I had a tester I could also try it blindly and the tester could verify it. That would only happen in the new development tree, but that tree is already stable, so no real problem.


Repetier-Software - the home of Repetier-Host (Windows, Linux and Mac OS X) and Repetier-Firmware.
Repetier-Server - the solution to control your printer from everywhere.
Visit us on Facebook and Twitter!
Re: megatronics v2.0 with lcd and keypad from reprapworld
June 20, 2013 05:33AM
Why don't you settle for a pushbutton+encoder ? Seems that it's the standard now...
Bye
Davide


==============================
no toys here...sorry
Re: megatronics v2.0 with lcd and keypad from reprapworld
June 25, 2013 02:44PM
I did create a test sketch for the keypad. Don't know if someone can work it out into a repetier patch, but maybe it's useful.




reprapworld.com
PLA, ABS, PETG multiple colors (3 and 1.75 mm) €16,49 / kg
Megatronics 3.0 €79.99 / Minitronics €37,19
Attachments:
open | download - keypadtest.ino (1.8 KB)
Re: megatronics v2.0 with lcd and keypad from reprapworld
June 26, 2013 03:17PM
Hi Repetier, do you think you can do something with the sketch file thatcher Brupje has sent?
Greetings
Bart
Re: megatronics v2.0 with lcd and keypad from reprapworld
June 26, 2013 04:20PM
Yes, if that code works I should be able to make a key reader from it. I hope you will tests it when finished. May take a few days as I'm currently having multiple firmware patches to include.


Repetier-Software - the home of Repetier-Host (Windows, Linux and Mac OS X) and Repetier-Firmware.
Repetier-Server - the solution to control your printer from everywhere.
Visit us on Facebook and Twitter!
Re: megatronics v2.0 with lcd and keypad from reprapworld
July 04, 2013 10:30AM
Hi Repetier,

I have a ReprapWorld-Keypad V1.0, so I would be your "tester" if you will implement the code.

My Configuration:

ORD Bot Hadron
RAMPS 1.4, Arduino Mega 2560
ReprapWorld Keypad
a simple LCD 20x2
Re: megatronics v2.0 with lcd and keypad from reprapworld
July 04, 2013 10:39AM
Ok, I come back to it when I have implemented it. Currently I have other more urgent problems to solve. But I try not to forget it.


Repetier-Software - the home of Repetier-Host (Windows, Linux and Mac OS X) and Repetier-Firmware.
Repetier-Server - the solution to control your printer from everywhere.
Visit us on Facebook and Twitter!
Re: megatronics v2.0 with lcd and keypad from reprapworld
July 05, 2013 05:10AM
How to connect/configure the ReprapWorld LCD with RAMPS 1.4:

1. Connect the LCD as described here: RAMPS LCD
2. Definitions in Configuration.h
#define FEATURE_CONTROLLER 1

3. Definitions in uiconfig.h:
#define UI_DISPLAY_CHARSET 0
...
#define UI_DISPLAY_TYPE 1
...
#define UI_COLS 20
...
#define UI_ROWS 2 // or 4

...
#else // Direct display connections
#define UI_DISPLAY_RS_PIN		16		// PINK.1, 88, D_RS
#define UI_DISPLAY_RW_PIN		-1
#define UI_DISPLAY_ENABLE_PIN           17		// PINK.3, 86, D_E
// not used #define UI_DISPLAY_D0_PIN		59		// PINF.5, 92, D_D4
// not used #define UI_DISPLAY_D1_PIN		64		// PINK.2, 87, D_D5
// not used #define UI_DISPLAY_D2_PIN		44		// PINL.5, 40, D_D6
// not used #define UI_DISPLAY_D3_PIN		66		// PINK.4, 85, D_D7
#define UI_DISPLAY_D4_PIN		23		// PINF.5, 92, D_D4
#define UI_DISPLAY_D5_PIN		25		// PINK.2, 87, D_D5
#define UI_DISPLAY_D6_PIN		27		// PINL.5, 40, D_D6
#define UI_DISPLAY_D7_PIN		29		// PINK.4, 85, D_D7


Edited 4 time(s). Last edit at 07/06/2013 09:04PM by flurin.
Attachments:
open | download - LCD202.JPG (35.3 KB)
Re: megatronics v2.0 with lcd and keypad from reprapworld
July 05, 2013 11:42AM
Hi Repetier,

I decided to clone your Repetier-Firmware and to add some code for the ReprapWorld Keypad and LCD.
So far I've tested the LCD and the Keypad encoder.

Repetier-Firmware Clone

Edited 1 time(s). Last edit at 07/07/2013 11:35AM by flurin.
Re: megatronics v2.0 with lcd and keypad from reprapworld
July 05, 2013 12:02PM
Looks good so far. It should be easy to use the above code from brupje to add the other keys into

ui_check_slow_keys(int &action) {}

When you are finished and the code is tested, let me know and I copy it into the 0.90 development version.


Repetier-Software - the home of Repetier-Host (Windows, Linux and Mac OS X) and Repetier-Firmware.
Repetier-Server - the solution to control your printer from everywhere.
Visit us on Facebook and Twitter!
Re: megatronics v2.0 with lcd and keypad from reprapworld
July 05, 2013 05:22PM
I've uploaded the latest Implementation (ui.h).
The Keypad button actions are added and tested with the RAMPS 1.4.
The Megatronics v2.0 has different pin numbers, I could add it but I can't test the code.
Re: megatronics v2.0 with lcd and keypad from reprapworld
July 11, 2013 06:00PM
Hi all,
thx again for all the effort! I did a quick test today on my megatronics with this new settings.

The LCD is working, however the keypad not. If i turn the knob, the z-azis starts to go up and won't stop! The buttons don't work at all. Unfortunately i don't have much time to test much more and play with the settings..Could it be a bad cable-connection/solder?

Could you please verify if i followed the right steps:
in Configuration.h i add the following line:
#define FEATURE_CONTROLLER 1

in uiconfig.h i change this:

#define UI_DISPLAY_CHARSET 0
...
#define UI_DISPLAY_TYPE 1
...
#define UI_COLS 20
...
#define UI_ROWS 2 // or 4

...
#else // Direct display connections
#define UI_DISPLAY_RS_PIN 14 // PINK.1, 88, D_RS
#define UI_DISPLAY_RW_PIN -1
#define UI_DISPLAY_ENABLE_PIN 15 // PINK.3, 86, D_E
// not used #define UI_DISPLAY_D0_PIN -1 // PINF.5, 92, D_D4
// not used #define UI_DISPLAY_D1_PIN -1 // PINK.2, 87, D_D5
// not used #define UI_DISPLAY_D2_PIN -1 // PINL.5, 40, D_D6
// not used #define UI_DISPLAY_D3_PIN -1 // PINK.4, 85, D_D7
#define UI_DISPLAY_D4_PIN 30 // PINF.5, 92, D_D4
#define UI_DISPLAY_D5_PIN 31 // PINK.2, 87, D_D5
#define UI_DISPLAY_D6_PIN 32 // PINL.5, 40, D_D6
#define UI_DISPLAY_D7_PIN 33 // PINK.4, 85, D_D7

(I CHANGED THE PIN-SETTINGS ACCORDING TO PINS.H FROM MY MEGATRONICS V2.0)

and finally i added this lines in my UI.h that flurin changed in his ui.h
(without the +character of course.., and i think the Define UI-ROWS 2 should be 4 instead of 2, am i correct?)

+#if FEATURE_CONTROLLER==6 // ReprapWorld Keypad / LCD
+#define UI_HAS_KEYS 1
+#define UI_HAS_BACK_KEY 0
+#define UI_DISPLAY_TYPE 1
+#define UI_DISPLAY_CHARSET 0
+#define UI_COLS 20
+#define UI_ROWS 2 (SHOULDN'T THIS BE 4 FOR THE REPRAPWORLD DISPLAY??)
+
+#if MOTHERBOARD==701 // Megatronics v2.0
+#define UI_DISPLAY_RS_PIN 14
+#define UI_DISPLAY_RW_PIN -1
+#define UI_DISPLAY_ENABLE_PIN 15
+#define UI_DISPLAY_D4_PIN 30
+#define UI_DISPLAY_D5_PIN 31
+#define UI_DISPLAY_D6_PIN 32
+#define UI_DISPLAY_D7_PIN 33
+#define UI_ENCODER_A 61
+#define UI_ENCODER_B 59
+#define UI_ENCODER_CLICK 43
+
+#define UI_SHIFT_OUT 17
+#define UI_SHIFT_LD 42
+#define UI_SHIFT_CLK 63
+
+#else // RAMPS 1.4
+#define UI_DISPLAY_RS_PIN 16
+#define UI_DISPLAY_RW_PIN -1
+#define UI_DISPLAY_ENABLE_PIN 17
+#define UI_DISPLAY_D4_PIN 23
+#define UI_DISPLAY_D5_PIN 25
+#define UI_DISPLAY_D6_PIN 27
+#define UI_DISPLAY_D7_PIN 29
+#define UI_ENCODER_A 64
+#define UI_ENCODER_B 59
+#define UI_ENCODER_CLICK 63
+
+#define UI_SHIFT_OUT 40
+#define UI_SHIFT_LD 42
+#define UI_SHIFT_CLK 44
+#endif
+
+#define UI_DELAYPERCHAR 320
+#define UI_INVERT_MENU_DIRECTION true
+#ifdef UI_MAIN
+void ui_init_keys() {
+ UI_KEYS_INIT_CLICKENCODER_LOW(UI_ENCODER_A,UI_ENCODER_cool smiley;
+ UI_KEYS_INIT_BUTTON_LOW(UI_ENCODER_CLICK);
+
+ SET_OUTPUT(UI_SHIFT_CLK);
+ SET_OUTPUT(UI_SHIFT_LD);
+ SET_INPUT(UI_SHIFT_OUT);
+
+ WRITE(UI_SHIFT_OUT,HIGH);
+ WRITE(UI_SHIFT_LD,HIGH);
+}
+
+void ui_check_keys(int &action) {
+ UI_KEYS_CLICKENCODER_LOW_REV(UI_ENCODER_A,UI_ENCODER_cool smiley;
+ UI_KEYS_BUTTON_LOW(UI_ENCODER_CLICK,UI_ACTION_OK);
+}
+
+inline void ui_check_slow_encoder() {} // not used
+
+void ui_check_slow_keys(int &action) {
+
+ WRITE(UI_SHIFT_LD,LOW);
+ WRITE(UI_SHIFT_LD,HIGH);
+
+ for(int8_t i=1;i<=8;i++) {
+ if(!READ(UI_SHIFT_OUT)) { // pressed button = logical 0 (false)
+ switch (i) {
+ case 1: action = UI_ACTION_Z_DOWN; break; // F3
+ case 2: action = UI_ACTION_Z_UP; break; // F2
+ case 3: action = UI_ACTION_EMERGENCY_STOP; break; // F1
+ case 4: action = UI_ACTION_Y_UP; break; // UP
+ case 5: action = UI_ACTION_X_UP; break; // RIGHT
+ case 6: action = UI_ACTION_HOME_ALL; break; // MID
+ case 7: action = UI_ACTION_Y_DOWN; break; // DOWN
+ case 8: action = UI_ACTION_X_DOWN; break; // LEFT
+ }
+ i = 9; // if button detected, exit "for loop"
+ }
+ WRITE(UI_SHIFT_CLK,HIGH);
+ WRITE(UI_SHIFT_CLK,LOW);
+ }
+}
+#endif
+#endif // Controller 6

am i forgetting something?

Grtz,
Bart
Re: megatronics v2.0 with lcd and keypad from reprapworld
July 12, 2013 01:17AM
@bartch

The settings above "How to connect/configure the ReprapWorld LCD with RAMPS 1.4: " are only for testing the LCD.
You don't need them if you set FEUTURE_CONTROLLER to 6 in Configuration.h

6 = ReprapWorld Keypad / LCD
*/
#define FEATURE_CONTROLLER 6

Your settings in ui.h are correct, in your case set UI_ROWS to 4
#define UI_ROWS 4

There are two LCD-Types, the old one has 2 rows, the new one 4.

I sent a "Pull Request" for the Version 0.90alpha to Repetier. It's pending.
However the settings (Configuration.h + ui.h) for the FEUTURE_CONTROLLER 6 works also with Version 0.83 if you add the code manually.

Edited 2 time(s). Last edit at 07/12/2013 01:26AM by flurin.
Re: megatronics v2.0 with lcd and keypad from reprapworld
July 21, 2013 06:56AM
Update:

Repetier-Firmware 0.90alpha includes now the Feutures-Controller 6 for ReprapWorld Keypad and LCD.

Repetier-Firmware 0.83 can be extended using this GitHub Gist:

Repetier-FW-083-Extension
Re: megatronics v2.0 with lcd and keypad from reprapworld
July 29, 2013 11:28AM
Update:

Test with Keypad and LCD (20x4), Repetier-Firmware 0.90alpha

Keypad_LCD_20x4
Attachments:
open | download - KeypadLCD.JPG (463.6 KB)
Re: megatronics v2.0 with lcd and keypad from reprapworld
November 22, 2013 01:40AM
I am trying to connect a LCD and keypad to my megatronics V2.0
When I add the gist above to my 0.83 firmware, I get the following error when compiling:

In file included from ui.cpp:23:
/ui.h: In function 'void ui_init_keys()':
ui.h:822: error: redefinition of 'void ui_init_keys()'
ui.h:822: error: 'void ui_init_keys()' previously defined here
/ui.h: In function 'void ui_check_keys(int&)':
ui.h:834: error: redefinition of 'void ui_check_keys(int&)'
ui.h:834: error: 'void ui_check_keys(int&)' previously defined here
/ui.h: In function 'void ui_check_slow_encoder()':
ui.h:839: error: redefinition of 'void ui_check_slow_encoder()'
ui.h:839: error: 'void ui_check_slow_encoder()' previously defined here
/ui.h: In function 'void ui_check_slow_keys(int&)':
ui.h:841: error: redefinition of 'void ui_check_slow_keys(int&)'
ui.h:841: error: 'void ui_check_slow_keys(int&)' previously defined here


Any suggestions?
Thanks
Roger
Re: megatronics v2.0 with lcd and keypad from reprapworld
November 22, 2013 03:55AM
@Roger

You should insert the snippet in the file "ui.h" after #endif // Controller 5 (and before #if FEATURE_CONTOLLER>0)


see -> keypad-and-lcd-add-on



3D Printing :: bit-by-bit - Thingiverse
Re: megatronics v2.0 with lcd and keypad from reprapworld
November 22, 2013 09:29AM
Thanks for your help Flurin. It compiled and loaded without an error. I now have a functioning keypad but the LCD just lights up as it has always done. Hopefully it is just a wiring error.
Re: megatronics v2.0 with lcd and keypad from reprapworld
November 22, 2013 10:08AM
Got the LCD working now - I just had to adjust the trimpot
Sorry, only registered users may post in this forum.

Click here to login