Author Topic: Arduino Modbus, Complete, Documented and free  (Read 146350 times)

0 Members and 1 Guest are viewing this topic.

Offline Tecnic01

  • Holding
  • Posts: 2
    • View Profile
Re: Arduino Modbus, Complete, Documented and free
« Reply #10 on: February 06, 2013, 01:08:24 PM »
for those who want to know the arduino modbus
http://www.biemmeitalia.net/blog/it/

Offline Chaoticone

  • Administrator
  • *
  • Posts: 5,433
  • Precision Chaos
    • View Profile
Re: Arduino Modbus, Complete, Documented and free
« Reply #11 on: February 06, 2013, 01:46:30 PM »
Thanks!

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!

Offline fdos

  • Active Member
  • Posts: 326
    • View Profile
Re: Arduino Modbus, Complete, Documented and free
« Reply #12 on: February 25, 2013, 05:51:39 PM »
Has anyone actually used this?

I happen to have a few Arduinos around the place and sort of got it running.

On both a Mega and a Duemilanove only outputs 12 and 13 seem to work for me.

The author seems to have vanished from the forum?

Wayne...

Offline mrprecise44

  • Active Member
  • Posts: 278
    • View Profile
Re: Arduino Modbus, Complete, Documented and free
« Reply #13 on: February 26, 2013, 03:16:25 PM »
I got it working on I/O D2 thru D12, and analog 0 >5, but found it too cryptic, and it doesn't use the typical Arduino modified C language. Also, the author never responded to questions. There are some who managed better than I did, and those various posts are here in the Modbus section.

The Modbus program posted by Zafar Salam in another Modbus post, works with no problems and will allow all the pins on the Mega to function. This version was created by an Arduino programming whiz, JP Mozeta,  and is also found on the SourceForge website. Also, there is some  discussion how to get an MPG working properly.

The Arduino Mega is an excellent platform for Modbus and the Mach3, due to it's wealth of code on the Arduino site, and the huge number of I/O, including (4)serial ports, and of course low cost when compared to the commecial PLC's.





Offline fdos

  • Active Member
  • Posts: 326
    • View Profile
Re: Arduino Modbus, Complete, Documented and free
« Reply #14 on: February 26, 2013, 03:21:20 PM »
I actually prefer the cubloc devices personally as I have several years experience with them as well as many thousands of hours of Mach machines talking to them.

But this did seem interesting as I use Arduino's here for other motion control projects.  I'll see if I can find the other Modbus sketch.

Do you have a link?

Wayne...
« Last Edit: February 26, 2013, 03:36:28 PM by fdos »

Offline mrprecise44

  • Active Member
  • Posts: 278
    • View Profile
Re: Arduino Modbus, Complete, Documented and free
« Reply #15 on: February 27, 2013, 12:26:07 AM »
Hello Wayne:

Zafar's post regarding the ModBus program for Arduino is:

http://www.machsupport.com/forum/index.php/topic,20231.0.html

He also wrote a PDF cookbook showing how to set up two analog inputs.

Personally, I really like the Cubloc stuff. I have a Cubloc board on one of my 4-Axis milling machines. They have a very good range of ModBus capable boards, and the Cubloc Studio program makes it even better. Ladder logic, plus CuBasic is pretty powerful. Cuboc makes their many peripherals virtually "plug and play" with all the various types of I/O. Plus, the manual is very detailed, with lots of examples. Perhaps the real plus for Cubloc is 24v, which is the commercial standard for noise immunity. On the con side, the Cubloc needs 2 connections to the computer, and you are dealing with more than one voltage. The other problem is using their tiny connectors. It took me quite a bit of time getting the crimp tool to make up a good connector. I must have made 30 bad ones before I got one right.

However, the Arduino platform is a low cost alternative, and can do much of the typical I/O, like LED's, pushbutton activation of functions, and Feed rate, Spindle % override; an excellent addition to the Parallel port driven Mach3 setup.


Offline fdos

  • Active Member
  • Posts: 326
    • View Profile
Re: Arduino Modbus, Complete, Documented and free
« Reply #16 on: February 27, 2013, 01:35:13 PM »
I generally use the CUSB36R, in fact a new one for another project arrived today.

I also have the studyboard which is useful for testing in comfort before the live system is ready.

I still cannot understand why I can't get pins 2 to 10 working as outputs on the Arduino with that code.  13 works even though he's using the on board led for status.   All I tried so far was a led on each pin and toggling the active low checkbox in mach ports and pins for that pin on port 0.  I think it was the pins below 11 did nothing for me.

Wayne..

Offline mrprecise44

  • Active Member
  • Posts: 278
    • View Profile
Re: Arduino Modbus, Complete, Documented and free
« Reply #17 on: February 27, 2013, 02:32:02 PM »
Hi Wayne:

The ModBus program that runs on an Arduino does not utilize Ports and Pins in Mach3. It is a totally separate operation.

1. The ModBus program uses registers, beginning with 0 up to I believe 48.
2. These registers are scanned by the Serial ModBus Configuration in Mach3.
3. You verify the register is being read by the "Test" window in the Serial ModBud Config page;
4. When the action is working i.e., seeing the pot value change, or a button push change from a 0 to a 1,
5. You can then write a "Brain" which reads the register, which activates a Mach3 OEM code, i.e. Cycle Start, FeedHold etc.

Zafar posted a PDF file, showing how to setup (2) potentiometers for Feedrate ovr., and Spindle %.

The ModBus program uses the Arduino language format to set pins as input, output, or analog read/write, in void(setup).

Each Arduino pin has a corresponding ModBus "register", in the void(loop).

You need to use the Arduino format to setup the ModBus program. Log onto the Arduino site, and study the examples.

On the Arduino board, pins 0 and 1 are Serial Rx, and Tx. Pins 2 through 12 are digital I/O, and pins A0 through A5 are analog I/O.
The Mega has (4) Serial ports, 15 analog pins, and 42 digital I/O.


Offline fdos

  • Active Member
  • Posts: 326
    • View Profile
Re: Arduino Modbus, Complete, Documented and free
« Reply #18 on: February 27, 2013, 02:58:51 PM »
But which arduino Modbus RTU are you using?

I looked at Zafars post but cant see what software he's running on the Arduino.

I was refering to the one in this thread.  You can address this one via ports and pins.  Albeit as I appear to have found not fully.

Wayne...

Offline fdos

  • Active Member
  • Posts: 326
    • View Profile
Re: Arduino Modbus, Complete, Documented and free
« Reply #19 on: February 27, 2013, 03:47:58 PM »
OK I think I have found the sketch now.  I see no library used.