Thursday, May 16, 2013

Basic Marlin Configuration.h modification

In order to set up Marlin firmware to work with your 3D printer the Configuration.h file needs to be modified to match your hardware. This post will describe the basics of modifying Configuration.h.

The version of Marlin this is based on is the current (as at 15/05/13) Marlin_v1 version, modified slightly to incorporate the Think3dPrint3d Panelolu2. There are various different Marlin versions:

EricZalm master version
Think3DPrint3D version
RepRapPro version
Nophead version

This post is aimed at helping users of RepRapPro Marlin and Nophead's Marlin migrate their configurations to T3P3 Marlin in order to use the Panelolu2; however it may be helpful to others who are setting up their configuration.h for the first time.

Refer to the working/default Configuration.h from your current setup if you have one and use that as a guide to what settings to put at each stage - if in doubt use the default setting from your printer manufacturer as a start point.

Note: I do not cover every setting, just the main ones to get up and printing.

Environment

The T3P3 version of Marlin is only tested on Arduino-0023 and on the following electronics boards:

Sanguinololu 1.2, and 1.3a
Melzi
RAMPS 1.3 and 1.4
Printrboard

First open Configuration.h in your favourite text editor or the Arduino IDE (it is located in <Marlin Folder>\Marlin\Configuration.h)


(from this point on I am not going to use screen shots for each Configuration.h line)

I will refer to the line number in the version of the T3P3 firmware available today. This will change over time and get out of date but it will be a good start and it should be fairly obvious which line I am referring to. You can see the line number on the bottom left of the Arduino IDE screen - in the shot above the cursor is on line 12.

Add an Author/Version


Line 12
#define STRING_CONFIG_H_AUTHOR "(<something useful here>)" //Who made the changes.

This is helpful to confirm with a glance which version of your configuration.h is loaded on your hardware:



Baudrate


Line 20
// This determines the communication speed of the printer
#define BAUDRATE 250000
//#define BAUDRATE 115200


Keep this on the faster setting unless you have a need to use a slower setting. Make sure you select the same baudrate in Pronterface (or your control software) as you have set here when you connect.

Motherboard


Line 51
#define MOTHERBOARD 7

As the comment above this line shows there are many supported electronics motherboards. Make sure you chose the right version for your electronics (for example 63 for Melzi, 33 for RAMPS 1.3/1.4 with 1 extruder, 34 for RAMPS 1.3/1.4 with 2 extruders etc).

Temperature Measurement


Line 90
#define TEMP_SENSOR_0 1
#define TEMP_SENSOR_1 0
#define TEMP_SENSOR_2 0
#define TEMP_SENSOR_BED 1

Most printers will use a thermistor, and a common choice is the "EPCOS B57560G104F". The standard table number "1" works fine for this thermistor. I have copied two tables from Nophead's version of Marlin into the T3P3 version - numbers 11 and 12. If you have a Mendel90 kit from Nophead then these will probably be the best choice for you (although they were numbered 8 and 9 in Nophead's version, I had to change the numbering as 8 and 9 were already taken in the master version).

If you have a RepRapPro printer, their custom version of Marlin does not use a pre-calculated thermistor lookup table but computes the values directly. I have incorporated this into the latest T3P3 version on Marlin as described in my previous blog postMy copy is rather untested so use with caution. Even though on-the-fly calculation is now available, I recommend using tables. Nophead's blog describes the theory behind the table calculations and the "createTemperatureLookupMarlin.py" script in the Marlin folder allows for the calculation of an accurate table for your thermistor and temperature range of interest.

If you want to use the calculated thermistor values then:

Line 97
//use RepRapPro Algebraic Temperature calculation rather than
//the tables - still experimental in this version of Marlin.
#define ALGEBRA_TEMP 

Line 104 onwards
Choose the serial resistor for your electronics (4700 is standard)

#define SERIAL_R 4700
//#define SERIAL_R 10000

