Process control based on free resources … posted by on December 21, 2011

The solution to all evil…

Proview, Arduino and other free software/hardware resources builds interesting concepts for future control systems. The range stretches from simple sequences in small machines to complex factory wide or even global processes.

The star in this niche is a system called Proview.se   While the name may not be familiar to most people, the system has proved itself in the Swedish steel manufacturing business for more than two decades. It is actively developed and maintained and has a very interesting and active forum.

Arduino is a project aiming for easy prototyping of smaller  electronic systems. It is widely used in hobby projects and is spread to all corners of the world, There are many free software projects that runs on Arduino boards. There are industrial protocols implemented, for example ModbusTCP.

My project is to provide an I/O module based on Arduino but designed to work in industrial environment with noise, dust etc. This module will be usable together with Proview.

I will post my progress here….

Martin

The tests I have carried out so far is with an Arduino Ethernet card arduino.cc/en/Main/ArduinoBoardEthernet

I have (today) extended the functionality of the “Mudbus” project http://code.google.com/p/mudbus  to include Modbus Functions 15 and 16 (write to multiple coil and multiple registers). So far it is not tested properly and I have had no reviewer looking at it yet… I put the Git repo here  git://gitorious.org/mudbus/mudbus.git  so have a look…

My plan is to include function code 2 (read discrete inputs) and then we will see… Dee Wykoff, who has written the Mudbus lib has been very positive so far. We’ll see if my dirty hacks will reach his QA levels in the future… His code is quite neat…

I will try to focus on price reduction later on when I at least have a card that works. The ethernet chip is of course one of the candidates but I haven’t though much about it. I’m willing to help though.

SGS Thomson’s old VNQ810-E is probably still a good 24V high side driver although there are newer replacements but VNQ810-E is quite cheap… I have only checked prices in couple of places so far though…

I will use Muratas NFM61R filter on basically every input and output. I have used them in the old days when I made my first designs compatible with the CE mark… They are double inductor and cap in between and they can handle 2A… so you can use them on almost everything in a PLC. Maybe there are more compact ones today, I have to check. the NFM60R is smaller but rated 25VDC which is not enough… be careful when you use filter components and read everything you can find on the subject…

I used to always do 4 layer PCB designs with separate layers for gnd and the 5V… for my first prototype I think I will use two layers only…
For 24V signal inputs I use Murata filter and then a voltage divider and a Zener + cap and then a Schmit trigger 74HC14 or something…and then into the shift register that I shift in to the Arduino…

My thought is that I will use an enclosure that is DIN rail mounted, but skip the modularity the Wago and Beckhoff way. They spend a lot of money on the connectors and modular plastic enclosures. My thought is make a series of boxes from 8/8 up to to 32/32 but without any possibility to expand a box. After all, you can just buy one more if you need more signals.
.
The 6 analog inputs of the Arduino can be used with proper buffering and signal conditioning but they are only 10bit… enough for some measurements but not for any high accuracy stuff…

For more demanding tasks I’m convinced that a dedicated AD/DA converter should be used in a separate box without any digital signals.

PWM outputs can be nice but not on the same board as any high resolution ad converters…
Oops it’ late….

———— If you want  my versions of Mudbus – here is how to get it ————–

You can visit my clone of Mudbus here gitorious.org/mudbus/mudbus

To get the project to your computer you need to install git.

If you are on a debian/ubuntu machine:
sudo apt-get install git git-gui gitk git-doc

If you are on windows code.google.com/p/msysgit/downloads/list
take the Git-1.7.9-preview20120201.exe or whatever is latest and install it… easy.

From the command line in linux

type
git clone git://gitorious.org/mudbus/mudbus.git mudbus

in windows right-click on a folder and take “git bash”
There will be a commandline interface comming up
type
git clone git://gitorious.org/mudbus/mudbus.git mudbus

Please let me know if there are any problems…

—————— Progress report 12 February 2012 ——————-

I have a running version of Mudbus that supports most things needed for use with Proview… but it needs more testing. Run it if you want but not on any important applications yet.

Blue ones are working in the original Mudbus library but it didn’t support multiple requests in one ip message.

Read coils (FC 1) 0x
Read input discretes (FC 2) 1x
Read multiple registers (FC 3) 4x
Read input registers (FC 4) 3x
Write coil (FC 5) 0x
Write single register (FC 6) 4x
Force multiple coils (FC 15) 0x
Write multiple registers (FC 16) 4x

