Our Just Add Sharks Greyfin laser cutter is an awesome piece of kit supplied by a UK based company who really love to engage with their customers – in short Dominic and Martin are awesome community players who love the hackspace movement as much as we do.
But what happens when you want functionality that your machine doesn’t provide? Perhaps you want people to log in and record the timings for billing purposes.
Just Add Sharks use the Leetro controllers in their cutters which means that the software to drive them is Lasercut and a PAD03-E display:
The PAD03-E display talks to the Leetro controller using Modbus over RS232 at 9600 baud, 8 bits, flow control none and 1 stop bit.
Initial attempts to work out what data was coming out of the control panel were unsuccessful, however then I swapped out a suspect lead and suddenly I had data! There’s not much to say about that data at this point but here’s how I generated it for anyone who wants to play along at home… 🙂
We’re going to need install a couple of packages:
sudo aptitude install python-pymodbus python-twisted-conch
I’m using a USB serial adapter on my laptop because I don’t have anything with native RS232.
Now we need to clone the pymodbus codebase from github:
git clone https://github.com/bashwork/pymodbus.git cd pymodbus
Once we’ve done that we can use one of the example scripts to get some data out.
cd examples/common/
We need to make a few changes first:
diff --git a/examples/common/synchronous-server.py b/examples/common/synchronous-server.py index f463864..a404406 100755 --- a/examples/common/synchronous-server.py +++ b/examples/common/synchronous-server.py @@ -105,13 +105,13 @@ identity.MajorMinorRevision = '1.0' # run the server you want #---------------------------------------------------------------------------# # Tcp: -StartTcpServer(context, identity=identity, address=("localhost", 5020)) +#StartTcpServer(context, identity=identity, address=("localhost", 5020)) # Udp: #StartUdpServer(context, identity=identity, address=("localhost", 502)) # Ascii: -#StartSerialServer(context, identity=identity, port='/dev/pts/3', timeout=1) +StartSerialServer(context, identity=identity, port='/dev/ttyUSB1', timeout=.05) # RTU: #StartSerialServer(context, framer=ModbusRtuFramer, identity=identity, port='/dev/pts/3', timeout=.005)
Now we can connect everything up, start the program and then power up the display:
iann@iann-laptop:~/trans/20160616/pymodbus/examples/common$ ./synchronous-server.py DEBUG:pymodbus.server.sync:Started thread to serve client DEBUG:pymodbus.server.sync:Client Connected [/dev/ttyUSB1:/dev/ttyUSB1] DEBUG:pymodbus.server.sync:0x6 0x1e 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 DEBUG:pymodbus.server.sync:0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 DEBUG:pymodbus.server.sync:0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 DEBUG:pymodbus.server.sync:0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 DEBUG:pymodbus.server.sync:0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8 DEBUG:pymodbus.server.sync:0x6 0x1e 0x0 0x0 0x60 0x60 0x66 0x6 0xf8
Huzzah! What does this mean? I have absolutely no idea! That’s the next bit, look at what the Leetro controller sends back and iterate over replaying things until we have the display working.
More to follow when I get chance to examine data out of the controller.