Arduino Forum

Using Arduino => Interfacing w/ Software on the Computer => Topic started by: rovdiver on Oct 06, 2011, 12:21 am

Title: Mega and Scada?
Post by: rovdiver on Oct 06, 2011, 12:21 am
Hi,

I am trying to make Scada (Monitoriza) talk to a Mega board wia ethernet...
However, I am still green to Arduino and Scada...
Is there anyone who has done this earlier, and can tell me how to do it?

I will also need help with Scada after I get things in place...

At the moment I have several Scada programs on my PC, and are playing around to find the one I like best.
A LAN network I want to connect my Arduino to, ethernet shield, and Mega, Uno etc available...

I would really appriciate some help and tips !

Rob
Title: Re: Mega and Scada?
Post by: PaulS on Oct 06, 2011, 12:34 pm
Quote
I am trying to make Scada (Monitoriza) talk to a Mega board wia ethernet...

Never heard of Scada. Time for a link, I think.

Quote
I will also need help with Scada after I get things in place...

This isn't the Scada help line.
Title: Re: Mega and Scada?
Post by: rovdiver on Oct 06, 2011, 01:17 pm
Here is a link: http://www.acimut.com/en/monitoriza/monitorizaforarduino.html

And, I are not going to use this forum as a "help line" for Scada, but, if there is anyone that knows Scada, in this forum, that might want to help me a bit, I would appreciate it :)

Rob
Title: Re: Mega and Scada?
Post by: Razorblade on Oct 06, 2011, 01:25 pm

Never heard of Scada. Time for a link, I think

http://en.wikipedia.org/wiki/SCADA
Title: Re: Mega and Scada?
Post by: PaulS on Oct 06, 2011, 01:36 pm
Quote
Is there anyone who has done this earlier, and can tell me how to do it?

That link you posted looks pretty complete. Which step(s) are you having problems with?
Title: Re: Mega and Scada?
Post by: rovdiver on Oct 06, 2011, 11:01 pm
Hi there !

I cant find the Arduino and actually make Scada talk to it...
And, I want to add more functions, but I cant find any info or logic "system" to tell the Arduino what I want....

Rob
Title: Re: Mega and Scada?
Post by: PaulS on Oct 07, 2011, 08:53 pm
Quote
I cant find the Arduino and actually make Scada talk to it...

I downloaded the sketch that was linked to in step one.

I downloaded the software that was linked to in step two. I installed it. I ran the movie, stopping if often. I recreated the project described, except that I had to use different pictures for the LED on and LED off images.

I uploaded the sketch to the Mega, and tried running the Scada application. It didn't seem to work. I switched to a Duemilanove, and still nothing but a blank form in the Scada application. I discovered that I had three forms, two of which were blank. When I deleted the two blank forms, the Scada application appeared correctly. I had several icons in the task bar some of which were green and some were red. I closed the Scada application, and killed all the processes related to it.

I started the Scada application back up, and ran it. My form with buttons appeared, and three icons in the task bar lit up, green. I was able to make the light come on and go off on the Duemilanove.

I closed the application, stopped Scada, and unplugged the Duemilanove. I plugged in the Mega again, and got the COM port number it was using. I changed the Scada application to use that number. I ran the Scada application, and got all the icons. Pressing the On button turned on the LED on the Mega. Pressing the Off button turned it off.

So, I think you need to describe what you did.

The movie, in my opinion, was by no means the best way to define how to use the application. Screen shots and explanatory text in html pages would have been far better.

Quote
And, I want to add more functions, but I cant find any info or logic "system" to tell the Arduino what I want....

You'll need to define this a little better. Clearly, the link between the Scada application and the specific pin activated on the Arduino leaves a bit to be desired. But, more actions can be defined in the Scada application, using more than register 0, and the Arduino sketch can be extended to handle more than register 0 actions.
Title: Re: Mega and Scada?
Post by: rovdiver on Oct 08, 2011, 12:56 am
I finally got contact with the USB cable...
Reinstalled everything again, and then it worked....