Choose your thermistor Beta values (from the data sheet, ask your supplier) and value at 25C (100K thermistor is 100000, 10K is 10000)

// EPCOS B57560G104F (the standard 100K one)
#define E_BETA 4036.0
#define E_NTC 100000.0
#define BED_BETA 4036.0
#define BED_NTC 100000.0

Other standard thermistor types that RepRapPro uses are already in configuration.h, commented out. If you change to these types then comment out the lines referring to the EPCOS and uncomment the lines for the thermistor values that match yours. For example to use the latest RepRapPro thermistor values comment out:


// EPCOS B57560G104F (the standard 100K one)
//#define E_BETA 4036.0
//#define E_NTC 100000.0
//#define BED_BETA 4036.0
//#define BED_NTC 100000.0

and uncomment

// RS 198-961
#define E_BETA 3960.0
#define E_NTC 100000.0
// Rapid 61-0446 ; Semitec 103GT-2 All RepRapPRo Mendels and Thermistors shipped after 1/4/13
#define BED_BETA 4126.0
#define BED_NTC 10000.0

Temperature at Print Start

Line 137
#define TEMP_RESIDENCY_TIME 10 // (seconds)
#define TEMP_HYSTERESIS 3       // (degC) range of +/- temperatures considered "close" to the target one
#define TEMP_WINDOW     1 // (degC) Window around target to start the residency timer x degC early.

These allow you to control how close to the exact set temperature the thermistor reading needs to be to begin extruding. The defaults work OK, however to get a quicker start, I change my TEMP_RESIDENCY_TIME to "5" and TEMP_WINDOW to "2".

Max and Min Temperatures


The printer will give an error if the temperatures are outside of these values. I find that in a cold garage in winter the MIN_TEMPs need to be "1" rather than "5". Don't comment out or set to 0 or else the hotend could overheat if the thermistor is disconnected or breaks.

Line 144-155
#define HEATER_0_MINTEMP 1
....
#define HEATER_0_MAXTEMP 275
....

PID Temperature control


In order to get more stable extruder temperature control the use of PID control is recommended. To enable it ensure PIDTEMP is uncommented.

Line 164
#define PIDTEMP

You need to set the PID constants specific to your hotend. See Wikipedia theory on PID control if interested (not required to make this work):-

Line 178 onwards
    #define  DEFAULT_Kp 22.2
    #define  DEFAULT_Ki 1.08  
    #define  DEFAULT_Kd 114 

By far the easiest way to calculate these is to use PID autotune once your firmware is uploaded to your printer. This function experiments with the reaction of your hotend and calculates the best PID values. For more detail of PID autotune check this wiki entry. Once you have the values you can save them to EEPROM (see the section later in this guide about enabling EEPROM) or you can replace the values in the firmware (at line 178 as shown above) and re-upload your firmware.

You can use PID on the heated bed in a similar manner but I don't find it necessary. To do so uncomment PID_TEMP_BED:

Line 203
#define PIDTEMPBED

and define the constants for your bed. It is best to use PID autotune for this as well, choosing a different target temperature, as suggested in the Marlin comment:

"FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles."

Line 216
    #define  DEFAULT_bedKp 10.00
    #define  DEFAULT_bedKi .023
    #define  DEFAULT_bedKd 305.4

Extruder protection

The following lines prevent extrusion when conditions are not right.

Line 233
#define PREVENT_DANGEROUS_EXTRUDE
#define PREVENT_LENGTHY_EXTRUDE

Only comment them out to override the effect they have if you have a specific reason for doing so.


Endstops

For Sanguinololu, RAMPS, Melzi and most other common electronics all the endstop pullups should be on - ensure line 248 is uncommented:

Line 248
#define ENDSTOPPULLUPS

Generally you want the endstops to trigger when open: this is controlled with the following lines:

