Tuesday, 12 March 2013

Panelolu2 for Melzi

Panelolu2 LCD display and control solution working with Melzi Electronics.

The previous post outlined the functionality of the Panelolu2 - broadly similar to the Panelolu but with a reduced pin count allowing it to interface with more controllers. In order to simplify adding the Panelolu2 to your printer the design includes adapter boards and the second adapter board we have produced is for the Melzi controller:

This runs Marlin firmware which has been specifically adapted to support an I2C controller, a number of people are working to incorporate the I2C LCD control code into the standard Marlin build.

The adapter board schematic is below:

The adapter boards will be supplied fully assembled by default:

As the picture above shows they can do more than just provide an interface between the Melzi electronics and the Panelolu2. There are two FETs mounted which can be used to switch a 12V supply, useful for adding additional fans to you printer. Unlike the Sanguinololu the Melzi does not provide 12V on the expansion header so an additional 12V input is needed (The easiest way to do this is to use a short lead to provide the 12V supply from the 12V input to the Melzi board).

The expansion header allows access to the I2C pins so additional devices can be added to the bus, along with the two pins connected to the FETs and the click encoder pins. In normal use the click encoder pins are used for the encoder and cannot be used for anything else. However, as explained in the previous post, running the encoder over I2C may be supported in software in the future which would free these pins up to be used elsewhere. The board has solder jumpers to select between these two modes of operation, with the default being the normal, directly connected mode.

Using the additional FETs

The additional FETs are connected to pins A3 and A4 which map as arduino pin numbers 27 and 28. Pin 27 is the LED pin - setting that pin high turns on the FET and the LED at the same time.

