Hello Guest it is April 19, 2024, 07:36:04 PM

Author Topic: Mach3, Arduino, Modbus and MPG  (Read 8166 times)

0 Members and 1 Guest are viewing this topic.

Mach3, Arduino, Modbus and MPG
« on: December 05, 2011, 11:18:05 PM »
Hi,

I've been successful in communicating with an Arduino Uno though modbus. Analog input, output, LED's, buttons and all. Why Arduino? Instead of Pokeys, ModIO or Cubloc? Because it's easily available where I am.

Today I tried MPG with Arduino and found it smoother than Pokeys. I am using ModIOMPG brain for the MPG. The only problem is that the axis keeps on rolling for almost half a second when I stop rotating the MPG. I am not using MPG tick count in the brain. Not sure how to calculate it in my Arduino. Is this the reason for this behaviour of MPG or do I need to tweak some other settings in Mach. I've tried different baud rates but they don't make any difference.

Another thing I've noticed is that when I switch to single or multi-step mode from velocity mode and then back to the velocity then the axis jog speed slows down to one fourth of the previous one. When I restart Mach, I can jog at full speed once again. I am running it on Mach V3.042.020.

Zafar
« Last Edit: December 05, 2011, 11:26:37 PM by zafarsalam »

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Mach3, Arduino, Modbus and MPG
« Reply #1 on: December 06, 2011, 12:20:21 AM »
Depending on the MPG mode, step size and how fast you crank the wheel you can over run with a MPG wired straight to a Parallel port too.  You can request steps faster than your machine can travel if you aren't careful.  I'm not sure if this is whats going on in your case but I have seen this. You may want to wire the mpg straight to some inputs and by pass the arduino and Brain for testing.

Brett 
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Mach3, Arduino, Modbus and MPG
« Reply #2 on: December 06, 2011, 12:39:10 AM »
You can request steps faster than your machine can travel if you aren't careful.  I'm not sure if this is whats going on in your case but I have seen this.

Brett,
This situation you described happens in multiple steps mode when feed rate is set too low. This happens on PP too. In my case the overrun is with the velocity mode. The step mode is behaving similar to a PP and I have no problem with that.

Zafar
Re: Mach3, Arduino, Modbus and MPG
« Reply #3 on: December 06, 2011, 06:12:28 AM »
I tried the same mpg on PP and it works perfectly. With brains and modbus running, the MPG1 Velocity DRO on the settings page shows lag with the MPG movement. I suspect that's the culprit. Is there a fix for that  :-\

Zafar

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Mach3, Arduino, Modbus and MPG
« Reply #4 on: December 12, 2011, 07:30:24 AM »
Hey Zafar,

    For Velocity MPG stuff, you need the "MPG Tick" in brains, basically your device will need to send some kind of Clock or Tick signal. Mach then uses that tick
to see how "fast" vs. time your turning the MPG per scan.

Lag: You are going to have a LAG in MPG across the modbus, simple fact is, the modbus is only serviced once per 1/10th of a second. So if your turning quickly the MPG, and then stop, you still have some "build up" in the count register that is late data, and Mach will have to service that buffer when it comes around again.

TCP Modbus is somewhat faster, since it does not have the slow max speed of serial, I can turn a MPG pretty fast with TCP, but still in the end, it is still in Machs update loop. Nothing will be as fast as machs native engine.

scott
fun times