Line 270
const bool X_ENDSTOPS_INVERTING = false; // set to true to invert the logic of the endstops. 
const bool Y_ENDSTOPS_INVERTING = false; // set to true to invert the logic of the endstops. 
const bool Z_ENDSTOPS_INVERTING = false; // set to true to invert the logic of the endstops. 

For more information on endstops and why it is generally better to have Normally Closed Endstops have a look at this part of the Reprap wiki and the linked forum post.

Axis direction is controlled by the motor wiring and by these lines:

Line 287
#define INVERT_X_DIR false    // for Mendel set to false, for Orca set to true
#define INVERT_Y_DIR false    // for Mendel set to true, for Orca set to false
#define INVERT_Z_DIR true     // for Mendel set to false, for Orca set to true

Many printers only have 3 endstops, one per axis, so you have to tell the firmware which end to home towards:

Line 296
// Sets direction of endstops when homing; 1=MAX, -1=MIN
#define X_HOME_DIR -1
#define Y_HOME_DIR -1
#define Z_HOME_DIR -1

This combined with the length of the axis sets the dimensions of the printer. It is worth using software endstops to keep the print head within the print area during normal operation:

These need to be set to the correct values for your printer or else you can command the printer to move outside of the area it can cover and potentially cause damage.

Line 300
#define min_software_endstops true //If true, axis won't move to coordinates less than HOME_POS.
#define max_software_endstops true  //If true, axis won't move to coordinates greater than the defined lengths below.
// Travel limits after homing
#define X_MAX_POS 205
#define X_MIN_POS 0
#define Y_MAX_POS 205
#define Y_MIN_POS 0
#define Z_MAX_POS 200
#define Z_MIN_POS 0

I find that it is safest with a new printer to set the MAX_POS values to less than the maximum theoretical sizes, then physically check how much more travel is possible and adjust the values upwards if appropriate.

Movement Settings

These settings define how fast your printer's axis move and set the accuracy of moves. In most cases there will be a direct copy from the configuration.h file of your printer supplier. First is the speed the axes move during homing; this is in mm/s and the format X,Y,Z,E. E is 0 because the extruder is not homed.

Line 325
#define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)


The next line defines how many steps of the stepper motor are required to move an axis by 1mm. Getting this wrong means the printer axis will not move the right distance. You MUST change the settings from the defaults (unless you actually have an Ultimaker!). Once again the format is  X, Y, Z, E. Prusa's calculator is very helpful for calculating the appropriate X, Y and Z values for your stepper motors, belt pitch and pulley teeth. For E, because hobbed bolts all vary slightly, the only way to get the correct value is to start with a reasonable value (e.g. 700 for a Wade's) and calibrate your extruder: RichRap's Slic3r blog provides detailed instructions for doing this.

Line 329
#define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200.0*8/3,760*1.1}  // default steps per unit for ultimaker


The following lines set the speed and acceleration of your printer. Often the quality of prints can be improved by using slower acceleration values and smaller XYJERK values. They definitely need setting down for less-rigid machines with threaded-rod frames. Check the default values in the Marlin as supplied with your machine and use these to start with.

Line 330 Onwards
#define DEFAULT_MAX_FEEDRATE          {500, 500, 5, 25}    // (mm/sec)
#define DEFAULT_MAX_ACCELERATION      {9000,9000,100,10000}    // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot.

#define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves 
#define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for r retracts

// The speed change that does not require acceleration (i.e. the software might assume it can be done instantaneously)
#define DEFAULT_XYJERK                20.0    // (mm/sec)
#define DEFAULT_ZJERK                 0.4     // (mm/sec)
#define DEFAULT_EJERK                 5.0    // (mm/sec)

EEPROM - Saving Settings without recompiling firmware

When EEPROM is enabled there are three locations where versions of the printer settings are stored.
  1. Hard-coded in Firmware in Configuration.h.
  2. In the running RAM of the microcontroller - not saved on power down or reset.
  3. In EEPROM
