Author Topic: Mach4 - Arduino and Touchscreen  (Read 16838 times)

0 Members and 1 Guest are viewing this topic.

Offline simpson36

  • Active Member
  • Posts: 1,374
    • View Profile
Re: Mach4 - Arduino and Touchscreen
« Reply #50 on: July 01, 2015, 07:02:44 AM »
In addition to using co-processors like the single chip Ethernet and possibly a Pokeys board to run the TCP Modbus (both mentioned earlier), I wanted to include a practical example of off-loading processing from the Arduino to MACH4 as also mentioned in an earlier post.

The CPU in your computer is many times more powerful than any of the little development boards. The version of LUA that is embedded in MACH4 is all Floating Point (not a good thing), but it is also extremely fast and according to statements by the MACH4 team, can run in its own thread (as was done for the PLC).

Here is the example:

The actual test case is collecting data from a pair of quadrature encoders on a Joystick and sending the data to MACH4 for use in performing jogging. The data needs considerable processing to determine basic stuff like stick position, but also more complex calculation to determine the speed at which the stick is being moved (including detecting zero stick movement) and calculating an exponential ramp based on the combined coordinate distance from center, while remaining biased toward the greater deflected axis.

This processing was being done by the DUE prior to sending the final jog speed, axis and direction data over Modbus for MACH4 to use in moving the mill table. Averaging several available benchmarks, the DUE works out to be about 7.5x faster than the MEGA at munching on FP calculations. But a 3.2ghx Intel CPU is faster . . . . .  a LOT faster.

The processing described above has been moved to LUA and the DUE  now simply collects and sends the raw data. While I did not do formal speed tests, I would estimate based on the frequency of updating the DRO with new numbers, that the speed has nearly doubled. So a 2x improvement in responsiveness over Arduino's fastest board is attainable in MACH4 at zero cost.

Food for thought.