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.

Summary

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.


Availability

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