If EEPROM is enabled the settings are loaded from EEPROM, not from the hard-coded values in Configuration.h. EEPROM settings can be updated using a series of "M" commands. See the G-Code page on the RepRap wiki for a description of all the G and M codes including those for saving and reading from EEPROM.

I recommend enabling EEPROM_SETTINGS and EEPROM_CHITCHAT
Line 356

//define this to enable eeprom support
#define EEPROM_SETTINGS
//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out:
// please keep turned on if you can.
#define EEPROM_CHITCHAT

Display Screens - Panelolu2

There are an increasing number of LCD screens supported by Marlin, but this post only covers the Panelolu2. To enable the Panelolu2 uncomment the following line:

Line 381

#define PANELOLU2

If you don't like the buzzer making a beep sound then comment out the PAN_BEEP

Line 386
 #define PAN_BEEP //comment out to disable buzzer

I recommend that you get your printer working without enabling the Panelolu2 first and then uncomment the #define PANELOLU2 line afterwards. Note that Marlin will hang if the PANELOLU2 is enabled but not connected.

Thats it!

Please feel free to leave useful links to further information in the comments to this blog post.

Wednesday, May 15, 2013

Algebraic Thermistor readings

As part of a larger piece of work to make it easier for users of RepRapPro Marlin to use a Panelolu2 I have implemented RepRapPro's use of maths to convert the raw ADC values from the thermistor inputs into temperature readings.

The maths in question is the B parameter equation which uses the Beta value specified for NTC thermistor to approximate the curve.

I added the following code to temperature.cpp:-


float analog2tempi(int raw, const float& beta, const float& rs, const float& r_inf)
{
   return = ABS_ZERO + beta/log( (raw*rs/(AD_RANGE - raw))/r_inf );
}

along with some #ifdef ALGEBRA_TEMP to compile the computational functions and information only if required.

In order to use this, download the latest version of the T3P3 branch of Marlin and make the following changes to Configuration.h


//use RepRapPro Algebraic Temperature calculation rather than
//the tables - still experimental in this version of Marlin.
#define ALGEBRA_TEMP 

and define the series resistor and Thermistors specific to your setup:


// Uncomment ONE of the next two lines - the one for the series resistors on your controller (most common is 4700)
#define SERIAL_R 4700
//#define SERIAL_R 10000

// EPCOS B57560G104F (the standard 100K one)
#define E_BETA 4036.0
#define E_NTC 100000.0
#define BED_BETA 4036.0
#define BED_NTC 100000.0


The data sheet for your thermistor will give the Beta value, the E_NTC or B_NTC is the value of the thermistor at 25C which for a "100K" thermistor is 100 000.

Warning: This is only tested with a variable resistor and an EPCOS B57560G104, and the equation used is an approximation - it is not as accurate as a well defined table.

To do: Investigate using a better equation, such as the equation that Nophead describes here which is in the new createTemperatureLookupMarlin.py script in Marlin.


Wednesday, April 24, 2013

Panelolu2 for RAMPS and Printrboard

Panelolu2 LCD display and control solution working with RAMPS 1.3 and Printrboard.

Finally they are here, the much requested adapter boards that allow the Panelolu2 to interface with RAMPS 1.3 and Printrboard. For details on the background of the Panelolu2, along with more details on how to set it up, how the print the enclosure etc, please see the previous post.

RAMPS 1.3 Adapter

The first point to note is that due to physical differences between RAMPS 1.3. and 1.4, this adapter is sized for RAMPS 1.3 and will not fit on RAMPS 1.4.




In a similar way to the Melzi and Sanguinololu adapters, the RAMPS 1.3 adapter has two MOSFETs that can be used to switch fans or other small loads. This allows the RAMPS 1.3 with Panelolu2 to control two extruders each with their own software controlled fan.

The schematic and annotated diagram below shows the RAMPS pins used and the connections.



View from the bottom


View from the top showing the purpose of each connector


