JHW Communication via USB

 

The purpose of the new USB Serial feature is to use JHW on PC's and Laptops without a parallel interface, which is nowadays more common. But all PC's have an USB-interface which can be used.

A second main aim was to realize the timing for the stepper motors not on the PC due to timing lags. They occur on all non-real-time systems e.g. Windows which has a serious problem especially when it’s coming up to slower PC's. The result is that the hot wire does not move uniformly. This behavior can be noticed as small wavy sub structures in the cut surface of the material. A better solution is that the microcontroller board takes over the data from PC via USB and stores it in its SRAM. The CPU generates exact time intervals completely independently from the PC and the wire can move as it should be with high accuracy.

To achieve these ambitions a low cost well known microcontroller system, the Arduino, will do this job. It has an integrated USB-interface and enough ports to handle most parallel port stepper motor boards. Moreover, the essential software development environment for Arduino is free and well documented.


To start with USB Serial the following hardware elements are necessary:

 

1x Arduino NANO, UNO or DUE board with USB cable (normally ~40€, but HobbyKing in China sells the first two for ~10€ with cable at the moment)

1x Connector to your Stepper board (e.g. a 25 pin LPT Sub-D female connector, ~2€)

1x Connector to Arduino board (header with ~20pin, ~2€)

 

For the Letmathe MDLCNC board the following connection schema must be realized:

 

Connection Schema JHW - MDLCNC Parallel Port - Arduino

 

 

 

 

 

 

 

 

 

 

Motor number

4

3

2

1

|

4

3

2

1

 

Action (d=direction, c=clock)

d

d

d

d

|

c

c

c

c

 

Arduino board (NANO, UNO, DUE) pin number   

7

6

5

4

|

11

10

9

8

GND

Parallelport(LPT Sub-D connector) pin number MDLCNC

9

7

5

3

 

8

6

4

2

18-25

 

 

 

 

 

 

 

 

 

 

Connection Schema CNC-Shield Controller - Arduino Board

 

 

 

 

 

 

 

 

 

 

Arduino board (NANO, UNO, DUE) pin number   

13

7

6

5

|

12

4

3

2

 

The shorter the soldered wires between the Arduino and the stepper board connectors the better. Other boards may need a different wiring and an adapted Arduino software too. If the hardware is ready it may look like my 3 prototypical versions represented in Fig. 1-4.

 


 

Fig 1 Arduino NANO board(sponsored by Letmathe)

Fig 2 Arduino UNO board

Fig 3 Arduino DUE board  upper side

Fig 4 The same object but reverse side. The box I have milled from Plexiglas

 

 

The Arduino NANO has the same microcontroller like the UNO (flash memory 32KB, SRAM 2KB, CPU Clock 16MHz). It's cheaper: 8€. HobbyKing sells them for 10€. You can save money. And it is so small that it could be integrated in a cable between CNC interface and PC. The Arduino DUE has a 32-bit ARM core microcontroller (flash memory 512KB, SRAM 96KB, CPU Clock 84MHz) and is of course much more powerful. For our purposes the SRAM capacity is the most important parameter because the data transfer is extremely reduced (it can be stored 48 times as much).

 

If this is done, all hardware parts are ready. The software part can be started preceding the following steps:

 

1.      Download the Arduino Software

Get the latest version from the download page.

When the download finishes, unzip the downloaded file. Double-click the folder to open it. There should be a few files and sub-folders inside. Here you will find the driver folder.

 

2.      Install the drivers

First of all, you have to install the drivers for the Arduino boards with Windows following the procedure recommended by the Arduino team. If you are working with Windows XP see also: step-by-step screenshots for installing the Uno under Windows XP.

This article (http://www.hobbyist.co.nz/?q=uno_driver_installation) shows how to install the USB driver for the Arduino UNO in Windows 7 when it is plugged into the computer for the first time..

On Windows Vista, the driver should be automatically downloaded and installed. (Really, it works!)

 

-Connect the Arduino board to your computer using the USB cable. The green power LED (labelled PWR) should go on.

-Wait for Windows to begin its driver installation process. After a few moments, the process will fail, despite its best efforts (if you haven't used the computer with an Arduino board before).

-Click on the Start Menu, and open up the Control Panel.

-While in the Control Panel, navigate to System and Security. Next, click on System. Once the System window is up, open the Device Manager.

-Look under Ports (COM & LPT). You should see an open port named "Arduino UNO (COMxx)". This time, a "USB Serial Port" is found.

 If there is no COM & LPT section, look under "Other Devices" for "Unknown Device".

This port COMXX must appear in the last line of the file “hotwireGeometryData.prof” to inform JHW which USB Serial Port is used.

-Right click on the "Arduino UNO (COmxx)" port and choose the "Update Driver Software" option.

-Next, choose the "Browse my computer for Driver software" option.

-Finally, navigate to and select the driver file named "arduino.inf", located in the "Drivers" folder of the Arduino Software download (not the "FTDI USB Drivers" sub-directory).

-Windows will finish the driver installation from there.

 

 

3.      Load compiled binary to Arduino with xloader

 

Fig 5

You are in need to load compiled binary to your Arduino board. In this context, the best and easiest way is to consider the very neat tool xloader. The following is the home site of xloaderhttp://russemotto.com/xloader/. Please download it.

 

How to load a binary (.hex) file

The tool comes with a simple interface (see Fig 5).

-First, choose in the first line the JHW-hex file (from the JHW download inside the USB folder).

-Secondly, choose your Arduino board in the next line, the baud rate changes automatically with your device selection.

-Then choose COM port, using the same technique, i.e. select the last port COMxx (Windows machine).

-Then press upload and wait for the message on the screen bottom to announce XXXX KB uploaded.

You see, it is really very simple!

 

 

 

 

4.      Congratulation!

All things are ready for use and your world should be nice. Have a good cut!

 

 

5.      Remark

Arduino drivers work under different operating systems with different quality, unfortunately. It has nothing to do with JHW. But JHW is simply forced to use these drivers. Have a look into the manifold forums and you will agree with my comment. I have tested the communication under WIN XP, 7 and 8. All boards work (more or less!).

If you now think that you have finally found a suitable job for your old laptop crutch from the cellar, you're wrong. Although USB is a standard for all PC’s drivers are required for communication and drivers are programs that take time for their processing. And exactly this time requirement is the problem in time-critical applications. Remember back to the time as all manufacturers of burning software fought with the deadly data buffer under run. Of course, there are solutions, but everything is a matter of expenses.

A modern computer in conjunction with an Arduino UNO allows an inexpensive secure communication, in collaboration with an Arduino DUE even a very safe one. So I think this presented solution should be a workable one.

Meanwhile, JHW has got a huge scope of functionalities. So there is a probability that something does not work as it should do. If you have found a bug, please don’t hesitate to inform me (h.iweATt-online.de). I shall do my very best to eliminate these bugs.