Red means warning… actually I should red-mark all of it since code in all FCs has been modified.

I added FC2 FC4 FC15 and FC16 and support for multiple requests in one ip message.

What is next?

We have to make more testing. I need to write test applications in Proview and for Arduino to stress the protocol.

And I need to clean out a number of ugly Q&D hacks. The code from Dee was quite neat from the beginning and I have messed it up…

:mrgreen:

 This is the “normal” way that I thought it would always be…

But then a message like this came up. It includes three requests!

Now in the latest version I also respond all requests in one message.

Wireshark shows no errors or any strange messages any longer…

These are the areas that this version is using:
Mb.C[0-63] bool
Digital outputs address range 0x

Mb.I[0-63] bool
Digital inputs address range 1x

Mb.IR[0-15] signed int
Input registers (for AD converters, counters etc) address range 3x

Mb.R[0-15] signed int
Holding registers (for DA converters, frequency outputs etc) address range 4x

——————— Update 13 February 2012 —————————————–

Did som cadding today. Schematics is not ready yet, LEDs are missing and the power suppy is not there yet.

Analog channels is also missing but it will be a jumper for 4-20mA and 0-10V without it…


——————— Update 15 February 2012 —————————————–

I have decided to threw away some of the schematics and go for the VN808 octal driver instead. It is more expensive per output but saves space on the board. There will also be opto couplers… get rid of some of the filter components that way and I’ll try to protect the processors as much as I can.

The basic concept is still the same with shift registers… I’ll be back with news during this week…

 

——————— Update 18 February 2012 —————————————–

I thought of using the Infineon ISOFACE components for this project… I just regret spending a day reading data-sheets.

Technically the ISOFACE is what I need but the business side is below any standard I have seen before…

No one stock these devices except Mauser.com and they seem to have lost confidence in Infineon too…

They give strange price indications, marking the devices as “obsolete” and “end of life”.

I’ll be back…

 

——————— Update 19 February 2012 ———————
Still much to add…. opto on the clock and data signals and power…
Now it is time for Gokart racing with my daughter…

 

——————— Update 20 February 2012 —————————————–
Changed to 74HC595 and added some magnetic digital isolators to protect the Arduino from noise…
The input circuit shift register has some nice parity bits and the output circuit I plan to feed it back into the arduino so I can detect any changed bits. I will discover errors when the shit already hit the fan but at least I can alarm for it within the next scan cycle.

 

——————— Update 19 March 2012 —————————————–
One month has passed. I have done a little on the PCB layout but it is still just rough placement of the components.
I have had some trouble at work that has required my attention but the last week I have been on vacation.
There has been some thinking about how this card shall be used though. I will try to make this card more of a SPI-bus device so that I’m not completely focusing on the Arduino but also on other single board computers like the Raspberry Pi for example. This will not affect the schematics much but it is more on the layout this will be done.
The Raspberry Pi is cheaper than the Aurduino and I can use it as a platform for http://proview.se but it is not entirely suitable for being just an I/O module because of the complexity of carrying the Linux OS. The Raspberry Pi also need an SD card which will get the price tag up a little for the complete module.
I will try to get the Mudbus software to the point where it is ready for production though because it will still be used in my systems.

 

——————— Update 16 April 2012 —————————————–
Fixed a millis rollover problem in my example file copy_in2out_mb.
I’m still working with the PCB layout of the I/O module…
——————— Update 5 May 2012 —————————————–
Here is the ongoing work.

 

I publish this not to provide any ready solutions but to get some inputs from you. I have been designing industrial electronics professionally on and off since 1984 but I don’t know everything so I’m happy for any feedback I can get.

 

Changes that I plan:

 

1. To make sure people separate the power to the processors from the power to the rest of the system I will use Power over Ethernet for the processor modules. Arduino Ethernet has it by design.
Raspberry Pi will need an add on module and a different magneto Ethernet connector.

 

2. I will provide an optional relay that can be used to turn on/off the 230VAC to the 24V power supply that powers the I/O side of the system.

 

3. This modules are 8in/8out only. There is an SPI connector that can be used for adding more I/O so I plan a series of modules. I have not decided yet but normally there are more inputs than outputs so maybe I make separate modules for inputs and outputs. Schematics will be almost exactly copies of the input and output circuits I already have.

 

