Unable to find the right pin on Melzi 2.0 P802M for BLTouch

edited May 2022 in Repetier-Firmware
Good morning everyone, i know, i know: melzi is an old board and it doesnt have enough space for the repetier firmware, and i already banged my head in some walls BUT! I recently found out, that in my zonestar P802M (old model, one of the first, bought in 2015 and pratically never used because reasons...) there should be i spare pin to drive the BLTouch Servo (Actually a 3D Touch, which is the clone version) placed in the EXT connector.... i identified it and tried with every kind of number... from my research the A4 pin should be 28, but it changes based on what pinout i look at... i actually dont know which one is right and how to check if it works... a normal P0 S700 doesnt do anything on my probe.... can anyone indicate me the right pin number and which one to use ? 
Repetier 1.0.4 (SD disabled, Arc disabled, servo enabled, autoleveling and probe enabled)
Based on this picture , i've chosen A4... but i dont know where to look to understand if that pin is used by anything and i have to select another one... I higly suspect that A4 is LED_PIN ... do i have to disable it ? how and where? 

Any help would be greatly appreciated!


  • Check https://reprap.org/wiki/Melzi for some hint on it. There is no pinout diagram but you see connectors and schematic for all ports so you can get the pin for it. Just note that you need the arduino pin number not chip pin number.
  • edited May 2022
    I've looked around all the repetier firmware, and after a while i've selected pin 27 , as it seems free.... After assigning pin 27 to SERVO0, i've tried to launch M340 P0 S700 or M340 P0 S1400... nothing happens... what it could be?

    EDIT: I've also tried 1.0.x-dev just to be sure... still no movement... the bltouch seems unresponsive, using PIN 27/A4

    The sensor do the "self test" when i power up the printer and stays retracted and with the red light on.
    I've downloaded a simple arduino sketch on my arduino uno to test the functionality of the sensor and it works well (pin deployed correctly and touch works fine) 


    is there anything a can do? As i'm disabling SD card support to squeeze the firmware in the melzi, is there any accessible pin or temporary pin i can use to test ?
  • Sure it is arduino pin 27?
    shows mapping arduino numbers . Pin 27 is PA3 according to this. You said A4 that is pin 28. On the other side if sketch worked it should be correct pin.

    Deactivate timing is 1473 and activate is 647 also there is some variance allowed.
    Have you configured servos correctly? Meaning num servos set to 1 and pin. I think that would be all to configure.

    Also assuming pin 27 is correct make sure no other function uses same pin for something as well.
  • edited May 2022
    The sketch i tried is just for my Arduino uno, not for the melzi... So I'm sure the sensor work. I still have to figure out how to attach the servo to a pin of the melzi ...
    I'll attach my config asap , also ... Melzi is a 1284... Sanguino compatible so it should be this :


    But it is labeled differently in the bltouch wiring tutorial ...
    Right ?

    I'll try again tonight with 27 and 28 also ... Just to be sure ... 
    Where do i have to look, apart from pins.h and Configuration.h to discover eventually free pins ? 

  • Oh! Do you know if could be a power problem ? Do i have to attach a separate 5v source for that ? Also, if yes , i have to bridge the GND of the external PSU to the GND of the board ? 
  • Ok from BLTouch it would be 28 and from your image 27 so should at leat be one of them.

    I don't think it is a power problem. Main power comes from USB/Voltage converter and that is how more or less all are doing it.
  • I've checked the configuration for Mobo 63  in your firmware ... Pin 27 should be free and it should be that ... 28,29 etc are busy by the LCD... And from your schematics it should be A4, I've also ordered an original BLTouch just to be sure that is not another "oops ! China did it again" 
  • I'm using the online config tool and in servo i selected servo0 with DIGITAL PIN 27, it's correct??
  • Yes should be correct then. Except maybe pin confusion:-)
  • Ok... i'm finally crying of joy because it works... the mistake was in a youtube video i was following... the correct pulse is 647 instead of 700... i didnt know that... i can confirm that pin 27 is A4 in melzi P802M motherboard! Now i have to understand how it works...
  • > 647 instead of 700... i didnt know that...
    yes I wrote that above :-) Good to hear it was just wrong timing and it now works.
  • I've fixed the probe to the extruder mount and started playing with the auto leveling ... I'll keep you updated... Sending u 10 euros for the help! Cheers!
  • I have exactly the same config, but I'm getting:

    HAL.cpp:602:2: error: #error No servo support for your board, please diable FEATURE_SERVO
     #error No servo support for your board, please diable FEATURE_SERVO
    exit status 1
    #error No servo support for your board, please diable FEATURE_SERVO

    It looks like I just need to set SERVO0_PIN to 27, but it makes no difference.  Any ideas?

    Kind regards


  • There is also this condition in line 508 of HAL.cpp
    #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) || defined(__AVR_ATmega128__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega2561__)

    if your chip is not listed here you can try replacing it by
    #if 1

    but processor must su[pport timer3 which is used for it.
  • Hi Repetier,

    Yes I saw this, but I probably didn't examine it properly :)   Mine is "ATmega1284P or ATmega1284 (16MHz)".  I'm not sure which.

    It's an old Tronxy Melzi 2.0_V5.

    Which means, I guess, if it were the ATmega1284, then it would fail.  Where is the board defined in the code?

    Thanks for your help,

    Kind regards,

  • Actually, looks like they are the same processor with different voltage capabilities. P standing for pico. I'll try just adding both boards to the line.
  • Actually, looks like they are the same processor with different voltage capabilities. P standing for pico. I'll try just adding both boards to the line.
  • Done.  I'm using 0.92.9 which doesn't have defined(__AVR_ATmega1284P__) ||

    Just adding that fixes it.

    Thanks for pointing me in the right direction.
  • So I did this and it compiled and uploaded. Just need to finish wiring and test.
  • So I did this and it compiled and uploaded. Just need to finish wiring and test.
Sign In or Register to comment.