Now, how could I make this things talk via ethernet?
What I want to to is control several led`s on 4 different channels (pins), and 6 DC motors via a motor shield.
It would be very nice to have feedback from a gyro that will be connected to the Mega shield as well....
And, all this should be controlled via a laptop and a joystick...

As mentioned earlier, this is not a "help line" for Scada, but I think that many will use Scada if we know how to use it...
You can actually do "everything" via Scada....weather station, RC vehicles, home automation etc...etc....

Do you think that you, with your knowledge of Arduino, and programming could help us a bit?   :smiley-roll:

I cant see in the lines (or logic) uploaded to my Mega, how you can "pick" the right pin, and how to set it up in Scada....
It is not the same as all the other Arduino stuff....
Or am I totally out on the field here???

Rob
Title: Re: Mega and Scada?
Post by: PaulS on Oct 08, 2011, 01:14 am
Quote
You can actually do "everything" via Scada....weather station, RC vehicles, home automation etc...etc....

Actually, Scada looks more like a proof of concept right now. The PC side looks pretty good, but the Arduino side is lacking.

Quote
Do you think that you, with your knowledge of Arduino, and programming could help us a bit?

Us? I'll think about it.
Title: Re: Mega and Scada?
Post by: rovdiver on Oct 08, 2011, 03:06 pm
There is plenty of Scada applications, that have more "in dept" demo`s.
FreeScada fex have a home automation that looks pretty cool ! (controlling lights, door locks, music, temp etc...)

I really hope that somebody that knows Arduino well, can help us to make this work !  8)
Title: Re: Mega and Scada?
Post by: PaulS on Oct 08, 2011, 03:25 pm
Quote
here is plenty of Scada applications, that have more "in dept" demo`s.

Post 3 or 4 more links, and I'll look at them. I understand the Arduino, but barely have a clue about Scada, though it looks quite capable and interesting.
Title: Re: Mega and Scada?
Post by: rovdiver on Oct 08, 2011, 03:35 pm
Scada is VERY capable, for anything....it is just how to interface it to Arduino that stops me....
Have been using Scada (as an operator) for quite a while, but I have never been on the programming side of it...

Link 1: http://www.sielcosistemi.com/en/download/public/winlog_lite.html     (might be this one that had the home auto demo I mentioned)

Link 2: http://www.integraxor.com/
Link 3: http://sourceforge.net/projects/free-scada/
Link 4: http://www.freescada.com//libmodbus/index.php?lang=en

Title: Re: Mega and Scada?
Post by: PaulS on Oct 08, 2011, 04:10 pm
I went back and looked at the original Scada site you liked to, and found that I had overlooked the tabs at the top of the page. I found the user manual for the Monitoriza application. That will make it easier to create applications that communicate with the Arduino.

As I see it, the limitation right now is that the Arduino sketch that the Scada application interacts with is pretty limited.

I would think that, at a minimum, the Scada application should be able to get/set the state of all digital pins (except 0 and 1) and should be able to get the values of all analog pins.

What else do you see that Scada should be able to do with the Arduino? Get millis() values? Start and stop timers?
Title: Re: Mega and Scada?
Post by: rovdiver on Oct 08, 2011, 05:30 pm
Hi Paul,

I just found that PDF file too (under all programs\monitoriza) and it is explainet quite well there how to do stuff.
Just had a breif look, but there is step by step instructions...

If it is possible to have Scada use an Arduino as a slave, where you can do everything you normally can do with any Arduino PCB`s, I think that I am very close to my goal...
However, I need to find a "Scada Helpline...."    :smiley-roll:

