Sunday, 27 September 2015

Fail and Fail Fast - Leetro Controller vs PAD03


Not every project can be a success and there is a popular mantra that you should fail and fail fast. You learn from failures and the sooner you get them out the way the sooner you can move on to the right ways. I don't have a lot of failures, I have a lot of projects that get put on hold until I know how to progress them, some of them are on indefinite hold at the moment. Tonight's project has been on the cards for a few months but it failed and relatively quickly so I thought I would write about it as I'm no longer working on it.

A lot of Chinese laser cutters come supplied with the Leetro controller MPC6515 or MPC6535, both use the PAD03 display panel to communicate information to the user. The system has a fair few quirks but the one that really bugs me involves the Z axis adjustment. You press 'Z' to move into the height adjustment mode but pressing 'Esc' does not get you out of the mode, you have to press 'Z' again. The idea is simple though break into the loop between the panel and the controller, catch the 'Esc' key as it is pressed and turn it into a 'Z' key press so that the controller leaves Z mode.


We know from the manual that the panel communicates via RS485 and at 9600 Baud using a Modbus protocol. There are a few modbus interpreters for arduino so I bought 2 level shifters to convert from RS485 levels to TTL levels. I chose the Arduino Mega because it has 4 hardware serial ports. The test set up has the controller connected to the Arduino on serial 1 and the panel connected to serial 2. The software just relays bytes from one serial port to the other but it also copies those bytes out to the PC so the data can be seen on a screen with a serial terminal. I had hoped to catch the text data being sent to and from the panel.


With everything connected and the data relayed back to the PC I turned the system on. Data was successfully passed through the Arduino to and from the controller, the system functioned normally despite the Arduino in the loop. Pressing buttons on the panel created additional data on the screen so it should have been easy to spot the key presses. I switched the panel into z mode and started pushing buttons. Only the 'Up' and 'Down' buttons were actually passed back to the controller, none of the other buttons were.

The conclusion is fairly simple. The panel understands that it is part of a laser cutter system, it's not just a dumb terminal reflecting information from the controller. It is the panel that switches the display into 'Z' mode and it is the panel that prevents it from coming out again. The project was a bust but I learned more about the system in the process and that is useful in itself.