Friday, 15 February 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.



Update added the Sanguinololu and Melzi adapter schematics:



As can be seen from the schematic the two mosfets for driving additional light loads such as fans are on the PWM and A3 pins on the Sanguinololu. These pins can be accessed as Arduino digital pins 4 for the pin labelled PWM and 28 for the pin labelled A3. In Marlin firmware to turn on the fan connected to Transistor 1:

M42 S255 P4

And transistor 2

M42 S255 P28

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


The Schematic for the Melzi adapter board is:



The same logic as described the solder jumper operations on the Sanguinololu adapter board applies to the Melzi board. For the two additional outputs they are on pin A4 and A3 which are digital pins 27 and 28 respectively.In Marlin firmware to turn on the fan connected to Transistor 1:

M42 S255 P28

And transistor 2

M42 S255 P27

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 our webstore and on eMakershop and eBay 

50 comments:

  1. Any chance you are working on a breakout board for the Panelolu 1? Something that would house the 23017 and plug into the Sanguinololu and existing Panelolu connector.

    ReplyDelete
  2. Hi

    I had not planned to but it would be straight forward to design. I wonder if there would be much demand for such a board?

    Tony

    ReplyDelete
  3. Any news on getting the parts/assembly in you emaker shop?

    ReplyDelete
    Replies
    1. hey Bas

      The plan is to list them this weekend! I will comment on this thread once thats done.

      Tony

      Delete
  4. Great work, Just sent off to have a board made. Just a quick question, what are the solder jumpers on SJ1 and SJ2?

    Thank you for your hard work and sharing this with us!

    ReplyDelete
    Replies
    1. Hey Joe
      The solder jumpers on the adapter boards are to choose between routing two pins to the Panelolu2 circuit board for the encoder or to the expansion header on the adapter board. This is to allow the pins to be used for another function if the encoder output is routed over I2C. There is a similar solder jumper on the Panelolu2 circuit board for the click switch on the encoder to route via the port expander.

      Due to the way Marlin handles reading the encoder, using it over I2C is not currently supported in firmware. The solder jumpers mean that when this is supported in firmware it is relatively simple to change the encoder pin routing in the hardware.

      Tony

      Delete
  5. The Panelolu2 is now available on eMakershop:

    www.emakershop.com/browse/listing?l=501

    Tony

    ReplyDelete
    Replies
    1. Any ETA on the version with Melzi adapter?

      Delete
    2. Hey Bas. The Melzi adapter pcbs are planned for assembly towards the end of this week. If all goes well I should be testing them this weekend.

      Delete
    3. Thanks for the quick reply, looking forward to ordering one.

      Delete
    4. The next blog post describes the Melzi adapter, we will be listing them soon.

      Delete
  6. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Im am looking for the voltage regulator used, looking for LM340MP-05 I can only find LM340MP-5.0 which I am assuming is the same thing, but it says it is a 10v in to 5v out regulator, where your schematic says 5v in to 3.3v out, am I missing somthing or am I just not finding the correct part?

      Also, I was curious about the mosfets used in the breakout board, i am assuming they are just 5v base with 12v collector?

      Thanks again!

      Delete
    2. Hey Joe

      The package used in Eagle was initially purely for the footprint and I forgot to change the model to the right one:
      MIC5209-3.3YS
      I will update the eagle files on github when I get a chance.

      The break out board can use a variety of N channel fets. As long as the pins can be made to fit, they turn on enough with 5V at the gate, can handle a Vds of 12V or and the current your fan is going to draw. The outline is for a TO220 but we are actually using these ones:
      http://www.fairchildsemi.com/pf/RF/RFD14N05L.html
      They fit well and are much smaller, logic level is not essential when driving a small load like a fan.

      Tony

      Delete
  7. ok probably me being an idiot. Plugged my panelolu2 and supplied atmega1284p in and got a blank screen. OK lazy me expecting not to have to set up the firmware so I followed the Frimware instruction above but i can'tprogramme the sucker. If I select BOARD/Sanguino W/A ATmega1284p 16mhz, I get acompile error which tells me:

    In file included from /Marlin.h:23,
    from cardreader.cpp:1:
    /pins.h:785:3: error: #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.

    If I select Arduino Mega all I'm offered is a ATmega1280. This compiles but perhaps not surprisingly times out once it tries to programme.

    Can anyone help?

    ReplyDelete
    Replies
    1. Hi you do need to configure Marlin for your printer and un-comment the line //#define PANELOLU2

      Sounds like you may have the board set to 33 not 62 (Sanguinololu) or 63 (Melzi) in configuration.h

      Tony

      Delete
    2. Thanks Tony that was it. All more or less working now. Great little gizmo this. :-)

      Delete
  8. Just recompiled Marlin as per your instructions and the new panelolu2 has switched on and seems to be working.

    Thanks

    Peter

    ReplyDelete
  9. Hello,

    Can you tell me if the panelolu2 has easy access to send the hot end to the 4 corners and centre and home the z axis to help in levelling?

    Thanks

    ReplyDelete
    Replies
    1. Hi markab

      The menu options do not currently have simple options for sending the bed to specific corners. If you look at the "LCD Menu Tree.pdf" within the marlin firmware on github you can see the menu tree - it allows you to home all axis (in one command) and to move each axis individually.

      Cheers

      Tony

      Delete
  10. Hi Tony,

    Received my panel today thanks, trying to work out the firmware at the moment, my printer is a reprappro mendel with melzi electronics. The RepRapPro runs it's own fork of the Marlin firmware with customisation specific to the RRP.

    How should I go about adding panelolu2 to the reprappro firmware?

    Thanks,
    Mark

    ReplyDelete
    Replies
    1. Hi Mark

      The RepRapPro version for Marlin that is on their github does not have the latest changes to the LCD implementation that I extended for the Panelolu2. I am looking at this now but it will take a bit to work out what is best, merge the Ultipanel & LCD changes into RRP's version or merge RRP's changes into the newer version.

      More to follow.

      Tony

      Delete
    2. Ok Thanks, it's a shame reprappro are not tracking the main marlin changes.

      Delete
    3. Mark

      Please email me to let me know which version of RRP's Marlin are you using "master" or "multimaterial"?

      Tony

      Delete
  11. Hi tony, I am using master at the moment.

    ReplyDelete
  12. Hi Tony,

    since I changed the firmware to T3P3 fork of Marlin, I have problems with my (mechanical) endstops. When they should be triggered they are not always high. It's like in a lottery. With my old firmware version this problem don't exist.

    Any advise?

    Thanks in advance
    Stefan

    ReplyDelete
    Replies
    1. Hi Stephan

      Did you use Marlin previously? if so can you compare your working configuration file with the T3P3 one.

      check the
      #define ENDSTOPPULLUPS

      const bool X_ENDSTOPS_INVERTING = true;
      const bool Y_ENDSTOPS_INVERTING = true;
      const bool Z_ENDSTOPS_INVERTING = true;

      lines as well as ensuring the axis sizes and endstop locations are correct.

      let me know how you get on and feel free to send me an email with your configurations if you are still having problems.

      Delete
  13. Hi Tony,

    Thanks for your help.

    The Solution was a missing block for individual pullups:

    #ifndef ENDSTOPPULLUPS
    // fine Enstop settings: Individual Pullups. will be ignord if ENDSTOPPULLUPS is defined
    #define ENDSTOPPULLUP_XMAX
    #define ENDSTOPPULLUP_YMAX
    #define ENDSTOPPULLUP_ZMAX
    #define ENDSTOPPULLUP_XMIN
    #define ENDSTOPPULLUP_YMIN
    //#define ENDSTOPPULLUP_ZMIN
    #endif
    #ifdef ENDSTOPPULLUPS
    #define ENDSTOPPULLUP_XMAX
    #define ENDSTOPPULLUP_YMAX
    #define ENDSTOPPULLUP_ZMAX
    #define ENDSTOPPULLUP_XMIN
    #define ENDSTOPPULLUP_YMIN
    #define ENDSTOPPULLUP_ZMIN
    #endif


    Stefan

    ReplyDelete
  14. I have added a summary section to simplify the steps to get the Panelolu2 working from scratch.

    ReplyDelete
  15. Hi Tony,
    Merci pour cet aide, le Panelolu2 fonctionne sur ma Mendel90.
    Bernard

    ReplyDelete
  16. This comment has been removed by the author.

    ReplyDelete
  17. Hi,

    Thank you for all your great work on the Panelolu 2!

    I've updated my Panelolu box for MendelMax for the Panelolu 2. Find it here:

    LINK

    ReplyDelete
    Replies
    1. Colin

      Great work, looks very good with the Mendel Max frame. I am also thinking of of making it more obvious that we can supply the LCD and PCB seperately with a ribbon cable between to allow for the screen and encoder/LCDs to be mounted in very different parts of a printer.

      Cheers

      Tony

      Delete
  18. Hi Tony!

    It would have been a great feature if you could trigger the extra output pins (for ex. a fan or LED lighting) from within the menu of the Panelolu2. Any chance that you could add that feature or explain how the coding for that could be done?

    (I'm using my Panelolu2 with adapter board on a Melzi/ Mendel90)

    Thank you,


    Martin,
    Sweden

    ReplyDelete
    Replies
    1. Hi Martin

      The LCD menu code is general to Marlin, not just specific to the Panelolu2. That said it would be good to have a menu option to trigger specific pins. I have so many task on my plate right now that its unlikely I will get to this any time soon but if you have a look at the ultralcd.cpp and ultralcd_implementation_hitachi_HD44780.h you can get an idea of the menu code.

      Cheers

      Tony

      Delete
  19. Got my panelolu2 today, unfortunately I plugged it in and my sangunololu went up in smoke quite literally.
    After a lot of cursing I found I'd neglected two things: I hadn't updated the firmware (don't believe this would cause smoke but I stand to be corrected) and I hadn't checked the correct way round for the ribbon cable on the panelolu. I'd got it the wrong way round I found out later :(
    New sanguinlolu ordered and a reminder stapled to my head to check what way round things go LOL

    ReplyDelete
    Replies
    1. Ow, nightmare - yes it does matter which way round you wire them up. What actually poped on the slolu?

      Delete
    2. The X-axis pololu driver spat some sparks and a puff of smoke... I was hoping it was just the driver then noticed a slight brown patch in the middle of the ATmega and I knew the chip was blown.

      Swapped the stepper driver out and replaced the atmega with an old 644 but repetier couldn't see it on the port, even though the LED on the board lit up, so I figure it blew more than the chip and the driver and the easiest fix was simply to buy a new board.

      Delete
    3. oh, ok, pretty catastrophic, my only concern is you may have blows the Panelolu2 as well - do you have another board to check it on?

      Delete
    4. When connecting the ribbon cable to the panelolu2 should the red wire be at the top or bottom? I looked at the first pic you show and it looks like its at the bottom but in the second pic it looks like the top??

      Delete
    5. Don't have another sanguinololu (yet! LOL) but I do have an ATmega 2560 that I'm hoping to use with ramps on my other half built MM1.5. Perhaps there's some way to rig it up to test the panelolu?

      Delete
  20. Hello Folks
    i'm annoyed by microsoft and Laptops attached to 3D-Printers….so i bought the Panelolu2 for my Sanguino 16Bit….

    i updated the Firmware and the Panelolu works fine…but !
    when i try to "home all"…the Z-Axis of my Mendelmax does very very veeeery little Steps down to the Plate (Endstop)….and the Z-Lift does not work too (that all works when i work with the same files (without panelolu2) from Pronterface….

    so i'm not the coder…would be nice if anyone can help me out of this….

    here is a Dropbox-Link (both Marlins)…..what have i done wrong ??

    https://www.dropbox.com/sh/mec5d1tb8r8kidw/AAB09JnFB5JnZ5UtarLADgwra

    Thanks a lot from Switzerland

    Tom
    tom@rollityler.ch

    ReplyDelete
    Replies
    1. Hi Tom

      Are you using the latest Marlin from
      https://github.com/ErikZalm/Marlin

      I suggest you start with that, enable the Panelolu2 and move your MendelMax settings across to the latest version.

      I have not seen a situation like you describe before where the Z axis speed is different when you send the command from the Panelolu2 and from pronterface.

      Cheers

      Tony

      Delete
    2. Hi Tony

      Thanks for Help...but !

      when i try to upload the following error pops up:

      In file included from /Marlin.h:23,
      from BlinkM.cpp:5:
      /pins.h:1273:3: error: #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.

      i have an Sanguino W/ATmega 1284p 16bit....i can^t find that in pins.h

      ???

      Cheers

      Tom

      Delete
    3. Hi Tom

      You need to modify your Configuration.h to suit you setup. Have a look at my blog post:

      http://blog.think3dprint3d.com/2013/05/basic-marlin-configurationh-modification.html

      Cheers

      Tony

      Delete
    4. cool!

      everythings changed, power on, software upload, Z-AXIS does not wotk....New Pololu....single motor to check if the motors are defective....same effect....
      Panelolu disconnected, old (original) software loaded....everything works except Z-AXIS....

      bevor installing the Panelolu everything works fine....now its "screws up....FU**!!

      sorry but.... ;o(((

      Delete
    5. Hi Tom

      Its almost certainly a configuration problem with the newer version of Marlin. Is the problem still the one you were seeing at the beginning (slow Z movement?).

      Depending on how old your old version of Marlin is it may have some slightly different names for the same settings.

      Cheers

      Tony

      Delete
    6. and now ???

      sanguino is dead, ^my othe 2 printers are working from laptop but this is annoying...thats why i bought 3 Panelolu 2 here to change that.....now i try and the first printer is dead...

      Delete
    7. and now ??

      the annoying printing from notebook....thats why i bought 3 Panelolus here to change my 3 Printers to Standalone from SD-Card....

      now i try to change and the first printer goes up in smoke...

      Delete
    8. Tom

      Please email us and we will send through the configuration howto which should help.

      Cheers

      Tony

      Delete