I was cruising around last night looking for similar software, and found that some Scada app`s are using Python, and some C+ etc...
Does this have any practical consequence?
What would be the best/easiest to use with Arduino?

What I need from my Mega is 3 axis Gyro reading, pressure reading, temp, and maybe a LIM reading... (load insulation meter).

From my laptop to the Mega, there will be a joystick controlling DC motors, LED lights, get the Gyro readings etc...

So it is not something very complicated at the moment, but I guess that there will be more later  $)

Would it be complicated to re-program the sketch to Arduino?
Title: Re: Mega and Scada?
Post by: PaulS on Oct 08, 2011, 06:16 pm
Quote
Would it be complicated to re-program the sketch to Arduino?

Maybe, maybe not. That's why I was asking what your requirements are. Reading and writing all digital pins and reading all analog pins would enable you to do what you describe.

It looks like Scada can make the necessary requests. Whether the Arduino sketch can be modified to satisfy all the requests, or not, is the issue.

I'll look into it.
Title: Re: Mega and Scada?
Post by: rovdiver on Oct 08, 2011, 08:59 pm
I will try to make a "whishlist"....

Ethernet connection
6 PWM outputs (controlled from joystick)
4 outputs that can dim a cluster of maybe 4 to 6 LED`s (will be driven via a LED driver board, but need the signal)
3 axis Gyro signal going to Scada (analog or digital???)
Temp sensor (analog or digital???)
Pressure sensor (analog or digital???)
And a LIM, if possible.

This is what I really want, however, the more the better  ^_^

PS: Is it possible to have one or two signals going to Scada telling me the voltage delivered, and amps used?

I really appreciate your effort int this matter ! ! !  8)
Title: Re: Mega and Scada?
Post by: PaulS on Oct 09, 2011, 01:41 am
Quote
Is it possible to have one or two signals going to Scada telling me the voltage delivered, and amps used?

The voltage delivered by what to what? The amps used by what?

If you have appropriate sensors for these values, connected to analog pins, then, yes, it should be possible to alter the Arduino sketch so that Scada can collect the analog values.
Title: Re: Mega and Scada?
Post by: rovdiver on Oct 09, 2011, 02:40 pm
If I have fex 220v delivered to the area where I have this fitted, I want to see that I have 215 or 221 volts delivered(real time), and maybe, if possible see how many amps used on the same line (total usage)...

What will I need to do this?
Title: Re: Mega and Scada?
Post by: PaulS on Oct 09, 2011, 03:44 pm
Quote
What will I need to do this?

I can't think of any software that would help. Seems more like a hardware problem. I'm a software guy.
Title: Re: Mega and Scada?
Post by: rovdiver on Oct 09, 2011, 03:46 pm
Ok   :)

It is not something i need, but it would be nice to have...
Title: Re: Mega and Scada?
Post by: PaulS on Oct 09, 2011, 03:47 pm
Post your question in Project Guidance, or one of the hardware forums, then. Once the Arduino is measuring the voltage and current, getting Scada to access the data will be easy (hopefully).
Title: Re: Mega and Scada?
Post by: rovdiver on Oct 09, 2011, 03:49 pm
Ok, will do that later today ! !

How is it going with the other stuff ?  :smiley-red:
Title: Re: Mega and Scada?
Post by: jfhaugh on Oct 09, 2011, 06:14 pm
The Modbus sketches for Arduino really aren't adequate for a full-on SCADA implementation.  Mostly what's needed is the "coils" and "discretes" functions (single bit values for controlling digital pins), as well as a distinction between "inputs" (read-only values -- things like analog inputs) and "holding registers" (read/write values, such as PWM for digital pins).

The Arduino Modbus sketches are limited to holding registers. The sketch you referenced only implements function 3, 6 and 16 (various read and write holding registers), plus 43 (Read Modbus Encapsulated Information) function for identifying the device as an Arduino.  There's no support for changing the unit number and saving that to EEPROM, which means you'd have to change the sketch for each device you wanted on the bus.