Transistor 1 is connected to Arduino digital pin 45 which can be controlled by PWM, Transistor 2 is connected to Arduino digital pin 49, a straight on/off pin. The transistors switch the 12V supplied through the input - this must be connected in order to get any output from the transistors.

The additional expansion header breaks out all the pins not used by Panelolu2 along with the I2C pins if you want to add more devices to the bus.

Printrboard Adapter

This is tested on Printrboard Rev D & E only as I do not have an earlier revision boards to test with.



For the Printrboard Adapter I decided to go for a minimalist approach. There are no additional MOSFETs - it is simply a physical adapter. The reason for this is twofold; firstly the Printrboard already has an onboard MOSFET to switch a fan and secondly, with the default fuse settings, there are no spare pins on the EXP 1 header.



As can be seen from the Schematic above the only pins left unused (and broken out to header SV1) are TDI, TDO,TMS and TCK. These are set as JTAG pins by default although they can be configured for use as I/O, this process is detailed in this blog post. I could have gone with an adapter board that connected to both EXP 1 and EXP 2 on the Printrboard but decided that small was best in this case.



Marlin Firmware Setup

The T3P3 branch of Marlin, available from github, has been updated to include support for the Panelolu2 on Printrboard and RAMPS. Every printer configuration is slightly different but the generic workflow for updating your firmware to support the Panelolu2 is as follows:



  1. If you are not already using it get the standard version of Arduino-0023 from the Arduino website, note that this version of Marlin has not been tested with Arduino 1.0 or higher.
  2. Get T3P3 Marlin from github.
  3.  For Printrboard follow the reprap wiki advice to get up and running with firmware, Lincomatic's blog post is also useful. For RAMPS, support for the Arduino Mega 2560 is built into standard arduino
  4. Get LiquidTWI2 as mentioned in my Panelolu2 blog post, note that configuration changes are no longer required in the latest version of LiquidTWI2.
  5. Modify the configuration.h of the Marlin to fit your printer setup (setting like controller board, axis dimensions, thermistors, etc). Update: This blog post should help.
  6. Confirm Marlin compiles and uploads with //#define PANELOLU2 still commented out in configuration.h.
  7. 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.
  8. Check the printer operation and calibration to ensure you have edited the Marlin configuration.h properly.


Getting one

As always the hardware is open source so the design files are available on Github:
https://github.com/T3P3/Panelolu2.

Update: Now available on eMakershop and Ebay.




Saturday, April 6, 2013

Rostock build


Rostock build

After much delay due to other projects I finally got a chance to put together a Rostock delta printer. My build log is below, I have made a few minor changes compared with the original design in order to use 3mm filament and incorporate a few good ideas I saw on thingiverse and various blogs. Here is a bit of video to give an overview of the printer in action - printing the first print, a dual spiral lightbulb.



As you can see from the video I now need to work on the speed and retract settings to improve the quality and reduce the stringing.

Adaptations

I initially printed the standard Rostock parts from thingiverse, but a common suggestion is to change to fibreglass or carbon fibre rods so I decided to change to carbon fibre rods with the Traxxas rod ends. Half way through the build I switched to 0xPIT's version of the end effector platform which is designed specifically to mount a J Head hotend with minimal issues that works well with Traxxas rod ends.

I used nophead's version of the Wades extruder rather than the Rostock standard extruder as I am familiar with these extruders and I want to use 3mm filament. In the future I
 may look at changing the gear ratio to balance speed and torque as shown on Billy D's blog, which is an excellent source of Rostock printer tips.

Build log

I used 10mm plywood and marked out the drill holes using measurements from this thing and checked them with the printable jig. After drilling I painted the top and bottom boards before mounting the motor and idler ends.

Other than for the inner motor mount fixings I used wood screws through the plywood into the plastic parts which cut their own thread into the plastic.

Added all the securing fasteners and then the rods with the LM8UU linear bearings already fitted:

The rods were cut to the same length and aligned at the bottom of the motor ends and top of the idler ends but precise alignment is not critical as the endstops are adjusted during calibration.

