Go Down

Topic: Mega and Scada? (Read 7169 times) previous topic - next topic


Oct 08, 2011, 08:59 pm Last Edit: Oct 08, 2011, 09:00 pm by rovdiver Reason: 1
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)


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.
The art of getting good answers lies in asking good questions.


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?


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.
The art of getting good answers lies in asking good questions.


Ok   :)

It is not something i need, but it would be nice to have...


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).
The art of getting good answers lies in asking good questions.


Ok, will do that later today ! !

How is it going with the other stuff ?  :smiley-red:


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.


Oct 09, 2011, 07:01 pm Last Edit: Oct 09, 2011, 08:20 pm by jfhaugh Reason: 1

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.


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?


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.


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.


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

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131