Author Topic: Arduino Uno that works with Modbus  (Read 4410 times)

0 Members and 1 Guest are viewing this topic.

Offline BenBouwer

  • Active Member
  • Posts: 5
    • View Profile
Arduino Uno that works with Modbus
« on: January 31, 2018, 01:09:33 AM »
Modbus Arduino slave for Mach3 by Ben Bouwer
  The purpose of this scetch is to link the Arduino digital and analog pins to Mach3 using the Modbus Protocol.
    To keep things simple I used a register for each pin in the arduino.
    Each register can be a Digital input, Digital output, Analog input or PWM output register
    Choose what you want each Arduino Pin to be (Digital input, Digital output, Analog input, PWM output or MPG input):
   
See attached Arduino Scetch

Unzip it

Place it in a folder within the Arduino folder the same name as the file

Arduino/Mach3_Modbus_Slave_Version_6_Point_5/Mach3_Modbus_Slave_Version_6_Point_5.ino


Offline TOTALLYRC

  • Active Member
  • Posts: 831
    • View Profile
Re: Arduino Uno that works with Modbus
« Reply #1 on: January 31, 2018, 07:14:06 AM »
Nice to see more Arduino stuff. If I get a chance I will try this out on my lathe since I want to add 2 pots.
We never have the time or money to do it right the first time, but we somehow manage to do it twice and then spend the money to get it right.

Offline BenBouwer

  • Active Member
  • Posts: 5
    • View Profile
Re: Arduino Uno that works with Modbus
« Reply #2 on: February 01, 2018, 12:41:10 AM »
Find attached pictures of:

Brain Setup
Brain View Register 18
Brain View Register 19
ModBus Configuration

Brain View Register 20 and 22 will be similar to Brain View Register 18
Brain View Register 21 and 23 will be similar to Brain View Register 19

You must write your own Brains for the rest of the Registers

Offline BenBouwer

  • Active Member
  • Posts: 5
    • View Profile
Re: Arduino Uno that works with Modbus
« Reply #3 on: February 01, 2018, 12:46:58 AM »
Please be carefull.
The program was not tested on a real machine!
Modbus must not be used for critical inputs or outputs.
See Mach3 manual.

Offline duongfx

  • Holding
  • Posts: 1
    • View Profile
Re: Arduino Uno that works with Modbus
« Reply #4 on: February 10, 2018, 05:13:35 AM »
 I will try this,thank to Ben
But i do not see ModbusRtu.h include
« Last Edit: February 10, 2018, 05:20:06 AM by duongfx »

Offline BenBouwer

  • Active Member
  • Posts: 5
    • View Profile
Re: Arduino Uno that works with Modbus
« Reply #5 on: February 12, 2018, 06:58:14 AM »
You must downdoad it form https://github.com/smarmengol/Modbus-Master-Slave-for-Arduino

Download it as a Zip file.

Install it using the menus in the Arduino IDE: Sketch, Include Library, Add.ZIP Library

Also download the other Libraries from the Arduino Site or from Git Hub and install them.

#include <ModbusRtu.h>                                          // Ensure that the ModbusRtu library is included (under libraries)
#include <Wire.h>                                                    // Ensure that the Wire library is included (under libraries)
#include <LiquidCrystal_I2C.h>                               // Ensure that the LiquidCrystal_I2C library is included (under libraries)
#include <Encoder.h>                                              // Ensure that the Encoder library is included (under libraries)

Offline mkydj

  • Holding
  • Posts: 1
    • View Profile
Re: Arduino Uno that works with Modbus
« Reply #6 on: March 21, 2018, 03:36:26 AM »
Hi Ben,the project is very interesting, which arduino is better?
Do not know well brain mach3, have file brn of the project?

Offline BenBouwer

  • Active Member
  • Posts: 5
    • View Profile
Re: Arduino Uno that works with Modbus
« Reply #7 on: April 23, 2018, 06:06:47 AM »
I do not have the Brain file for the project. You can do it yourself using the info above.