Melzi V2.0 with LCD2004 and 5 keys

Hello there,
about 4 weeks ago I bought my first 3D printer. Through a silly mishap I shot up my first Melzi Board. I had requested the firmware by the seller, but unfortunately he is not willing to cooperate with me.

My self-configured "firmware" is now already at a good level, but I do not get to run the display.

 Here is my hardware configuration as it has already worked with the firmware from the delivery status.

RepRap Melzi V2.0

With this one LCD.... LCD2004A
image

Pin connections:






























Display

Atmega1284P

 E

35

 RS

34

 D4

11

 D5

12

 D6

19

 D7

20



The 5 Keys are connected at Analog Input Pin 36































Key

Resistor

 UP

 3,2 kO

 LEFT

 2,8 kO

 RIGHT

 3,3 kO

 DOWN

 2,9 kO

 MIDDLE

 3,0 kO

 No Key pushed

 4,7 kO



I hope someone can help me with the configuration.

Thank You!

Jan
«1

Comments

  • For display you can use custom config with the pins set.

    Keys will not work, because we do not support analog keys over resistance.
  • Hmmm,
    but it worked already with this keys....

    Which display you would recommend to the Board?
    I would not buy one that is not working with the Board.

    Thank you very much!
  • I guess you had marlin stalled which may support this kind of interface.

    I'm not a Melzi user so I can not say what works best. I guess with personal config you could get all to work but maybe some have matching connectors. Hopefully sone Melzi user can give you some hints.
  • edited September 2015 Posts: 6
    Hello there,
    Unfortunately, my display is still not working.

    But I have taken a first step to test the display at all.
    With the Liquid Crystal Library for Arduino it works.


    Here's the code (It's the example Code from Arduino):


    // include the library code:
    #include <LiquidCrystal.h>

    // initialize the library with the numbers of the interface pins
    // RS, E, D4, D5, D6, D7
    LiquidCrystal lcd(28, 29, 10, 11, 16, 17);

    void setup()
     {
      // set up the LCD's number of columns and rows:
      lcd.begin(20, 4);
      // Print a message to the LCD.
      lcd.print("hello, world!");
    }

    void loop()
    {
    }



    In configuration.h i have put it on 1
    #define FEATURE_CONTROLLER 1

    And
    here is the code from the firmware.
    uiconfig.
    h

        This file is part of Repetier-Firmware.

        Repetier-Firmware is free software: you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.

        Repetier-Firmware is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with Repetier-Firmware.  If not, see <http://www.gnu.org/licenses/>.

    */

    /* ===================== IMPORTANT ========================

    The LCD and Key support is new. I tested everything as good as possible,
    but some combinations may not work as supposed.
    The I2C methods rely on a stable I2C connection. Noise may cause wrong signals
    which can cause the firmware to freeze.

    The ui adds quite some code, so AVRs with 64kB ram (Sanguino, Gen6) can not handle all features
    of the firmware at the same time. You have to disable some features to gain the
    ram needed. What should work:
    - No sd card - the sd card code is quite large.
    - No keys attached - The longest part is the menu handling.
    - EEPROM_MODE 0 .

    Currently supported hardware:

    *** Displays ***

    - direct connected lcd with 4 data lines
    - connected via i2c

    *** Keys ***

    - rotary encoder
    - push button
    - key matrix up to 4x4
    - rotary encoder via i2c (only slow turns are captured correct)
    - push button via i2c

    *** Buzzer ***

    - directly connected, high = on
    - connected via i2c, low = on

    ==============================================================*/

    #ifndef _ui_config_h
    #define _ui_config_h

    /** While the ascii chars are all the same, the driver have different charsets
    for special chars used in different countries. The charset allows to fix for
    this problem. If characters look wrong, try a different charset. If nothing
    works, use the ascii charset 0 as fallback. Not the nicest for everything but working!

    0 = ASCII fallback
    1 = Default works on most displays. This has some japanese chars in charset
    2 = Alternative charset with more european chars

    */
    #define UI_DISPLAY_CHARSET 1

    /** Select type of beeper
    0 = none
    1 = Piezo connected to pin
    2 = Piezo connected to a pin over I2C
    */
    #ifndef BEEPER_TYPE
    #define BEEPER_TYPE 0
    #define BEEPER_TYPE_INVERTING false
    #endif

    #if BEEPER_TYPE==1 && !defined(BEEPER_PIN)
    #define BEEPER_PIN 37
    #endif
    #if BEEPER_TYPE==2
    #define BEEPER_ADDRESS 0x40 // I2C address of the chip with the beeper pin
    #define BEEPER_PIN _BV(7)  // Bit value for pin 8
    #define COMPILE_I2C_DRIVER  // We need the I2C driver as we are using i2c
    #endif


    /**
    What display type do you use?
    0 = No display - do not use here. Set FEATURE_CONTROLLER 0 instead
    1 = LCD Display with 4 bit data bus
    2 = LCD Display with 8 bit data bus (currently not implemented, fallback to 1)
    3 = LCD Display with I2C connection, 4 bit mode
    4 = Use the slower LiquiedCrystal library bundled with arduino.
        IMPORTANT: You need to uncomment the LiquidCrystal include in Repetier.pde for it to work.
                   If you have Sanguino and want to use the library, you need to have Arduino 023 or older. (13.04.2012)
    5 = U8G supported display
    */
    #define UI_DISPLAY_TYPE 1

    #if UI_DISPLAY_TYPE == DISPLAY_U8G // Special case for graphic displays

    // You need to define which controller you use and set pins accodringly

    // For software spi assign these definitions
    // SCK Pin:  UI_DISPLAY_D4_PIN
    // Mosi Pin: UI_DISPLAY_ENABLE_PIN
    // CD Pin:   UI_DISPLAY_RS_PIN

    // ST7920 with software SPI
    #define U8GLIB_ST7920
    // SSD1306 with software SPI
    //#define U8GLIB_SSD1306_SW_SPI
    // SSD1306 over I2C using hardware I2C pins
    //#define U8GLIB_SSD1306_I2C
    // For the 8 bit ks0108 display you need to set these pins
    // UI_DISPLAY_D0_PIN,UI_DISPLAY_D1_PIN,UI_DISPLAY_D2_PIN,UI_DISPLAY_D3_PIN,UI_DISPLAY_D4_PIN,UI_DISPLAY_D5_PIN,UI_DISPLAY_D6_PIN,UI_DISPLAY_D7_PIN
    // UI_DISPLAY_ENABLE_PIN,UI_DISPLAY_CS1,UI_DISPLAY_CS2,
    // UI_DISPLAY_DI,UI_DISPLAY_RW_PIN,UI_DISPLAY_RESET_PIN
    //#define U8GLIB_KS0108
    //#define U8GLIB_KS0108_FAST
    // UI_DISPLAY_RS_PIN = CS
    // UI_DISPLAY_D5_PIN = A0
    //#define U8GLIB_ST7565_NHD_C2832_HW_SPI

    #define UI_LCD_WIDTH 128
    #define UI_LCD_HEIGHT 64

    //select font size
    #define UI_FONT_6X10 //default font
    #ifdef UI_FONT_6X10
    #define UI_FONT_WIDTH 6
    #define UI_FONT_HEIGHT 10
    #define UI_FONT_SMALL_HEIGHT 7
    #define UI_FONT_DEFAULT repetier_6x10
    #define UI_FONT_SMALL repetier_5x7
    #define UI_FONT_SMALL_WIDTH 5 //smaller font for status display
    #define UI_ANIMATION false  // Animations are too slow
    #endif

    //calculate rows and cols available with current font
    #define UI_COLS (UI_LCD_WIDTH/UI_FONT_WIDTH)
    #define UI_ROWS (UI_LCD_HEIGHT/UI_FONT_HEIGHT)
    #define UI_DISPLAY_CHARSET 3
    #else
    /** Number of columns per row
    Typical values are 16 and 20
    */
    #define UI_COLS 20
    /**
    Rows of your display. 2 or 4
    */
    #define UI_ROWS 4
    #endif // UI_DISPLAY_TYPE

    /* What type of chip is used for I2C communication
    0 : PCF8574 or PCF8574A or compatible chips.
    1 : MCP23017
    */
    #define UI_DISPLAY_I2C_CHIPTYPE 0
    // 0x40 till 0x4e for PCF8574, 0x40 for the adafruid RGB shield, 0x40 - 0x4e for MCP23017
    // Official addresses have a value half as high!
    #define UI_DISPLAY_I2C_ADDRESS 0x4e
    // For MCP 23017 define which pins should be output
    #define UI_DISPLAY_I2C_OUTPUT_PINS 65504
    // Set the output mask that is or'd over the output data. This is needed to activate
    // a backlight switched over the I2C.
    // The adafruit RGB shields enables a light if the bit is not set. Bits 6-8 are used for backlight.
    #define UI_DISPLAY_I2C_OUTPUT_START_MASK 0
    // For MCP which inputs are with pullup. 31 = pins 0-4 for adafruid rgb shield buttons
    #define UI_DISPLAY_I2C_PULLUP 31
    /* How fast should the I2C clock go. The PCF8574 work only with the lowest setting 100000.
    A MCP23017 can run also with 400000 Hz */
    #define UI_I2C_CLOCKSPEED 100000L
    /**
    Define the pin
    */
    #if UI_DISPLAY_TYPE == DISPLAY_I2C // I2C Pin configuration
    #define UI_DISPLAY_RS_PIN _BV(4)
    #define UI_DISPLAY_RW_PIN _BV(5)
    #define UI_DISPLAY_ENABLE_PIN _BV(6)
    #define UI_DISPLAY_D0_PIN _BV(0)
    #define UI_DISPLAY_D1_PIN _BV(1)
    #define UI_DISPLAY_D2_PIN _BV(2)
    #define UI_DISPLAY_D3_PIN _BV(3)
    #define UI_DISPLAY_D4_PIN _BV(0)
    #define UI_DISPLAY_D5_PIN _BV(1)
    #define UI_DISPLAY_D6_PIN _BV(2)
    #define UI_DISPLAY_D7_PIN _BV(3)

    // uncomment if your using led to indicated the bed is hot
    //#define UI_I2C_HEATBED_LED    _BV(8)

    // uncomment if your using led to indicated the extruder is hot
    //#define UI_I2C_HOTEND_LED     _BV(7)

    // uncomment if your using led to indicated the FAN is on
    //#define UI_I2C_FAN_LED        _BV(6)

    // Pins for adafruid RGB shield
    /*#define UI_DISPLAY_RS_PIN _BV(15)
    #define UI_DISPLAY_RW_PIN _BV(14)
    #define UI_DISPLAY_ENABLE_PIN _BV(13)
    #define UI_DISPLAY_D0_PIN _BV(12)
    #define UI_DISPLAY_D1_PIN _BV(11)
    #define UI_DISPLAY_D2_PIN _BV(10)
    #define UI_DISPLAY_D3_PIN _BV(9)
    #define UI_DISPLAY_D4_PIN _BV(12)
    #define UI_DISPLAY_D5_PIN _BV(11)
    #define UI_DISPLAY_D6_PIN _BV(10)
    #define UI_DISPLAY_D7_PIN _BV(9)*/

    #else // Direct display connections
    #define UI_DISPLAY_RS_PIN            28        // PINK.1, 88, D_RS
    #define UI_DISPLAY_RW_PIN        -1
    #define UI_DISPLAY_ENABLE_PIN            29        // 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        10        // PINF.5, 92, D_D4
    #define UI_DISPLAY_D5_PIN        11        // PINK.2, 87, D_D5
    #define UI_DISPLAY_D6_PIN        16        // PINL.5, 40, D_D6
    #define UI_DISPLAY_D7_PIN        17        // PINK.4, 85, D_D7
    #define UI_DELAYPERCHAR           50

    // Special pins for some u8g driven display

    #define UI_DISPLAY_CS1 -1
    #define UI_DISPLAY_CS2 -1
    #define UI_DISPLAY_DI -1
    #define UI_DISPLAY_RW_PIN -1
    #define UI_DISPLAY_RESET_PIN -1
    #endif


    /** \brief Are some keys connected?

    0 = No keys attached - disables also menu
    1 = Some keys attached
    */
    #define UI_HAS_KEYS 0


    /** \brief Is a back key present.

    If you have menus enabled, you need a method to leave it. If you have a back key, you can always go one level higher.
    Without a back key, you need to navigate to the back entry in the menu. Setting this value to 1 removes the back entry.
    */
    #define UI_HAS_BACK_KEY 1

    /* Then you have the next/previous keys more like up/down keys, it may be more intuitive to change the direction you skip through the menus.
    If you set it to true, next will go to previous menu instead of the next menu.

    */
    #define UI_INVERT_MENU_DIRECTION 0

    /** Uncomment this, if you have keys connected via i2c to a PCF8574 chip. */
    //#define UI_HAS_I2C_KEYS

    // Do you have a I2C connected encoder?
    #define UI_HAS_I2C_ENCODER 0

    // Under which address can the key status requested. This is the address of your PCF8574 where the keys are connected.
    // If you use a MCP23017 the address from display is used also for keys.
    #define UI_I2C_KEY_ADDRESS 0x40


    #ifdef UI_MAIN
    /* #######################################################################
                          Key definitions

    The firmware is very flexible regarding your input methods. You can use one
    or more of the predefined key macros, to define a mapper. If no matching mapper
    is available, you can add you c-code for mapping directly into the keyboard
    routines. The predefined macros do the same, just hiding the code behind it.

    For each key, two seperate parts must be defined. The first is the initialization
    which must be added inside uiInitKeys() and the second ist a testing routine.
    These come into uiCheckKeys() or uiCheckSlowKeys() depending on the time needed
    for testing. If you are in doubt, put it in uiCheckSlowKeys().
    uiInitKeys() is called from an interrupt controlling the extruder, so only
    fast tests should be put there.
    The detect methods need an action identifier. A list of supported ids is found
    at the beginning of ui.h It's best to use the symbol name, in case the value changes.

    1. Simple push button connected to gnd if closed on a free arduino pin
        init -> UI_KEYS_INIT_BUTTON_LOW(pinNumber);
        detect -> UI_KEYS_BUTTON_LOW(pinNumber,action);

    2. Simple push button connected to 5v if closed on a free arduino pin
        init -> UI_KEYS_INIT_BUTTON_HIGH(pinNumber);
        detect -> UI_KEYS_BUTTON_HIGH(pinNumber,action);

    3. Click encoder, A/B connected to gnd if closed.
        init -> UI_KEYS_INIT_CLICKENCODER_LOW(pinA,pinB);
        detect -> UI_KEYS_CLICKENCODER_LOW(pinA,pinB);
             or   UI_KEYS_CLICKENCODER_LOW_REV(pinA,pinB); // reverse direction
        If you can move the menu cursor without a click, just be adding some force in one direction,
        toggle the _REV with non _REV and toggle pins.
        If the direction is wrong, toggle _REV with non _REV version.
        For the push button of the encoder use 1.

    4. Click encoder, A/B connected to 5V if closed.
        init -> UI_KEYS_INIT_CLICKENCODER_HIGH(pinA,pinB);
        detect -> UI_KEYS_CLICKENCODER_HIGH(pinA,pinB);
             or   UI_KEYS_CLICKENCODER_HIGH_REV(pinA,pinB); // reverse direction
        If you can move the menu cursor without a click, just be adding some force in one direction,
        toggle the _REV with non _REV and toggle pins.
        If the direction is wrong, toggle _REV with non _REV version.
        For the push button of the encoder use 2.

    5. Maxtrix keyboard with 1-4 rows and 1-4 columns.
        init -> UI_KEYS_INIT_MATRIX(r1,r2,r3,r4,c1,c2,c3,c4);
        detect -> UI_KEYS_MATRIX(r1,r2,r3,r4,c1,c2,c3,c4);
        In addition you have to set UI_MATRIX_ACTIONS to match your desired actions.

    ------- Keys connected via I2C -------------

    All keys and the buzzer if present must be on a connected to a single PCF8574 chip!
    As all I2C request take time, they belong all in uiCheckSlowKeys.
    Dont use the pin ids but instead _BV(pinNumber0_7) as pin id. 0 = First pin

    6. Click encoder, A/B connected to gnd if closed.
        init -> not needed, but make sure UI_HAS_I2C_KEY is not commented out.
        detect -> UI_KEYS_I2C_CLICKENCODER_LOW(pinA,pinB);
             or   UI_KEYS_I2C_CLICKENCODER_LOW_REV(pinA,pinB); // reverse direction
        If you can move the menu cursor without a click, just be adding some force in one direction,
        toggle the _REV with non _REV and toggle pins.
        If the direction is wrong, toggle _REV with non _REV version.
        For the push button of the encoder use 7.
        NOTICE: The polling frequency is limited, so only slow turns are captured correct!

    7. Simple push button connected to gnd if closed via I2C on a PCF8574
        init -> not needed, but make sure UI_HAS_I2C_KEY is not commented out.
        detect -> UI_KEYS_I2C_BUTTON_LOW(pinNumber,action);

    -------- Some notes on actions -------------

    There are three kinds of actions.

    Type 1: Immediate actions - these are execute and forget actions like home/pre-heat
    Type 2: Parameter change action - these change the mode for next/previous keys. They are valid
            until a new change action is initiated or the action is finished with ok button.
    Type 3: Show menu action. These actions have a _MENU_ in their name. If they are executed, a new
            menu is pushed on the menu stack and you see the menu. If you assign these actions directly
            to a key, you might not want this pushing behaviour. In this case add UI_ACTION_TOPMENU to the
            action, like UI_ACTION_TOPMENU+UI_ACTION_MENU_XPOSFAST. That will show the menu as top-menu
            closing all othe submenus that were open.

       ####################################################################### */

    // Use these codes for key detect. The main menu will show the pressed action in the lcd display.
    // after that assign the desired codes.
    //#define UI_MATRIX_ACTIONS {2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015}
    // Define your matrix actions
    #define UI_MATRIX_ACTIONS {UI_ACTION_HOME_ALL, UI_ACTION_TOP_MENU,       UI_ACTION_SET_ORIGIN,      UI_ACTION_NEXT,\
                               UI_ACTION_HOME_Z,   UI_ACTION_MENU_ZPOS,      UI_ACTION_COOLDOWN,        UI_ACTION_OK,\
                               UI_ACTION_HOME_Y,   UI_ACTION_MENU_YPOSFAST,  UI_ACTION_PREHEAT_ABS,     UI_ACTION_PREVIOUS,\
                               UI_ACTION_HOME_X,   UI_ACTION_MENU_XPOSFAST,  UI_ACTION_DISABLE_STEPPER, UI_ACTION_BACK}
    #ifdef UI_MATRIX_ACTIONS
    const int matrixActions[] PROGMEM = UI_MATRIX_ACTIONS;
    #endif

    void uiInitKeys() {
    #if UI_HAS_KEYS!=0
      //UI_KEYS_INIT_CLICKENCODER_LOW(33,31); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
      UI_KEYS_INIT_BUTTON_LOW(4); // push button, connects gnd to pin
      UI_KEYS_INIT_BUTTON_LOW(5);
      UI_KEYS_INIT_BUTTON_LOW(6);
      UI_KEYS_INIT_BUTTON_LOW(11);
      UI_KEYS_INIT_BUTTON_LOW(42);

    //  UI_KEYS_INIT_CLICKENCODER_LOW(47,45); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
    //  UI_KEYS_INIT_BUTTON_LOW(43); // push button, connects gnd to pin
    //  UI_KEYS_INIT_MATRIX(32,47,45,43,41,39,37,35);
    #endif
    }
    void uiCheckKeys(int &action) {
    #if UI_HAS_KEYS!=0

     //UI_KEYS_CLICKENCODER_LOW_REV(33,31); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
     UI_KEYS_BUTTON_LOW(4,UI_ACTION_OK); // push button, connects gnd to pin
     UI_KEYS_BUTTON_LOW(5,UI_ACTION_NEXT); // push button, connects gnd to pin
     UI_KEYS_BUTTON_LOW(6,UI_ACTION_PREVIOUS); // push button, connects gnd to pin
     UI_KEYS_BUTTON_LOW(11,UI_ACTION_BACK); // push button, connects gnd to pin
     UI_KEYS_BUTTON_LOW(42,UI_ACTION_SD_PRINT ); // push button, connects gnd to pin
    //  UI_KEYS_CLICKENCODER_LOW_REV(47,45); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
    //  UI_KEYS_BUTTON_LOW(43,UI_ACTION_OK); // push button, connects gnd to pin
    #endif
    }
    inline void uiCheckSlowEncoder() {
    #if defined(UI_HAS_I2C_KEYS) && UI_HAS_KEYS!=0
    #if UI_DISPLAY_I2C_CHIPTYPE==0
      HAL::i2cStartWait(UI_I2C_KEY_ADDRESS+I2C_READ);
      uint8_t keymask = HAL::i2cReadNak(); // Read current key mask
    #endif
    #if UI_DISPLAY_I2C_CHIPTYPE==1
        HAL::i2cStartWait(UI_DISPLAY_I2C_ADDRESS+I2C_WRITE);
        HAL::i2cWrite(0x12); // GIOA
        HAL::i2cStop();
        HAL::i2cStartWait(UI_DISPLAY_I2C_ADDRESS+I2C_READ);
        unsigned int keymask = HAL::i2cReadAck();
        keymask = keymask + (HAL::i2cReadNak()<<8);
    #endif
      HAL::i2cStop();
      // Add I2C click encoder tests here, all other i2c tests and a copy of the encoder test belog in uiCheckSlowKeys
      UI_KEYS_I2C_CLICKENCODER_LOW_REV(_BV(2),_BV(0)); // click encoder on pins 0 and 2. Phase is connected with gnd for signals.
    #endif
    }
    void uiCheckSlowKeys(int &action) {
    #if defined(UI_HAS_I2C_KEYS) && UI_HAS_KEYS!=0
    #if UI_DISPLAY_I2C_CHIPTYPE==0
        HAL::i2cStartWait(UI_I2C_KEY_ADDRESS+I2C_READ);
        uint8_t keymask = HAL::i2cReadNak(); // Read current key mask
    #endif
    #if UI_DISPLAY_I2C_CHIPTYPE==1
        HAL::i2cStartWait(UI_DISPLAY_I2C_ADDRESS+I2C_WRITE);
        HAL::i2cWrite(0x12); // GPIOA
        HAL::i2cStop();
        HAL::i2cStartWait(UI_DISPLAY_I2C_ADDRESS+I2C_READ);
        unsigned int keymask = HAL::i2cReadAck();
        keymask = keymask + (HAL::i2cReadNak()<<8);
    #endif
        HAL::i2cStop();
        // Add I2C key tests here
        UI_KEYS_I2C_CLICKENCODER_LOW_REV(_BV(2),_BV(0)); // click encoder on pins 0 and 2. Phase is connected with gnd for signals.
        UI_KEYS_I2C_BUTTON_LOW(_BV(1),UI_ACTION_OK); // push button, connects gnd to pin
        UI_KEYS_I2C_BUTTON_LOW(_BV(3),UI_ACTION_BACK); // push button, connects gnd to pin
        UI_KEYS_I2C_BUTTON_LOW(_BV(4),UI_ACTION_MENU_QUICKSETTINGS+UI_ACTION_TOPMENU); // push button, connects gnd to pin
        UI_KEYS_I2C_BUTTON_LOW(_BV(5),UI_ACTION_MENU_EXTRUDER+UI_ACTION_TOPMENU); // push button, connects gnd to pin
        UI_KEYS_I2C_BUTTON_LOW(_BV(6),UI_ACTION_MENU_POSITIONS+UI_ACTION_TOPMENU); // push button, connects gnd to pin
    /*
      // Button handling for the Adafruit RGB shild
        UI_KEYS_I2C_BUTTON_LOW(4,UI_ACTION_PREVIOUS); // Up button
        UI_KEYS_I2C_BUTTON_LOW(8,UI_ACTION_NEXT); // down button
        UI_KEYS_I2C_BUTTON_LOW(16,UI_ACTION_BACK); // left button
        UI_KEYS_I2C_BUTTON_LOW(2,UI_ACTION_OK); // right button
        UI_KEYS_I2C_BUTTON_LOW(1,UI_ACTION_MENU_QUICKSETTINGS);  //Select button
      // ----- End RGB shield ----------
      */
    #endif

      //UI_KEYS_MATRIX(32,47,45,43,41,39,37,35);
    }

    #endif
    #endif


    I hope you can say me whats wrong....
  • edited September 2015 Posts: 6
    How can i hide the code in this forum?
  • Hi Quantec,
    I bought a Prusa I3 with the same lcd & kb like you (this one : http://www.aliexpress.com/item/Black-Factory-High-Quality-Precision-Reprap-Prusa-i3-DIY-3d-Printer-kit-with-2-Rolls-Filament/32357171936.html )
    The vendor is very nice, he has sent me the firmware I asked him because I want to add an inductive sensor for auto-leveling.
    If you want, I can send it to you by email.
  • edited October 2015 Posts: 0



  • Hello hobby16 l also have the same printer but can not get it to work.
    Will send a private with my mail, would l please send the firmware?
  • edited October 2015 Posts: 0
    Hi all,
    Since I have email requests for the source code , I must add that I have examined it in the meantime.
    I can compile it with Arduino 1.04 but it does NOT contain the code to read the 5 key board: there must be an AnalogRead somewhere but I can't find it. So the seller must have sent me a generic Repetier code without the customization for his board. The hex code in the zip seems good though since I can find the string "Omni v1.4", same as displayed on the LCD.
    So my auto-leveling mod is not possible for the moment and pending.

    It would be great if you all ask the vendor to release the real source code and write in AliExpress feedback to dissuade prospective buyers to buy the Hesine printer to pressure the vendor to comply.
  • Hello all
    I have firmware source with working keypad and LCD, so i can send it via email. So maybe you can move this functions (working LCD and analog keypad) from my firmware (based on 0.91) to new 0.92 due to retract functions and better stability? That would be great...
  • Hello all
    I have firmware source with working keypad and LCD, so i can send it via email. So maybe you can move this functions (working LCD and analog keypad) from my firmware (based on 0.91) to new 0.92 due to retract functions and better stability? That would be great...
    Cool that would be helpfull , will pm you my e-mail..
  • Hello all
    I have firmware source with working keypad and LCD, so i can send it via email. So maybe you can move this functions (working LCD and analog keypad) from my firmware (based on 0.91) to new 0.92 due to retract functions and better stability? That would be great...
    Hi, I sent you a PM, I would really like to get a hold of that firmware too if possible.
  • Posts: 0
    I e-mailed the seller (Hesine @AliExpress) and he sent me the firmware a few days ago.

    However, there seems to be no display configuration there, but the .hex file supplied is exactly what the printer shipped with.

    I uploaded the .zip file sent to me here (firmware.zip):


    If anyone else has source files with working display configuration, please send it to me. 
  • Posts: 0
    How do the pins "translate" from real pins to pin numbers used in the file?

    Referencing the Melzi design files with traces on the board, this is what I got it to look like:


    Pin names taken from JP16 of the Melzi board:

    D7 on the HD44780 display seems to go to the pin marked "SDA", which is pin no. 20 on the 1284p, but that does not seem to match up with the numbers @ line 845 and forward in pins.h for the Melzi board.

    For example, there, HEATER_0_PIN is 13, but on the Melzi schematic, it is number 14.

    Does not seem to just be a difference of -1 all the time either, SCK_PIN is defined as 7 in pins.h, but is numbered as no.3 on the Melzi 1284p schematic.

    Am I missing something? Where can I find what hardware pin the pin numbers in uiconfig.h corresponds to?
  • I reverse engineered part of the original firmware from my printer and I think I have found most of the modification they made to it. I modified a 92.5 firmware to include those modification, but like Mixanoid, only the lcd work, no buttons yet. Will keep working on it this weekend, maybe I will finally get it it to work.
  • Today was a good day, I managed to get the buttons workings in 92.5, but the amount of change to the codes is large, there is no simple way to do it, I dont know if the change I made would work on another model of printer, it work on mine, but I had to remove the "alternate leveling" option from the UI because it caused error. If anyone is still interested, I can try to make a guide of some kind to tell you how I did it.
  • Finally got it to work, see modified.txt in .rar file to see what I had to change.

    Thanks to Mixanoid for the 0.91 source!

    Confirmed to work on Melzi 2.0 with XI3 from Hesine on Aliexpress.

    0.92.5 with working display/keys.

    Didn't bother to move over the custom characters and version/vendor strings that the original had.

  • Finally got it to work, see modified.txt in .rar file to see what I had to change.

    Thanks to Mixanoid for the 0.91 source!

    Confirmed to work on Melzi 2.0 with XI3 from Hesine on Aliexpress.

    0.92.5 with working display/keys.

    Didn't bother to move over the custom characters and version/vendor strings that the original had.

    Did you port over the custom leveling code ? I had error when trying to port it, or maybe it was only present on my version of the orignial firmware might not be exatly the same as Mixanoid one ? 

    Now that I know the firmware inside out, I think i will try to add a bigger screen and add some button for some custom function, should not be really hard XD

  • mmmh, after looking at your version of the firmware, its mutch simpler then the one I got with my machine, it contain none of the custom leveling function and menu entry that mine have, But all the rest seem to be the same. Did you remove those fuction or where they never there to begin with ?
  • Didn't really look for it, but I don't think they were there to begin with.

    These are what I based it on:
  • Yeah, its missing all of the commands that where added to my firmware, kinda easier to port without those, and they are not used for my printer anyway so I left them out. Seem like the firmware they sent me is based on this one, but with extra command for auto leveling and some menu option added. Funny thing is, all those are not usefull on my printer, so I dont know why they where included. Removed them and everything is working anyway, so I will just leave them out and be done with it.

     I made a few test today and was able to add a 3 buttons extention board to the already existing button, added some code to start a homing sequence with the first one and its working, I will probably program the others to preheat the machine without going into the menu. In theory you can add as many buttons as you want if you are so inclined, maybe make a new pcb and change the whole layout of the control panel.
  • There's an unused (as far as I can tell) pin on the connector connected to A4, I've been considering putting something fun there. I never really use the buttons though,
  • Well, really, I could simply reprogram the buttons that are already there to do what I want, the only functions I really use are preheating and homing, I never use the sd card or any of the other menu function since my printer is always connected to my pc. But modifying the codes and the hardware is something I like to do.
  • Thanks a lot for your work Axelsp, you beat me to the finish line!! ;)
  • I purchased this 3D printer
    It has the screen you show with the 5 buttons, Repetier firmware and a Melzi controller board. The back of the display has an I2C interface. It has a 10 pin ribbon connector socket, it only has one ribbon cable and plugs directly onto the Melzi board. The Repetier V0.91 configuration has it specified as PiBot Display/Controller extension with 20x4 character display 
    #define FEATURE_CONTROLLER 8

    This forum has pictures of the front and back of the controller as well as a google drive containing some of the printed parts and firmware for the P802M printer.
    I hope this helps.
  • edited December 2015 Posts: 0

    Hello,

    and thank you all for adapting the firmware!

    I have a simple question:

    Under "mechanics"-->"stepper" both (x and y axis stepper) have the value 85.333 instead of the standard value 80.000. Can anybody explain me the reason for this?

    Thank you and regards

    Matthias 

    Edit, ok, after reading this it's more clear to me: https://www.matterhackers.com/news/3d-printer-firmware-settings-stepper-motor-configuration

    " For belt driven axes (usually x and y), the steps per unit is determined by the number of steps per revolution divided by the idler teeth, divided by the belt pitch (ie the spacing between teeth)"

    So I hope this was not a "guessed" value (perhaps via "try and error")  by the original author...



  • @gwc2795: The PiBot Display controller may work with the display but for sure not with the buttons, as you can see on the PiBot schematics: http://reprap.org/mediawiki/images/d/d6/PiBotExpandBoardV1.4-1.pdf every button is on a separate pin, but on "our" control board it's done via a voltage divider, so one analogue pin. (see one of the first schematics in this post)
  • Its not Often you click on a web site and find your problem near the top of the forum with a solution on the first page.
    great work every one you've really helped me out!
  • @gwc2795: The PiBot Display controller may work with the display but for sure not with the buttons, as you can see on the PiBot schematics: http://reprap.org/mediawiki/images/d/d6/PiBotExpandBoardV1.4-1.pdf every button is on a separate pin, but on "our" control board it's done via a voltage divider, so one analogue pin. (see one of the first schematics in this post)
    The Pibot and the 5 keys work flawlessly.
  • Hello,
    how do you flash Repetier firmware via Arduino IDE? I used Arduino addons from Marlin firmware to get "Sanguino" board, set "auto-reset" jumper, then start flashing, but "Uploading..." lasts very long, and no success. Board understand that i flash(reboot on upload start) but nothing happens.
  • Posts: 0

    @Light2016:

    I'm sure that there is no bootloader installed on the melzi board and you wont be able to upload code via the FTDI without it. So you have to install the bootloader first via the ISP interface on your  melzi board. You can upload the bootloader with an USBASP dongle or even with an Arduino UNO (maybe the better solution). Scroll down to "upload bootloader" --> http://reprap.org/wiki/Melzi 

    After that you should be able to upload the code via  FTDI (USB)

    If you have problems with Arduino IDE 1.6xx and the sanguino board files, there is an updated version here:

    https://github.com/Lauszus/Sanguinoor via the board manager:
    https://raw.githubusercontent.com/Lauszus/Sanguino/master/package_lauszus_sanguino_index.json


  • demdem
    Posts: 0

       Hi everyone and Thanks a lot to Axelsp for the modified source code, got it compiling and working in a minute! :D On the other hand, I have still one issue I need to solve, I hope anyone on this chain can help me...

       My issue is that ALL THE MOTORS ARE ONLY CAPABLE OF MOVING IN THE POSITIVE DIRECTION OF THE AXIS (x, y and z) :S

    2Axelsp...
       Don't you know if there is something missing in the configuration of the
    printer (perhaps in the stored variables of the EEPROM) that I should
    modify in order to make the printer move in all positive and negative
    directions?

       To find the issue, I did a quick workaround on my issue by using G-code commands as shown next:

    ---------------------------------------------------------------------------------------------------------------------------------------------------
    Connecting...
    start
    Printer is now online.
    Info:External Reset
    Info: 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
    Free RAM:12337
    ok 0
    ok 0
    >>> m114
    SENDING:M114
    ok 0
    X:-35.00 Y:-10.00 Z:0.00 E:0.00
    ok 0
    ok 0
    >>> m119
    SENDING:M119
    ok 0
    x_min:H y_min:H z_min:H
    ok 0
    ok 0
    >>> g28
    SENDING:G28
    ok 0
    ok 0
    X:0.00 Y:0.00 Z:0.00 E:0.00
    ok 0
    ok 0
    >>> m114
    SENDING:M114
    ok 0
    X:0.00 Y:0.00 Z:0.00 E:0.00
    ok 0
    >>> m119
    SENDING:M119
    ok 0
    x_min:H y_min:H z_min:H
    ok 0
    ok 0
    >>> m115
    SENDING:M115
    ok 0
    FIRMWARE_NAME:Repetier_V1.4 http://zonestar3d.en.alibaba.com/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:1 REPETIER_PROTOCOL:2
    Printed filament:0.00m Printing time:0 days 0 hours 0 min
    ok 0
    ok 0
    >>> m205
    SENDING:M205
    ok 0
    ok 0
    EPR:2 75 115200 Baudrate
    EPR:3 129 0.000 Filament printed [m]
    EPR:2 125 0 Printer active [s]
    EPR:2 79 0 Max. inactive time [ms,0=off]
    EPR:2 83 360000 Stop stepper after inactivity [ms,0=off]
    EPR:3 3 100.0000 X-axis steps per mm
    EPR:3 7 100.0000 Y-axis steps per mm
    EPR:3 11 1600.0000 Z-axis steps per mm
    EPR:3 15 400.000 X-axis max. feedrate [mm/s]
    EPR:3 19 400.000 Y-axis max. feedrate [mm/s]
    EPR:3 23 2.000 Z-axis max. feedrate [mm/s]
    EPR:3 27 100.000 X-axis homing feedrate [mm/s]
    EPR:3 31 100.000 Y-axis homing feedrate [mm/s]
    EPR:3 35 1.000 Z-axis homing feedrate [mm/s]
    EPR:3 39 20.000 Max. jerk [mm/s]
    EPR:3 47 0.300 Max. Z-jerk [mm/s]
    EPR:3 133 0.000 X home pos [mm]
    EPR:3 137 0.000 Y home pos [mm]
    EPR:3 141 0.000 Z home pos [mm]
    EPR:3 145 245.000 X max length [mm]
    EPR:3 149 235.000 Y max length [mm]
    EPR:3 153 205.000 Z max length [mm]
    EPR:3 51 400.000 X-axis acceleration [mm/s^2]
    EPR:3 55 400.000 Y-axis acceleration [mm/s^2]
    EPR:3 59 400.000 Z-axis acceleration [mm/s^2]
    EPR:3 63 400.000 X-axis travel acceleration [mm/s^2]
    EPR:3 67 400.000 Y-axis travel acceleration [mm/s^2]
    EPR:3 71 400.000 Z-axis travel acceleration [mm/s^2]
    EPR:0 880 0 Autolevel active (1/0)
    EPR:0 106 0 Bed Heat Manager [0-3]
    EPR:0 107 255 Bed PID drive max
    EPR:0 124 80 Bed PID drive min
    EPR:3 108 196.000 Bed PID P-gain
    EPR:3 112 33.000 Bed PID I-gain
    EPR:3 116 290.000 Bed PID D-gain
    EPR:0 120 255 Bed PID max value [0-255]
    EPR:3 200 95.000 Extr.1 steps per mm
    EPR:3 204 50.000 Extr.1 max. feedrate [mm/s]
    EPR:3 208 20.000 Extr.1 start feedrate [mm/s]
    EPR:3 212 1000.000 Extr.1 acceleration [mm/s^2]
    EPR:0 216 3 Extr.1 heat manager [0-3]
    EPR:0 217 230 Extr.1 PID drive max
    EPR:0 245 50 Extr.1 PID drive min
    EPR:3 218 7.0000 Extr.1 PID P-gain/dead-time
    EPR:3 222 2.0000 Extr.1 PID I-gain
    EPR:3 226 40.0000 Extr.1 PID D-gain
    EPR:0 230 255 Extr.1 PID max value [0-255]
    EPR:2 231 -3500 Extr.1 X-offset [steps]
    EPR:2 235 -1000 Extr.1 Y-offset [steps]
    EPR:1 239 1 Extr.1 temp. stabilize time [s]
    EPR:1 250 150 Extr.1 temp. for retraction when heating [C]
    EPR:1 252 0 Extr.1 distance to retract when heating [mm]
    EPR:0 254 255 Extr.1 extruder cooler speed [0-255]
    ok 0
    ok 0
    ok 0
    Disconnected.
    ---------------------------------------------------------------------------------------------------------------------------------------------------

    As you can see on the log file (above), at starting the printer and sending
    the command m114 for getting the current position I get an offset (on X
    and Y), and although the printer physically started positioned in the
    middle of the work-space (NOT touching the end-stops), all the end-stops
    are triggered (as displayed after sending the command m119). Then I
    sent a g28 command for moving all the axis motors of the printer to the
    home position, and later again the m114 and m119 commands. Let me
    highlight that in this last case all motors moved ONLY to the positive
    direction of the axis, while the end-stops kept triggered. The worst
    part is that, EVEN IF I MOVE MANUALLY (WITH MY HAND AND FINGER) ANY OF
    THE END-STOPS, THEIR STATUS KEEP BEING TRIGGERED (THIS SAME BEHAVIOR CAN
    BE SEEN IN THE DISPLAY OF THE PRINTER WHEN CHANGING THE POSITION WITH
    THE MENU). I even checked each end-stop connector in the Melzi board (by using a multimeter in the respective header while testing), and they seem to properly shortcut the pins when pressed, and so I guess the mcu is doing it also, but the Software seems not being able to see it :S Any help on this issue will be really appreciated :)


  •    Hi everyone and Thanks a lot to Axelsp for the modified source code, got it compiling and working in a minute! :D On the other hand, I have still one issue I need to solve, I hope anyone on this chain can help me...

       My issue is that ALL THE MOTORS ARE ONLY CAPABLE OF MOVING IN THE POSITIVE DIRECTION OF THE AXIS (x, y and z) :S

    No panic - just compile the firmware again and this time check the checkbox for endstop active low ;) For all 3 axes.
  • Posts: 0
    Here's the firmware I received along with my Melzi 2.0 and LCD2004A kit. (Repetier v.91). When I open up Repetier-host, it says that the printer name is FIRMWARE_NAME:Repetier_V1.4 http://zonestar3d.en.alibaba.com/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:1 REPETIER_PROTOCOL:2
  • Posts: 0
    Hi guys,

    the same printer (Zonestar P802M),  the same issue (no source), the same wish (use newest firmware and configure features).

    So I stepped in and reworked the source you published here. It is now based on the top of official master branch and is easy to merge it (pull request created). The code changes are quite small and easy to review/rebase to newer releases. And the best of all, with it you can use the Web configuration tool to configure your printer right now. No need for manual patches, just use supplied Configuration-normal.h as a starting point and upload/change/download it any time you need. LCD/keypad support is enabled in the Manual section of web config tool (until merged and directly supported by the web config) and has comments in the code.

    I am very satisfied with the result after few prints using this firmware.

    Zipped source can be downloaded from here: Download ZIP
    You have to copy Configuration-normal.h from boards/Zonestar P802M/ to the source as Configuration.h (or upload it to the web configurator first if you want). Read the README.txt in the same folder.

    Happy printing!

  • Next release will contain the controller also in the online config tool for direct selection.
    Thanks @osnwt for the pull request.
  • Posts: 0
    Thank you for very fast merging it into the main repository. My printer now runs with the code built from your git with my config (also provided in the boards/ folder of official repository for those who concerned). It seems to work great, here is a result of few hours of printing: Saber

    Also the video:

  • Posts: 0
    thanks for the awsome support. I have not tested this version of the firmware yet. Will try soon. I am having an issue with my Metal zonestar unit with the 5 keypad. I get really garbage LCD output, i simply can't use the LCD if its installed. Anyone have a solution? How can I sheild the LCD and the cable?
  • Posts: 0
    In this case I would try to connect that LCD using supplied cable to any Arduino board, load example code and see if that LCD is faulty, and/or bad cables, and/or they need shielding. Then depending on results you may find a solution. Actually, I did exactly this playing with LCD via shift register connection when had issues with the circuit.
  • edited March 2016 Posts: 0
    thanks for the awsome support. I have not tested this version of the firmware yet. Will try soon. I am having an issue with my Metal zonestar unit with the 5 keypad. I get really garbage LCD output, i simply can't use the LCD if its installed. Anyone have a solution? How can I sheild the LCD and the cable?



    As osnwt wrote, best practise would be to check the display out as a "dry run" on any MCU Board (like Arduino). I believe there is no further shielding neccessary, it looks more like a connection problem. Are you sure, that you have installed the pin connectors into the right direction? Maybe you have some spare jumper cables for a direct connection so you can be sure that the two cables aren't faulty.

    For the connections you can look here for schematics:

    https://raw.githubusercontent.com/osnwt/Repetier-Firmware/zonestar-adc-keypad-support/boards/Zonestar%20P802M/Controller-schematics.png

    https://github.com/osnwt/Repetier-Firmware/tree/zonestar-adc-keypad-support/boards/Zonestar%20P802M


  • edited March 2016 Posts: 0
    I have the metal zonestar unit and its when ever it gets close to the metal frame it acts all wonky, I looked for anything touching the metal frame when it happens and nothing, and it gets worse when the motors + Heaters are working. The LCD works perfect if I move it to the side. I think its not so much the cable that needs sheilding its the LCD unit. (I have 3 of these units and all acting the same, the pins are the type that can only go oneway on the LCD and il get no power if not plugged correctly into the MELZI board.


    when I try to compile I get an error when using the Repeteur config tool for ADC keypad...

    ui.h:1959: error: #error CONTROLLER_ZONESTAR requres ADC_KEYPAD_PIN = 1 defined in Configuration.h

     #error CONTROLLER_ZONESTAR requres ADC_KEYPAD_PIN = 1 defined in Configuration.h

      ^

    exit status 1
    #error CONTROLLER_ZONESTAR requres ADC_KEYPAD_PIN = 1 defined in Configuration.h

    What did I miss? Sorry very new to this!

  • Posts: 0
    So I ended up just manually changing adc keypad from -1 to 1... but should the config tool do this? Now I am getting another error but has to do with the Z probe, so off to another topic :P 
  • Posts: 0
    It does if you choose a correct controller ZONESTAR_P802M.... in the end of the list of web config tool. Then you'll see the analog pin number for the ADC. But I recommend to use my sample config to start from. It is avaliable here:
    https://github.com/repetier/Repetier-Firmware/tree/master/boards/Zonestar P802M


  • Posts: 0
    I guess I answered to another question. The tool provides the way to define the analog pin, but it does not enforce that.
    I agree, we can define it in the code instead of configuration for P802M similar to LCD pins. Maybe I should add some patch for user convenience.
  • Posts: 0
    Oh no, that's not easy. Unlike LCD pins, the analog pin MUST be defined on the Configuration.h file level due to code organization. That means that it may either be hidden from user when P802M selected, or may be predefined to 1 only for this controller by the web configurator. It also cannot be set to 1 by default for all controllers since it includes extra ADC reads in the code that is unnecessary for other controllers. On the other end, we still need to set steps/mm, axis directions, etc. for P802M.

    In short, better start from provided Zonestar P802M/Configuration.h file that has the pin already set to 1.

    Maybe we should create a user library of configurations for different printers. I did not look if anything similar exists already.
  • Posts: 0
    Hey guys,

    First of all, THANKS A LOT!!!!! for all your hard work.  

    I have a Zonestar P802M and i burned my Melzi 2.0 a couple of months ago.  After receiving a replacement Melzi from my vendor (china) with the wrong firmware installed and an entire month trying to fix it, I stumbled into this thread and not only did I fix my printer, now is working even better!! :-)

    A couple of comments for the next person:

    1. I had to invert my x-axis (no biggie)--(change line 222 on the "configuration.h" tab from 0 to 1
    2. I had to change the steps/mm on the z axis from 1600 to 400.--this was a bit trickier to figure out as for some reason the value was saved on the eeprom and would not change when uploading a new copy of the file.
    to change this, I connected my printer to my pc, with Pronterface and input the following code:
    M206T3P11X400  (400 refers to the steps/mm, in case you need a different value)

    I hope this helps someone as much as the rest of you guys helped me 

    Cheers!
  • Posts: 0

    Hello,

    Great work guys. The print quality is much better with this firmware. I also need to change the steps/mm on the z axis to 400 (because I changed the original Z motors with ones that has the threaded rods attached and the thread pitch was changed).

    Anyone tried offline printing with this chinese board? I have a problem mounting the SD card.
    I got SD_CARD_ERROR_READ in SdFat.cpp at Sd2Card::readData (status_ != DATA_START_BLOCK).
    Tested with FAT16 and FAT32 file systems.
    The board looks like Melzi Version 2.0. The hex buffer (CD4050BM in my case) seems to do the same as original schematics.

    Any ideas?


    Thanks.
  • Posts: 0
    Manually Update Ch340G Drivers and choose this one: https://www.dropbox.com/s/py4r28eo49cgvnh/chg340-fake-driver.zip?dl=0


    Tested OK.

  • Posts: 0
    Is someone having a actual Firmware with autoleveling for the china melzi 2.0 5 Buttons? Im just short in front of going back to hardware endstop z? Cant get rid of my firmware setup.


    Thank you in forward.


Sign In or Register to comment.