I forget what functions we provide with our Modbus-enabled Arduino UNO products, but it's most of the applicable functions, including support for coils and discretes, as well as Modbus/TCP support.  We'll have a Arduino Mini daughter board (the Mini doesn't support shields ...) that will support full control over an Arduino Mini with RS-232 (both TTL level and normal RS-232 bipolar level) and RS-485 (open collector, multi-drop bus).  Depending on the rest of our product development schedule, we should have support for the Arduino Mega -- mostly it's a question of figuring out how many pins we want to expose to our customers.

For your application, my suggestion would be to ditch Modbus and go with a private protocol.  If you're able to use the "Modbus-ish" sketch you referenced, you'd do much better rolling your own protocol and using that.  Modbus has a fair bit of overhead you don't need and can't use, and you'll still need to modify that sketch to support however many pins you've decided to support.

Title: Re: Mega and Scada?
Post by: jfhaugh on Oct 09, 2011, 07:01 pm

Quote
What will I need to do this?

I can't think of any software that would help. Seems more like a hardware problem. I'm a software guy.


It's pretty simple -- rectify the line voltage (make sure the diode has the correct voltage limit), then use a voltage divider (pair of resistors).  Sample that output with an analog pin, find the maximum value per cycle, and report that.  You'll need to divide the peak voltage by 1.414 (square root of two) to get the RMS voltage.  As a hack, multiply the (int) voltage value by 46348L and shift right by 16 -- that'll give you the same value (more or less) without the floating point multiplication.

The divider should "target" the maximum AC voltage as 0 to 5 volts.  For 240 volt systems, that's about 360 volts.  Remember Ohm's and Kirchoff's Laws.  Also remember that you want to keep the amount of power dissipated to a reasonable level -- the smaller valued resistor is going to have a 355 volt drop for a 240 volt system.  Calculating resistor values is left to the reader as an exercise :) (Hint: A large valued, multi-turn potentiometer is probably the best solution.)

Just remember you're working with potentially lethal voltages :)

I think the GPL Modbus slave sketch is in the 15 to 20 thousand loops per second range, which is more than adequate for sampling line voltages.  Europeans mains power is 20 milliseconds per cycle -- 100 samples per cycle is 200uS.  North American mains power is 16.7 mS per cycle -- 100 samples per cycle is 167 uS.  As you can see, not a lot of time to get processing in for real time processing, but so long as you don't poll too often you should have accurate data.
Title: Re: Mega and Scada?
Post by: rovdiver on Oct 10, 2011, 12:28 am
Puuh..... This was a bit over my head....   :smiley-red:

Anyway, what you say in your reply`s make some sense to me...
However, I am not a software guy, and like to use things that "looks easy" to work with...
To program a private solution would be far better than using Scada, but it is VERY limited what I know about programming...
If I get the Scada app to do a few things (like operating DC motors, LED lights on/off, and gyro feedback) I am a very happy guy  8)
And, I would like it to look nice  :smiley-fat:

What you say about reading the volt and amps used sounds like the solution Im after, but, I believe that I have read somewhere that you can use Arduino boards as a "multimeter" on some pins, with the right sketch....
Wouldnt this be something familiar to what you are saying?
Title: Re: Mega and Scada?
Post by: jfhaugh on Oct 10, 2011, 01:26 am
You have to condition the signal -- you can't just put 240 volts AC (real 240 VAC, not the fake stuff we have here in the States) onto an analog pin and expect the chip to survive.

There are some 3.5 digit DVM chips on the market -- if you wanted to make a multimeter, I'd find a way to interface one of them to the Arduino and use it for the heavy lifting.

My comment about writing your own protocol is based on the poor quality of the existing Modbus sketches.  For example, if you need multiple Arduinos for all your control functions, you have to find a way to change the Modbus unit number of the Arduino you have -- the existing sketch uses a hard-coded value of "1" for the unit number.  And while you could read and write multiple registers to handle switch or contact sensor, etc. values, the read and write coils and/or discretes functions are more commonly used for "on" / "off" type actions.  They are also 16 times "denser" on the bus -- you can pack 8 coils / discretes in a byte, but it takes 2 bytes for a single Modbus register.  You could pack your coils / discretes into a single register, but then you've got read / modify / write happening on the Modbus master, or else you need function 22 -- Mask Write Register, yet another function the Modbus sketch lacks.
Title: Re: Mega and Scada? - try vytronics
Post by: vytronics on Aug 16, 2014, 08:27 pm
I put together a demo project for visualizing and controlling your arduino via the free and open source vytronics SCADA system. Runs on any computer with nodejs installed. Check it out and have fun with it.

https://github.com/vytronics-samples/arduino.scada

It has pins 12 and 13 set for output but you can change via the project/project.yml file.