Hello Guest it is April 18, 2024, 01:07:11 PM

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

0 Members and 1 Guest are viewing this topic.

Mach3, Arduino, Modbus and MPG
« on: December 05, 2011, 11:33:54 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
Re: Mach3, Arduino, Modbus and MPG
« Reply #1 on: April 08, 2012, 07:18:53 PM »
I am trying to do the same thing, have you looked at the Pokeys software? Let me know if you find anything..
Re: Mach3, Arduino, Modbus and MPG
« Reply #2 on: April 08, 2012, 09:58:40 PM »
Yes. I've tried pokeys too. But not the latest plugin. Too many toys, too little time...

Zafar
Re: Mach3, Arduino, Modbus and MPG
« Reply #3 on: November 17, 2012, 03:34:05 PM »
can everyone post some tutorial how to program inputs for FRO and spindle override in brain and modbus seting for arduino modbus.thanks
Re: Mach3, Arduino, Modbus and MPG
« Reply #4 on: November 20, 2012, 01:14:39 AM »
can everyone post some tutorial how to program inputs for FRO and spindle override in brain and modbus seting for arduino modbus.thanks

http://www.machsupport.com/forum/index.php/topic,22982.0.html
Re: Mach3, Arduino, Modbus and MPG
« Reply #5 on: November 21, 2012, 04:34:32 AM »
Hello Zafar:

Is there any chance you could post the Arduino sketch in a .zip format. I  don't like the .rar type as the programs that upzip it want to  install other stuff on my computer.
I am a sometime user of Arduino, but have never interfaced it with Mach3. My current I/O for my mill is Cubloc.

Regards,
John
 
Re: Mach3, Arduino, Modbus and MPG
« Reply #6 on: November 21, 2012, 04:49:15 AM »
I use winrar for the rar files. It's a nice little harmless utility.
Re: Mach3, Arduino, Modbus and MPG
« Reply #7 on: November 25, 2012, 06:26:28 PM »
Hello Zafar:

I got the modbus program into the Arduino sketch file finally. Looking it over, it uses a higher level language, C++ perhaps, than the standard Arduino, and is definitely not user friendly to decipher. However, after some effort, I got it to recognize digital input pins, i.e., D2, D3, and compile. What threw me off was the program setup section has analog input pins listed as the letter "t". ??

Also, I did a search on the Arduino site, and located the list of Modbus functions used, and their meaning. In the Arduino sketch, they list the functions like 0x01; 0x03; but do not use the comment feature to explain what they do.
-----------------------

0x01 - Read Coils
0x02 - Read discrete Inputs
0x05 - Write Single Coil
0x0F - Write Multiple Coils

0x03 - Read Holding Registers
0x04 - Read Input Registers
0x06 - Write Single Register
0x10 - Write Multiple Registers
0x16 - Mask Write Register
0x17 - Read Write Multiple Registers

--------------------
Anyhow, I will try it on a Mega, and see if the digital inputs higher than 15 will work.
Thanks for your effort. The zip file was appreciated.

I did find an un-zipper for RAR on the SourceForge site. All the winRAR files I located by Google were 40 to 50 megabytes, and were a pain to try to use. The SourceForge program was very small, and downloaded in a few seconds.

If the program will run the Mega pins above 15,  you could have lots of digital I/O available.

Regards,
John
Re: Mach3, Arduino, Modbus and MPG
« Reply #8 on: November 25, 2012, 09:50:23 PM »
John,

See the developer's notes at the website in the initial comments section of the sketch. Not all the modbus functions are implemented in this one. For digital inputs and other functions of Arduino, I'd recommend to go through the example codes of Arduino software and the tutorial section of the Arduino website.

Zafar
Re: Mach3, Arduino, Modbus and MPG
« Reply #9 on: November 26, 2012, 01:56:27 PM »
Zafar:

I have not tried the actual hardware yet, but what I plan to do is copy some working code from one of my working Arduino programs, like a digital pin I/O actuating an LED, into the "void/loop" and see if it works. If I get one to work, changing the pin numbers and re-compiling for higher numbers will show what is or is not working.

John