At the idler end I used 2x624 bearings with various washers (similar to the X and Y axis idlers on the Mendel90).These are mounted on an M4 bolt - the one in the picture is a little long, however M4x40mm should work well.

I adapted the idea from Frank Neon's blog pictures to use zipties to hold and tension the belt. The adaptation keeps the zip tied section short to avoid fouling on the stepper drive gear even when the carriage is at its lowest point.

Ziptie prior to applying tension:

After tension applied and excess cut off:

Before tightening the pulley's grub screw, move the carriage to the bottom of the axis to aligh the pulley to the belt.

To help stiffen the frame two wooden sides are added. I used the printed Mendel90 fixings to secure these.

The complete frame showing the fixings:

The Traxxas rod ends have an ID of approximately 3.5mm which I drilled out to 4mm to fit the 4mm carbon fibre rods. As suggested in a number of places I used a wooden jig to ensure all the rods were the same length.

The ends of the carbon fibre rods needed to be lightly sand papered to fit into the 4mm holes, a thin layer of super glue holds them in place. Below is a picture comparing the carbon rods with Traxxas ends to the original printed rods.

Next I fitted the rods to the carriages and the end effector platform. After wiring the motors and endstops up as per the wiki page, I attached a Dial Test indicator for calibration.

Using the calibration guide here to level the end effector platform to the bed, It took a number of iterations but by the end there is less than 0.05mm difference between the Z "0" position in front of the three axes and the center of the bed.

I then replaced the DTI with a JHead hotend and connected the PTFE bowden tube (4mm ID, 6mm OD). The long nut shown below threaded the tube and grips well but I will probably replace this with a push fit connector at each end.

The JHead is wired up as standard with the wiring wrapped around the bowden tube.

To hold the PTFE tube at the other end I used the Bowden Clamp for Rostock. Zipties did not appear strong enough so I replaced them with a Jubilee Clip.


I mounted the extruder drive a little over half way up the frame through one of the wooden boards with enough slack in the bowden tube that the entire print envelope can be reached without excessively small diameter bends of the PTFE:

After calibrating the E steps per mm I started the first print. Overall the build time was a little over 8 hours work (spread over a few days), including taking pictures and searching for information. One of the advantages of the Rostock is the reduced part count and simpler assembly in comparison to the Prusa Mendel.

To do

  • Experiment with retraction and speed settings to improve print quality.
  • Confirm dimensional accuracy across the build area.
  • Mount a fan for extruder cooling to print PLA.
  • Replace the current bowden cable ends with push fittings.
  • Experiment with various extruder mounting locations.
  • Print something really big!
  • Multiple hot ends for multiple colour printing.


Tuesday, March 12, 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 eMakershop and eBay

Friday, February 15, 2013

Panelolu2

Panelolu2 - An I2C control solution for Sanguinololu, Melzi and more

The original Panelolu was designed to provide a simple user interface for a 3d printer controlled by a Sanguinololu and similar electronics - enabled by the Ultipanel code within the Marlin firmware. By connecting to the right pinouts it also works with Printrboard and RAMPS.

I have developed a new version which uses an I2C port expander to drive the LCD screen and adds a piezo buzzer and indication LEDs. This version uses less pins, making it compatible with the Melzi electronics and even leaves enough spare pins to drive a couple more outputs (such as an additional extractor fan and stepper driver cooling fan).


Panelolu2 Front View
  
In the photo above the grid covers the piezo buzzer and the H,E and F LEDs indicate that the Heated bed, Extruder and Fan (or second extruder) are on. It would be relatively simple to change the firmware to have these LEDs turn on for another reason. The R for reset and the encoder wheel are the same as in the original Panelolu although I have made the encoder wheel about 1/3 smaller to fit better. 

Circuit board

The Panelolu2 design simplifies the assembly by mounting all components on one circuit board that can be soldered directly to an LCD screen. The standard way to connect it to the screen is with a single row of 2.54mm headers as shown below. This row of headers could be replaced by wires (ribbon cable would be best) - enabling a variey of case designs, such as Printbit's Panelolu Box for Mendel Max.