4. A box… I have made a vacuum forming machine… well just a wooden frame with some holes and a pipe to connect the vacuum cleaner. I will do some prototyping to see what is practical. Maybe I end up with buying a standard box for DIN rail mounting.

 

5. I’m working in electronic and fine mechanic assembly and part manufacturing. I will try to investigate what I need to do to interface with applications in other areas of activity for example HVAC systems.  The long term goal is to provide the community with industrial grade open source hard/software solutions for as many applications as possible.

 

I use magnetic couplers ADuM1300 to separate the processor modules galvanically from the rest of the system.
The shift-registers are on the noisy side and needs protection by rc nets.
The input IC is SCLT3-8
The output driver is VN808
These layouts are ongoing work and will be changed.
These layouts are ongoing work and will be changed.

image
Mockup of the box. I have not decided if I should make it for mounting like this or if shall make turn it 90 deg, card edge to the DIN rail, to save width in the cabinet. In that case the LEDs are not going to be where it is written on the foam…
There will be expansion module too…
Or maybe put the Arduino on top and cut the thing?
image

 

And yes, finally my Raspberry Pi arrived from Element14. So now I will compile Proview.se for ARM and see if it works.

image

Raspberry Pi is bigger than the Arduino but I think I make one version of the board and the box to fit both of them.

10 Responses to “Process control based on free resources …”

  • Gerald says:

    Hello,
    I could find this MUDBUS Code from Dee Wykoff on google, and now I am using it for a connection between an arduino for collecting measured data and a software called SICAM 230. (It will be a project for a final exam at evening school) It is working pretty good ;)

  • Woza says:

    Hiya,

    I was wondering if it is possible to read data from the arduino above the 0-15 range of the 4x register to read stored values that are not i/o related?

  • Martin says:

    Yes you can expand the tables as you like, but you have some memory restrictions because of the limited ram of the Arduino.
    The declarations in the Mudbus.h file are just memory arrays. It is up to the application to copy the contents of these to and from actual I/O pins or A/D or D/A converters. In the examples there is a file copy_in2out_mb that is copying just the memory arrays to each other so it looks like if the outputs where connected to inputs…
    These declarations works:
    #define MB_N_C_0x 100
    #define MB_N_I_1x 100
    #define MB_N_IR_3x 64
    #define MB_N_HR_4x 64
    These are in the Mudbus.h file.
    You can pull from my Gitorious repo.

  • Jens says:

    Hello
    It looks really nice.
    How far are you?
    When do you expect sales?
    I intend to apply it to modbus with a WAGO 750-841 Controller, should not it be possible?

    All the best
    Jens

  • Martin says:

    Dear Jens
    I think it would work with some addition of an address offset in the Mudbus software to fit the address map of the wago controller.
    It would be interesting to make a version of Mudbus and an example application in the Wago that is verified and publish it to the Arduino community.
    On the hardware side, I’m still working on the layout adding connector for Raspberry pie and an optional relay to control the power supply so I can power on/off the whole thing from the main controller. The processor will in that case be powered via the Ethernet cable PoE. I’m also working on the box and a total concept with Proview.se runtime running on a Raspberry Pi when ever I can get it delivered to me.
    Having all these plans it is still a hobby project and I will publish the layout masks when I have tested the first prototype.
    Martin

  • Marc says:

    Thanks for sharing, Martin.
    Great project.

    Marc

  • marc says:

    Hi Martin,
    I am sorry I am spamming but I want to ask you something.
    Please, when you have time, can you have a look at my post on the Proview forum and tell me if you are interested?

    http://www.proview.se/v2/index.php/forum/4-proview-forum/4-re-welcome-to-proview-forum#3702
    Greetings, Marc

  • gdpeng it says:

    great work, Martin….
    I just entered Proview Forum.
    My goal is having Arduino acting as a ModbusTCP distributed I/O (with yr relay and possibly other specialized board).
    And A raspi or other ARM mini board acting as the minimumu-needed-to-run Proview runtime.

    Are you also on this idea ?

  • Sadettin Karaman says:

    Hi I’m just using the mudbus library to exchange data. Is this possible to while I’m using this library to create another server in the same ip but in different ports?

    • Martin says:

      To double it up… I think the code needs a major rewrite. I don’t think it is easy with the limited memory of the arduino…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>