Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 10:20:10 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  Brains Development
| | |-+  Mach3, Arduino, Modbus and MPG
Pages: 1   Go Down
Print
Author Topic: Mach3, Arduino, Modbus and MPG  (Read 786 times)
0 Members and 1 Guest are viewing this topic.
zafarsalam
Active Member

Offline Offline

Posts: 145



View Profile
« 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 » Logged
Chaoticone
South Carolina, US
Administrator
*
Offline Offline

Posts: 3,598


Precision Chaos



View Profile WWW
« 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 
Logged

Grin If you could see the things I have in my head, you would be laughing too. Grin
www.precisionchaos1.com
My guard dog is not what you need to worry about!
zafarsalam
Active Member

Offline Offline

Posts: 145



View Profile
« 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
Logged
zafarsalam
Active Member

Offline Offline

Posts: 145



View Profile
« 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  Undecided

Zafar
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« 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
Logged

Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!