This simplification also extends to the wiring which is now a 2x6 IDC plug on both ends of a ribbon cable. The circuit uses a combination of through hole and surface mount components; the other side of the prototype circuit board is shown below. The brightness and contrast pots are now on the back of the board and can be adjusted through the rear of the case.



I have tidied up the Schematic: the components are the MCP23017 port expander, the SD card circuitry, buzzer, click encoder and LEDS.

 

Of course the whole project is Open Source Hardware and the eagle files are available on github.

Case design

As mentioned above, the circuit board and LCD allow for multiple case designs. I have made a simple case with a back leg allowing the Panelolu2 to sit on the bench alongside the printer.
 
Panelolu2 Side View 

The case design is all done in OpenSCAD with both .scad and .stl versions of the files, available on Thingiverse. One of the great things I have found about Thingiverse is it allows you to embed the Thingiviews of the STL files, so here are the front and back case views:

Front
 
 
Back
 



The OpenSCAD file also allows the back leg to be generated to support the case at your chosen angle. For the rotary encoder I adapted Miserybot's "Spinner Knob" design to make it about 1/3 smaller and a lot thinner - the .stl is on Thingiverse and I will upload the OpenSCAD code once it is cleaned up.


Adapter Boards

One of the aims of the Panelolu2 was to reduce the complexity involved in wiring it up. I have designed adapter boards to allow compatibility of the Panelolu2 with various electronics. The picture below shows the adapter board connected to a Sanguinololu.



In overview the picture below shows the inputs and outputs from the prototype Melzi adapter board.

For basic operation the ISP and expansion header plug into the Melzi and the Panelolu plugs into its 2x6 connector. If desired FETs can be mounted to switch a 12V supply, for example to drive external fans.

As an alternative to the adapter board, standard female housings with crimp connectors could be used. I intend to design boards for Printrboard and RAMPS in the near future.
(update: done, see this blog post)

I2C encoder option 

Instead of linking the encoder and switch directly to pins on the Sanguinololu, Melzi or other electronics, the hardware has the option to run the encoder and switch over I2C. This would free up a couple more pins but the option is not yet supported by firmware. The Panelolu2 circuit board and adapter boards have solder jumpers, shown below on the back of the Melzi adapter board



Currently the firmware does not support routing the encoder signals over I2C so by default these jumpers will be set for normal operation.


Firmware 


The Panelolu2 only runs on Marlin firmware at the moment. Excellent work was done by Daid in the Marlin code to split the LCD screen hardware from the user interface. This made it straightforward to implement the Panelolu2 code. As mentioned in previous posts LiquidTWI2 by Lincomatic is required; download it from github, rename the directory from "LiquidTWI2-master" to "LiquidTWI2 and put it in the

arduno-0023/libraries/

sub-folder.

UPDATE: - This step is no longer required in the latest version of LiquidTWI2 (1.2.4) the library will work out the box with no configuration changes required.

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....


To

    #define PANELOLU2 //only possible....
 

Continue following the instructions from here:

Then download the T3P3 fork of Marlin, make the changes you need to configuration.h to suit your printer and ensure :

#define EEPROM_SETTINGS
and

#define PANELOLU2

are uncommented within configuration.h then upload as normal. The compiled Marlin is ~100k, a very similar size to Marlin compiled for the original Panelolu, so the electronics board will need enough space (a 1284P is fine, a 644P does not have enough space).


Summary

Update, added this section to summarise the process of getting the Panelolu2 working Sanguinololu.


  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. If you are not already using a Sanguinololu with 1284P then 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. If you are not already using a Sanguinololu with 1284P 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 above, 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 existing 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

As always the hardware is open source so the design files are available on Github: https://github.com/T3P3/Panelolu2.

Update: Now available on eMakershop and eBay