As a test project, I’ve got an Arduino device plugged in via USB which appears as COM7. The device is an Arduino wireless transceiver which is receiving the data from a remote Arduino sensor via 915MHz radio.
The output of the device on my serial-monitor looks like:
OK 34 216
-> ack
Where 216 is the value I wish to sample as a datapoint.
I’ve got ScadaBR setup with the serial monitor libraries, and I can see COM7. I’m confused as to what all the options to set for the datasource and datapoint.
I’ve added Datasource:
ASCII Serial
COM7
Data Bits:8 Stop:1 Parity: None (this is correct)
Update: 10 seconds
Quantize: No
Stop Mode: ?
Number of Characters ?
Buffer?
Initialization String?
Datapoint:
Data type: Numeric?
Command?
Value regex?
Custom Timestamp?
ASCII Serial protocol, is intended for simple communication usually for weighing balance, multimeter, etc…Only reads data.
The Arduino not come with any protocol, must programming a protocol. You you can use the ModbusRTU protocol that would be more complete than the ASCII Serial, which can be downloaded here:
Yes you can use if for only read data. In general, a device that uses ASCII protocol send data continuously, I did a pseudocode:
While {
IF (output_1 == 1) {
SerialOut = “1”
Delay_ms = 1000
ELSE IF (output_1 == 0) {
SerialOut = “0”
Delay_ms = 1000
}
}
}
This example is for you to read a digital output.
The option Command in ASCII in DataSource is for you to start sending data in device/microcontroller Ex:
IF (serial_in == “1” ) { // This data is send when starting Tomcat and will be sent only once.
Set = 1
}
While (Set = 1) {
IF (output_1 == 1){
SerialOut = “1”
Delay_ms = 1000
ELSE IF (output_1 == 0) {
SerialOut = “0”
Delay_ms = 1000
}
}
}
The option Command in ASCII in DataPoint is for you to start sending data, but controlled by Uptime (request) Ex:
IF (serial_in == “1” ) { // This data is sent when starting Tomcat and will be sent periodically in accordance with Uptime;
IF (output_1 == 1){
SerialOut = “1”
Delay_ms = 1000
ELSE IF (output_1 == 0) {
SerialOut = “0”
Delay_ms = 1000
}
}
}
Use the first example for testing, regex is to extract part of a string you will not use for the Arduino, leave as default.
I already have a app running in arduino that communicates with ASCII requests.
I’m trying to config ScadaBr to read the data of my 6 analog ports.
First I’ve setup the com port, wich works fine via USB. Then I add the 6 datapoints each one with a diferent request string. Using a serial monitor I found out that the ScadaBR writes this request:
A0|A1|A2|A3|A4|A5|
The problem that I’m heaving is that I can make ScadaBR understand the difference between values. It always put the same values to all data points.
I’ve try diferent stopping characters in diferent positions, like:
1023|1023|500|500|100|1023X - Using X only one at the end
1023X1023X500X500X100X1023X - Using X all the times
I’ve try timeouts as well.
Well fellas, what can you say to help me with this issue. Anything will be most welcome!
Best of luck