Monday, August 26, 2013

I2C display and rotary encoder on Melzi

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.




Friday, August 16, 2013

Entering the era of 3D printing

I started reading intensively about 3d-printing in March this year and I was surprised about how far this field had gotten since last time I checked (it was in 2007). In fact, I was very impressed about the quality of the printed parts mere hobbyists got. Hence, it did not take me long before I ordered a kit.

I decided to build a small printer as my first printer, and considered both the new Printrbot jr and the Reprappro Huxley. The Printrbot both looks better and is probably easier to build, being built from lazercut plywood rather than treaded rods. It is also cheaper. Nevertheless, I ordered a Huxley.


Reprappro Huxley (image from Reprappro)


The Huxley arrived after about a week and I have nothing but good things to say about the kit and the service minded folks at Reprappro. Every bag of parts is clearly marked, and with the assembly instructions on the wiki it is a joy to put together. Look here for a unboxing video by mr Mike H.

In short, I had no problems at all putting the printer together. The entire process was easy and straightforward and I can highly recommend the kit from Reprappro. Well, actually, there was one problem: The Y-axis belt tensioner is a poor design and it is very difficult to adjust the tension on the belt using the set-screw. Fortunately there are better designs on thingiverse and I will switch to this design whenever I have to remove the bed. In the meantime, I invented my own quick-fix by using a M6 bolt as a belt tensioner beneath the bed.

Using a M6 bolt as a belt tensioner for the Y-axis


The only major problem that occurred before my first print was to get the software working. As I am running a rather old version of Mac OS (10.5). I had problems with the latest versions of Pronterface and Slic3r. In order to make this combo work with the printer, I had to install Ubuntu Linux on my mac. Thanks to this guide, I managed to make dual-boot work after some struggle. In total, I think I ended up spending more time on the software than on actually building the printer. Building the printer was also way more fun.

They say that the first things you will print with your new 3D-printer are modifications for the printer. For me, this was proven to be true. I started straight away to modify the printer. First, I added a fan to cool small parts while printing. It seems to be a handy add-on that most Reprappers recommend. The fan is suppported in Slic3r, which produces the G-codes to start and stop the fan automatically when needed. I created a fan mount for the X-axis in OpenSCAD. It seems to work very well and small parts now prints a bit better. Although others have created better designs than my primitive fan mount solution, such as this one,  I think I will stick to my design for a while.

A bracket for mounting a fan on the X-axis

The other modification I have done is to control the hot-end-fan via firmware. The reason for this is that my extruder fan (which is connected to +19V constantly) is very noisy, and the fan is not needed unless the hot end heater block is on. The noise from the fan can be very annoying during e.g., calibration or when performing other hacks. I added some code lines to the Marlin firmware to make the fan switch on when the hot end temperature is above 50 degrees C. I found the necessary code lines for the Marlin firmware here, and pasted them into my own firmware. On the Huxley, the mosfet-output for the heated bed is not used, so I altered the firmware to use this output to control the hot-end fan. Now, the printer is very silent when it is not printing.

The hot-end fan is connected to the unused heated-bed output and is controlled by Marlin

The third modification I have done is to add a LCD and a rotary encoder. I could have just ordered the nice Panelolu 2, but I decided to go cheapskate and ordered a 16x4 I2C LCD and a rotary encoder from dx.com. The display uses the PCA8574 I2C I/O Expander. I spent some hours hacking the firmware, but I finally got it up and running. To make it work, I had to scrap the reprappro version of Marlin in favor of the t3dp3d Marlin version. I used the excellent guilde at Think3dPrint3d to make the display work. 


My four-line display attached in a bad printed Panelou 2-case.


It is very handy to be able to control the printer without a computer attached. I printed the Panelolu case from Think3dPrint3d. The print did not come out well,  but I will use it until I have designed a casing that is more suitable for the Huxley. For now it is mounted with zip-ties on one of the z-axis motors.


This is how my Reprap Huxley looks today.


Thats it for now. I am happy to be a part of the Reprap community, and I will hopefully print a lot of useful stuff in the future. Even if the parts that are printed sometimes come out as crap, it is still very intriguing to watch the printer produce 3d-objects.

Thursday, August 15, 2013

Day to night to day timelapse

Recently I created a timelapse of a day-to-night-to-day transition. I used my Nikon D90 on Aperture priority and a ND8 filter. To assemble the timelapse, i used Frosthaus Sequence. Although the video is slightly boring, and there is no music, I am still quite satisfied with the result.