Sunday, 20 January 2013

Huxley #710 - I2C Panelolu Test...

Sanguinololu Huxley #710 connection to I2C And Panelolu 2
I received the Microchip MCP23017 I²C I/O Expander parts this week and put one on a prototype board to test out with the Sanguinololu hardware on Huxley #710. This implementation is intended to be compatible with the Panelolu I²C update.

Background
The intended configuration consists of the MCP23017 connected to a parallel LCD display device based on the Hitachi HD44780 device.  The MCP23017 device has an I²C connection (I2C) which can control 16 input / output lines. The input / output line direction can be configured independently.  There is an interrupt feature, where the chip monitors configured input lines and generate an interrupt when a change occurs. Useful, as the CPU can get on with other things and respond to an interrupt when it feels like it, without having to poll pins configured as inputs.

Using the I2C rather than a 4 bit parallel connection, releases I/O pins on the Sanguinololu board for things such as multiple extruder heads! Additionally more hardware can be tacked on the end of the I2C channel, less wires are needed and they can be screened more easily.

You can see my previous implementation using a more constrained I2C device here

Note
Huxley #710 Microchip I2C Panelolu Test
Although there is quite a thick ribbon cable running to the prototype board, only 4 wires in use!
The lead was recovered from an old personal computer and I use it for prototyping connections as it saves me making up cables until the project is stable. You can just see the connections from the ribbon cable at the back of the ribbon connection to the prototyping board.

There are two connections for the I2C (Yellow and White) and 5v power supply (Red and Blue) to the power strip at the rear of the prototype board. The LCD connections are 4 bits for the communication, 3 bits for RS,RW and E of the HD44780 compatible display unit.

Microchip I²C I/O Expander

Huxley #710 Sanguinololu Rev 1.3a PCB
Connections To EXT Connector

+5v
0v
SDA
SCL
Reset - later


The resistor (10kΩ) shown connected to the Microchip MCP23017 part is connected to the MCP23017 reset line to make sure that the reset line is not floating. The reset line could be tied to the reset on the expansion socket of the Sanguinolou board, but for the moment I thought I would do without it for testing.

The connector being used is the EXT connector which is the 14 way connector next to the ISP/SPI port connection used to program an Atmel device or connect an SPI device such as the SD card.
Huxley #710 Sanguinololu Rev 1.3a PCB Expansion connectors

On the Huxley machines the SD card connects to the ISP/SPI port and two pins on the EXT connection. One of the pins is not used (SCL/D16). The other pin, A0 pin acts as the device select line for the SD card. In principle more SPI devices can be added to the interface. Each requiring a device select line (more on that later). When the final display unit is implemented this pin will be used together with the SDA/D17 line.
Sanguinololu Rev 1.2 PCB Render

To test out the connections to the MCP23017  I used a small piece of software called I2C_scanner. It's really cool because it does not use any third party libraries and reports any device hanging off the I2C bus. You can find it here in the Arduino Playground.

I compiled this and downloaded it onto Huxley #710 to determine if the I2C device could be seen by the ATMega part on the EXT connection. The program scans all the I2C addresses from 0 to 127 and writes what if finds to the serial port, which you can monitor using the Serial Monitor (Ctrl+Shift+M key combination) in the Arduino software. I am now on 1.0.3 of Arduino by the way. You can see the output on the terminal screen shows that a device is present at address 0x20 which is the correct address for the MCP23017 with all the address lines held at 0v.

I2C Scanner output screen on the terminal
The output from the I2C scanner software on the serial terminal monitor in the Arduino software is very plain, but when you are hooking things up you don't want bells and whistles!

Having verified the hooked up Microchip I2C device, I connected the display to the I2C device and get the library working that Tony has selected for use with the I2C Panelolu device.

Testing with the LiquidTW2 Library
Testing with the LiquidTWI2 library next using the sample programme I had changed the code so that it would intialise the MCP23017 in the setup routine initially, I had issues compiling the Hello_i2C_LCD.ino sample programme. My code fragment looked like this:
// Connect via i2c, default address #0 (A0-A2 not jumpered)
LiquidTWI2 lcd(0x20);  // SC All MCP23017 address lines pulled to 0V


void setup() {
// set the LCD type
// lcd.setMCPType(LTI_TYPE_MCP23008);
  lcd.setMCPType(LTI_TYPE_MCP23017);
// set up the LCD's number of rows and columns:
lcd.begin(20, 4); // I have a 20 character by 4 line display
// Print a message to the LCD.
lcd.print("hello, world!");
}


This gave rise to the error shown below:
Hello_i2C_LCD.ino: In function 'void setup()':
Hello_i2C_LCD:26: error: 'class LiquidTWI2' has no member named 'setMCPType'


The error seemed to be with the definition of setMCPType however following an exchange with Lincomatic on GitHub who indicated that the setMCPType only needs calling if both devices are used. So using the following in the Hello_i2C_LCD example:

// lcd.setMCPType(LTI_TYPE_MCP23008);
// lcd.setMCPType(LTI_TYPE_MCP23017);



With both setMCPType lines commented out, the code compiled and downloaded successfully running the display as expected.

Latest news - an update library has been released (20 Jan 2012) which allows the definition to be retained as shown in the code shown above handling the issues internally. So I imagine either way will work now.

Next stop, integrate all this into Marlin - configure, design a custom panel and have fun...

