Quantcast
Channel: DIYcrap
Viewing all articles
Browse latest Browse all 51

I2C display and rotary encoder on Melzi

$
0
0
Recently, I built a Reprappro Huxley 3d-printer, and I wrote a summary about the build-process in this post. One of the modifications I have done on the printer is to add a display and a rotary encoder.

My 20x4 display and rotary encoder in a Panelolu casing

The very best solution to make a display work with the printer would be of the Reprappro version of Marlin could support I2C displays directly. However, it does not, and all my attempts to add the necessary display-code to their version failed. Thanks to the guide at Think3dPrint3d I managed to make the display and the rotary encoder work by using the T3P3-version of Marlin instead of the Reprappro version.

Display

I chose a simple I2C-display from dx.com (Deal Extreme). It comes with a PCA8574-compatible I2C-port expander. Luckily, the RA_CONTROL_PANEL, which is supported by the firmware, uses the same expander. All you have to do to make the dx.com display work is to define the RA_CONTROL_PANEL in Configuration.h in Marlin as such:


#define RA_CONTROL_PANEL

#if defined(RA_CONTROL_PANEL)
 #define ULTIPANEL
 #define NEWPANEL
 #define LCD_I2C_TYPE_PCA8574
 #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
#endif


It is pretty straightforward to connect the Display to Melzi:
  • GND connects to a free GND pin
  • VCC connects to a free VCC pin
  • SDA connects to SDA
  • SCL connects to SCL

Rotary Encoder

The rotary encoder I use is also from Deal Extreme. In order to make it work I had to define which pins to use in Pins.h. Look for the definitions for the Melzi-board (number 63) in the file.

//The encoder and click button
     #define BTN_EN1 11 
     #define BTN_EN2 10
     #define BTN_ENC 29

In addition i had to move the connection for the heated bed Mosfet to make the encoder work.

#define HEATER_BED_PIN     30 

I think, but I am not quite sure, that the rotary encoder must use Interrupt pins 10 and 11 in order to work. I tried different configurations without moving the heated bed connection, but the above is the only configuration which made sense (and worked).

To connect the rotary encoder to Melzi:
  • A connects to TX1
  • B connects to RX1
  • SW connects to A2
  • VCC connects to VCC
  • GND connects to GND
Thats it. The panelolu2-case is great by itself, but it is not superduper for the Huxley. If you find or create a display casing that fits above the Melzi board or fits the Huxley better, please spread the word below.





Viewing all articles
Browse latest Browse all 51

Trending Articles