Currently these FETS are not directly controlled in firmware (there is no menu command to turn them on and off) but that is in the pipeline. In the meantime they can be controlled in GCODE by using the M42 command (for example in your startup and shutdown code). Once I get a chance to wire it in I plan to use this in the end of print gcode to drive a fan that will cool the heated bed rapidly (originally Nophead's idea and incorporated into the Mendel90 design)

M42 S255 P27 ;turn on the fan on Transistor 2
G4 S240 ; wait for 4 minutes
M42 S0 P27 ;turn off the fan on Transistor 2

The other FET could be used to drive a fan to cool the stepper drivers or not used at all and the pin used on the expansion header on the adapter board for some other function.

SD Card

The firmware with the P2 changes is setup to use the P2 SD card slot rather than the built in SD card slot on the Melzi. The difference is in the definition of the SDSS pin in pins.h in Marlin. The specific line in pins.h is:

#define SDSS 30 //to use the SD card reader on the Panelolu2 rather than the melzi board

Comment this line out to us the SD card on the melzi board instead. It is not currently possible to use both and select between them after the firmware is compiled.


Update, added this section to summarise the process of getting the Panelolu2 working on a Melzi where the Melzi was previously running a "non standard" version of Marlin such as Nophead's version for M90 or RepRapPro's version of Huxley/Mendel. Please note that if you are using RepRapPro's Multicolour Mendel you need to use their custom variation of Marlin to control the multiple extruders and at this time the Panelolu2 is not compatible with this setup.

  1. If you are not already using it get the standard version of Arduino-0023 from the Arduino website, note that the T3P3 version of Marlin has not been tested with Arduino 1.0 or higher.
  2. Update the avrdude.conf file in the standard Arduino-0023 to include a definition of the atmega 1284p, I have used this one for a year now. Be sure to put it in arduino-0023\hardware\tools\avr\etc\ and rename or overwrite the old one. More detail in my first blog post
  3. Get T3P3 Marlin from github.
  4. Add the "Marlin\ArduinoAddons\Arduino_0.xx\Sanguino" directory to "arduino-0023\Hardware\" directory. This provides the Sanguino extensions required for Sanguinol and Melzi.
  5. Get LiquidTWI2 as mentioned in my Panelolu2 blog post, note that configuration changes are no longer required in the latest version of LiquidTWI2.
  6. Modify the configuration.h of the Marlin to fit your printer setup (setting like controller board, axis dimensions, thermistors, etc). Its best to copy these from the configuration.h of your custom firmware. Update: This blog post should help.
  7. Confirm Marlin compiles and uploads with //#define PANELOLU2 still commented out in configuration.h.
  8. Then uncomment #define PANELOLU2 , along with #define EEPROM_SETTINGS and #define EEPROM_CHITCHAT and confirm it compiles and uploads. Note that with the #define PANELOLU2 uncommented, you must have the Panelolu2 connected or Marlin will hang and not finish initialising.
  9. Check the printer operation and calibration to ensure you have edited the Marlin configuration.h properly.


Update: Now available on our webstore as well as eMakershop and eBay


  1. Nice work, ordered one right away for my melzi equipped printer.

    1. I received my kit last week, and must say i'm pretty impressed by it. Nicely put together and works flawlessly after loading up the correct firmware in my Melzi board.
      The only con i can think of is that it doesn't come with a 12V lead to supply power for the extra fan connections. It's really not an issue, but it would make it a bit more complete.
      Still a great piece of kit.

    2. Hi Bas

      Glad you like the Panelolu2. You are right about including the cable for 12V supply, we will include one from now on (an oversight on my part) would you like one sent to you?

    3. I had a cable with fitting connector laying around, so no need to send one, but thanks for the offer.

    4. Bas Did you do this with the MOST Delta?

  2. Any news on PrintrBoard support?

    1. Hi Colin

      The RAMPS and PrintrBoard adapters have been designed and tested,with the RAMPS about a week ahead of the Printrboard. Production has just started on the PrintrBoard adapters so I should have an update in a couple of weeks.

  3. Hi Tony,

    I am a Mendel90 user (nophead) and I wish to make the printer standalone.
    I have two handicaps:
    - I am very bad in English
    - I am a newbie in Arduino programming (I know how to blink an DEL on an Arduino Uno) :)

    The firmware on the card is the following: https://github.com/nophead/Marlin

    When I compare the files (configuration.h, configuratio_adv.h and pins.h) of T3P3 and Nophead, I found many differences to integrate Panelolu2 (motherboard = 63).

    But there are changes to be made in Marlin.pde, the Nophead firmware does not have Marlin.pde file but a file Marlin.ino.

    In this case how to integrate Panelolu2 in firmware(all my attempts have been unsuccessful)?


    1. Sorry, I'm not anonymous

    2. Hi Icare

      The T3P3 version of Marlin is forked from https://github.com/ErikZalm/Marlin
      , From the Marlin_v1 branch which is still pre v1.0 of Arduino, hence the Marlin.pde not Marlin.ino.

      I am running this on a Melzi board on a Mendel90 (the original Sturdy version) with no problems and try to pull in the upstream changes to Marlin regularly.

      I have added the two additional thermistors that Nophead's version of Marlin specifies to the latest T3P3 version of Marlin. To make this work with your Mendel90, Melzi and Panelolu2 you need to:
      1)Get the LiquidTWI2 library installed as described in http://blog.think3dprint3d.com/2013/02/panelolu2.html
      2)Get the T3P3 version of Marlin
      use the Marlin_v1 fork
      3)Change configuration.h to board type 63, copy the thermistor values for board and bed (NOTE: Nophead's thermistor number 8 and 9 are T3P3 number 11 and 12 because 8 and 9 were already taken), copy the speed, acceleration and axis sizes, uncomment the #define PANELOLU2 line
      4) upload using Arduino 0023.

      Let me know how this goes and feel free to email me if you run into specific issues.


    3. Thanks
      I'll try tonight. I will give you the results.

    4. You say: "By default the Panelolu2 is disabled in LiquidTWI2, after saving the directory, edit LiquidTWI2.h to remove the comments on line 10:
      // #define PANELOLU2 //only possible....
      #define PANELOLU2 //only possible...."

      I can not find PANELOLU2 in LiquidTWI2.h (in the version v1.1.0 or v1.0.0)

    5. Hi Tony,

      I found the files of LiquidTWI2-master, there is no "// # define PANELOLU2 // only possible ...." in LiquidTWI2.h.
      But in the file #LiquidTWI2.h# I have "// # define PANELOLU2 // only possible ....".

      Should we rename the file #LiquidTWI2.h# in LiquidTWI2.h?

    6. Hi Icare

      Thanks a lot for pointing this out - LiquidTWI2 has been updated and no longer requires configuration, the latest version appears to work just fine without any changes at all.

      I have updated the blog post:
      to show the step is not needed. The other thing I have noticed is that the buzzer timing has now changed in LiquidTWI2, so I have made a change to the T3P3 Marlin to update this buzzer timing.

      If you try LiquidTWI2 without any changes, just saved in arduino-0023\libraries\LiquidTWI2

      and the latest version of T3P3 Marlin with your specific configuration file changes. Let me know how you get on.


    7. Hi Tony,
      To understand, I did the following:
      - Use Arduino 0023 with hardware Melzi
      - installation LiquidTWI2 in Arduino\Libraries
      - Use t3p3 Marlin with
      change MOTHERBOARD == 7 in 63
      uncomment #define EEPROM_SETTINGS
      uncomment #define PANELOLU2
      - no other changes for the test

      Arduino configuration : board Melzi W / ATmega1248p 16mhz
      then ctrl R for compiling and I have this error:

      File in Arduino:
      /* Arduino SdFat Library
      * Copyright (C) 2009 by William Greiman
      * This file is part of the Arduino SdFat Library
      * This Library 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.
      * This Library is distributed in the hope that it will be useful,
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
      * GNU General Public License for more details.
      * You should have received a copy of the GNU General Public License
      * along with the Arduino SdFat Library. If not, see
      * .
      * \file
      * \brief SdFile class
      #include "Marlin.h"

      #ifdef SDSUPPORT
      #include "SdBaseFile.h"
      #ifndef SdFile_h
      #define SdFile_h
      * \class SdFile
      * \brief SdBaseFile with Print.
      class SdFile : public SdBaseFile, public Print {
      SdFile() {}
      SdFile(const char* name, uint8_t oflag);
      #if ARDUINO >= 100
      size_t write(uint8_t b);
      void write(uint8_t b); <<<<<<<<<<<<<<<<<<<<<<********************************

      int16_t write(const void* buf, uint16_t nbyte);
      void write(const char* str);
      void write_P(PGM_P str);
      void writeln_P(PGM_P str);
      #endif // SdFile_h


      conflicting return type specified for Virtual void SdFile::write(uint8_t)'

      In file included from /cardreader.h:6,
      from cardreader.cpp:2:
      SdFile.h:42: error: conflicting return type specified for 'virtual void SdFile::write(uint8_t)'
      C:\Users\icare\Desktop\Etude_Marlin\Arduino\arduino-0023\hardware\Melzi\cores\arduino/Print.h:49: error: overriding 'virtual size_t Print::write(uint8_t)'

    8. Hey Icare

      Try with the "Marlin\ArduinoAddons\Arduino_0.xx\Sanguino" directory from the T3P3 Marlin (same as standard Marlin) in your arduino-0023\Hardware\ directory rather than the "Melzi" directory.

      Thats the one I am using - I think the problem is trying to mix the Nophead version with the T3P3 version.

      Within Arduino you need to select board:

      Sanguino W/ ATmega1284p 16mhz

    9. Hi Tony,
      That was the problem and following your advice, I can compile.
      I will now update the parameters of the Mendel90.
      A big thank you for your help

    10. Hi Icare

      Great news. In summary for others wanting to use the P2 on Melzi who currently use a custom version of Marlin the easiest way to get up and running is:

      1) Get a standard version of Arduino-0023 from the Arduino website
      2) Get T3P3 Marlin from the github
      3) Add the "Marlin\ArduinoAddons\Arduino_0.xx\Sanguino" directory to "arduino-0023\Hardware\" directory
      4) Get LiquidTWI2 as mentioned here
      4) Modify the configuration.h of the standard T3P3 Marlin to fit the custom Marlin configuration.
      5) Confirm it compiles and uploads with //#define PANELOLU2 still commented out in configuration.h. Then uncomment it and confirm it compiles and uploads
      6) Check all the printer calibration to ensure you have copied the settings from the custom Marlin configuration.h to the T3P3 configuration.h properly.


    11. I should add, you need to update the avrdude.conf file in the standard Arduino-0023 to include a definition of the atmega 1284p

      The version I have used for a year now is this one:

      be sure to put it in


      and rename or overwrite the old one.

      More detail in my first! blog post

  4. Hello,

    Got everything working with the melzi except the SD card. I would like to use the panelolu 2 SD card slot instead of the melzi. Currently neither the melzi or the panelolu are working. Do you have any idea of what "define" I should ciomment or uncomment in configuration.h and if I need to edit any other file in Marlin (T3P3)?

    Also I don't really understand this NOTE:
    3)Change configuration.h to board type 63, copy the thermistor values for board and bed (NOTE: Nophead's thermistor number 8 and 9 are T3P3 number 11 and 12 because 8 and 9 were already taken), copy the speed, acceleration and axis sizes, uncomment the #define PANELOLU2 line

    In the nophead mendel90 marlin version I have that:

    #define TEMP_SENSOR_0 8
    #define TEMP_SENSOR_1 0
    #define TEMP_SENSOR_2 0
    #define TEMP_SENSOR_BED 9

    Is the note refering to these "8" and "9"?


    1. Ok got it for the NOTE, in configuration.h this becomes (for Mendel90)

      #define TEMP_SENSOR_0 11
      #define TEMP_SENSOR_1 0
      #define TEMP_SENSOR_2 0
      #define TEMP_SENSOR_BED 12

      But SD card seems more tricky...

    2. Hi Jerome

      You are right about the Thermistors

      For the SD card the T3P3 version of marlin is configured to use card on the Panelolu2 to change it to use the onboard one change the line SDSS =30 to SDSS =31 in the Sanguinololu/Melzi part of pins.h

      Once you have it working with the onboard version then try chaning back to 30 and see if that works.

      Only one slot will work at any one time.



    3. My bad, it was the sd card that got corrupted somehow while transferring it from Melzi to Panelolu, I reformated it on my computer and it works.

  5. I have added a "summary" section to the blog to simplify the setup process

  6. Hi,
    Panalolu2 for Melzi it's for me a very nice solution to drive the Mendel90.
    I have the solution that I wished for my standalone 3D printer.
    Thank you for your help to implement the firmware.
    When trying this solution, we do not want to use the version connected to the computer.
    Really must be tested this solution

  7. Hi,
    I followed the steps, almost everything works, the heated bed is not shown on the screen.

    Where can I enable it?


    1. Hi Fran├žois

      Does your heated bed work through pronterface? maybe you do not have a thermistor set for it in firmware (#define TEMP_SENSOR_BED ) ned to be equal to something other than 0



  8. I'm sure this is just a small thing but on upload I get this error arduino-0023\hardware/tools/avr/etc/avrdude.conf:4 unrecognized character: "<"

  9. Hi All,

    (Not that…) Recently I bought a Panelolu 2 for Melzi and have been trying to get it to work.
    So far so good, the LCD it up and running and I can control my RepRapPro Huxley using the Panelolu, a big Thank Youto Tony for getting me this far and the advice he gave to try and get the Heated bed working.

    The trouble I’m having is with the Bed Temperature measure and control.
    The Bed Temp is being reported as a variety of symbols namely ‘,(, < or *, not sure why this is.

    The Huxley Bed has an independent power supply and is controlled via an input signal received from the Melzi, this has since been repurposed to the Panelolu interface.

    I have been trying a number of ways to regain control of the Heated Bed, so far I have tried using the spare “fan” connector and changing the "#define HEATER_BED_PIN" in pins.h from 10 to 12. This allows me to switch the OP of the fan to either high or low and theoretically control the bed.

    I used a 5V Voltage Regulator to ensure that I wasn’t overloading the Bed’s input, however when I connected it all up the bed is now always on, regardless of control.
    Feeling disheartened I tried an alternative method, I tried to use the Adaptor board expansion header pins A3 or A4. These are doubling up - they control the fan transistors but are also on the expansion header.
    I attempted to use the A4 pin and changed the pin definition in pins.h for heat bed to "28". Again I searched for the melzi part of the file (board type = 63) and changed the "#define HEATER_BED_PIN" from what it is now (12 see above) to 28. Although I seem to be registering a Voltage when I ask Panelolu to Prepare to print ABS, it doesn’t seem to be enough to control the Heat Bed.

    Has anyone already been through this or could offer any advice about trying to get the thing up and running?

    1. Hi Jamie

      I think you need to get to the bottom of the temperature issue first. Do you get the weird bed temp issues when viewing the temp on a connected computer using Pronterface?

    2. Hi Tony,

      Just come back from Ireland and am working on the printer again.

      I was having some strange errors so I went back to the beginning.
      I uploaded the default firmware to the printer, did some testing and its working fine.

      I followed the instructions and steps 1 to 7 uploading the altered firmware to the printer and performed some more tests, printer responded as expected so all is fine.

      I have un-commented #define PANELOLU2, pronterface testing shows the printer responding correctly, however, when the panelolu is connected it now displays a full screen of solid squares.

    3. Hey Jamie

      The solid squares is a likely indication that the LCD is getting no commands to display anything, but that it has power.

      As a quick test can you confirm if the LEDs on the Paneolu turn on and off when you turn the extruder and bed on and off in pronterface?

    4. Hi Tony,

      The LEDs remain unlit when I turn the extruder and bed on and off in pronterface.

    5. Hi Jamie

      If the bed and extruder come on ok but not indicated on the Panelolu2 that implies to me that communication between the P2 and Melzi is not working. Possibly an issue with pin configuration if you have modified that a lot to fix your previous problem. Something else in the chain could be messed up (Melzi expansion header, adapter board, cable or Panelolu2 itself) but those were all working for you previously.

      I would double check how it is plugged in and pins.h



  10. Hi Tony,
    Just been trying to get the Panelolu 2 working on a Mendel 90 with Sanguinololu 1.2.
    The machine has been working fine with the original firmware (no Panelolu 2), but now that I have added the Panelolu 2 and updated the firmware the x,y and z axis don't work!
    If I comment out the #define PANELOLU2, the axis work correctly!
    If I un-comment the define, and comment out the #define ULTRALCD, the fault re-appears!
    Any suggestions as to the problem?

    1. Hey Clayton

      I dont have a Sanginololu 1.2 -its worth looking at the schematics to see if the order of the pins on the expansion header has changed between Sanguinololu 132 and 1.3/1.3a which the Panelolu2 does work with.



  11. hello i am having a problem with the fan on the paneloiu2 do the do a merlin code to work the fans.
    i got the LCD to work it is fantastic i have a melzi any help please i am new to this.

    1. Hey Devlin

      I assume you are referring to the two small mosfet connections on the Melzi adaptor board that came with the Panelolu2? They are different from the FAN output on the Melzi board itself. The Schematic in the blog above shows that the two Fan pins need a 12V connection for them to use to drive a fan, see the blog post above:

      "here are two FETs mounted which can be used to switch a 12V supply, useful for adding additional fans to you printer. Unlike the Sanguinololu the Melzi does not provide 12V on the expansion header so an additional 12V input is needed (The easiest way to do this is to use a short lead to provide the 12V supply from the 12V input to the Melzi board)."

      Also see the part on how to use the additional FETs from GCode.



  12. Hi,

    a great derivate of Marlin can you find here: https://github.com/neildarlow/Marlin
    discussion: http://forums.reprap.org/read.php?292,321160

    Can use the panelolu2 "out-of-the-box" without interminable customizing the nophead-marlin.


    1. hey Florian, indeed! I tested this version otu as well and neil has submitted a pull request to the main marlin fork to get the key Panelolu2 changes incorporated:


      now it just needs to be merged!

  13. Just got my Panelolu2 this week and then read the bit that said "Please note that if you are using RepRapPro's Multicolour Mendel you need to use their custom variation of Marlin to control the multiple extruders and at this time the Panelolu2 is not compatible with this setup.", I have a tricolor mendel, DOH! Is this still the case?

    1. Mark

      The RepRapPro Tricolour uses the same pins to communicate between the two boards that we use for the Panelolu2. I have looked briefly at a work around but the key pin is the SCL line. this is part of the I2C communications channel between the Melzi and the Panelolu2 (I could move the TX and RX pins, and just not have the RST to the Panelolu2). There would be a significant amount of work required to unpick the RepRapPro communications between the two Melzis and move that to a more modern version of Marlin, also moving the clock functionality from SCL to another pin (if that is even possible). If you are up for the challenge you could give it a go?




Comments are now moderated to reduce spam, please excuse the additional time this will entail.

Note: only a member of this blog may post a comment.