I2C - LCD Test connection to Huxley #710

Tuesday, 1 January 2013

The futures Borosilicate...perhaps

Bath University April 2012 - The calm before the storm!
Amongst many of the comments passed whilst building Huxley #710 at Bath University. One stuck in my mind made when watching the guys print a parliament of Owls. We had seen filament being wiped by a sponge before entering the printer. But I also noticed glass on the table of one of the printers rather than the more usual Kapton tape. Whilst discussing the pros and cons, out popped the comment "Adrian Bowyer only prints on glass now". At the time we were reviewing his machine which had, amongst other things an interesting X carriage.

Now one of the things that sticks in my mind from physics at school, from a superb physics teacher (Mr J Jarzecki), was that heat and glass don't mix! To the amazement of the class and without safety net (although I do recall safety glasses, he was very advanced!) he applied heat from a bunsen burner to the center of a piece of glass to show that the glass expanded where heated and not away from the heat i.e. unevenly creating stresses in the material. Sure enough it did! Splitting, with rather a loud crack and if I recall the glass fell off the metal tripod it was positioned on with a smack.

When living in France, many years later, in the summer of 2003 (El Niño year), I asked for some windows to be painted to block the heat from the sun. I had expected them to be painted white, to my amazement they were painted black! Sure enough they cracked, probably as the steel frames were restricting the expansion and putting the glass under strain. Mr Jarzecki was right!

You can therefore imagine why I opted to reserve judgement on the glass table, until I had the opportunity to ask a few more questions and do some research.

Unfortunately my research left me no clearer as to an answer, simple and straight forward. On the one hand, some blogs seemed to indicate problems with PLA on glass. Then others seemed to say it was the greatest thing since - well, sliced bread.


Here are a few:
http://hydraraptor.blogspot.co.uk/2010/05/pla-on-glass.html
forums.reprap.org/read.php?1,35071,49047#msg-49047
forums.reprap.org/read.php?1,33327,51041#msg-51041
http://www.emakershop.com/forum?vasthtmlaction=viewtopic&t=592.0
http://www.emakershop.com/forum?vasthtmlaction=viewtopic&t=48.0
https://groups.google.com/forum/#!topic/bay-area-reprap/or_mVVH-y9g

And I am sure there must be quite a few more read.

Adrian Bowyer - Printing on glass

After hunting around for some glass ideally very cheap, if not free. I found some picture frames in IKEA with glass. These are getting rarer now as they seem to be moving to plastic sheet. Whilst thinner than the glass recommended by Adrian Bowyer (see video), I thought they should do. Additionally they had nice rounded edges. The thought of the Y table slicing my fingers off and the blood mucking up a print was vivid in my mind. I also didn't want the boys to slice themselves up!

As you might have guessed, no matter what I tried, I could not get PLA to stick to the stuff. It was OK in the middle but would peel from the edges readily and did not seem to have the adhesion that printing on Kapton tape gave. I tried all sorts of temperatures up to 100C in 5C increments. Cleaning the glass with nail varnish (Tesco brand no fancy additives). Measuring the temperature with traceable measurement equipment to ensure the required temperature were being reached on the surface of the glass and so on. Mr Jarzecki would be proud of the scientific approach, but all to no avail. Every print curled off the table from the edges, although the surface was superb. So I used the glass as an interchangeable table upon which I applied the Kapton tape; which was significantly easier that trying to place it on the Aluminum print bed directly!

I had almost given up on totally smooth surfaces like Nophead's, not fooling with Kapton tape for an hour to get all the bubbles out and the tape aligned nicely so there are no big gaps!

In the depths of my research on the topic I did however remember reading about Borosilicate glass (aka Pyrex) in a few locations and this seemed like a reasonable idea as it should at least withstand pretty poor thermal coupling and thermal cycling likely to arise from localized hotspots on the table and frequent use. Additionally I had not used the thickness recommended by Adrian, so perhaps some room for improvement.

With this in mind, I purchased some Borosilicate glass which was only available in 3.3mm thickness but that's twice the thickness of the IKEA picture frame glass. It was expensive, at least the 140mm by 140mm sheet I purchased was. Additionally the shop told me "it's a devil to cut" and the glass specialist told met they can not round the edges. So 25 UKP later I have some Borosilicate glass set up on Huxley #710.

The performance to date has been superb!

Borosilicate Glass Table Recipe
Table surfaceBorosilicate glass 3.3 mm
Table temperature60C
MaterialPLA - Faberdashery Arctic White
Extrusion temperature196C
Huxley #710 printing PLA on Borosilicate glass

Borosilicate Glass Table Technique
Heat the table to 60C, ensure its the top of the glass table at this temperature. I have a 20C thermal gradient between the indicated table temperature and my thermocouple bead on the top of the glass. Allow at least 5 minutes to thermally soak. Print the part, if using a fan I start it after the first layer has completed as the table will cool a little with the fan on. I leave the table heated throughout the print.
At the end of the print allow table to cool with fan. The part always seems to comes off readily by hand once the table has dropped below about 40C. Frequently there is a little crack as the tension of the plastic relieves once the table releases the part. If your fan is too power full it could blow the part off the table!

For PLA at least, no scraping, aligning tape or bashing parts to get them off! The futures Borosilicate for Huxley #710!






Adrian Bowyer video location
http://reprap.org/wiki/Mendel_User_Manual:_Host_Software#Heated_beds