DO meter Connect to Arduino Uno Board

Hello Guys, Good day…i am asking any help with this matter. i needed it badly. Thank you guys in advance for your support and help.

Here it comes, we have a DO meter ( Lutron Oxygen Meter model: DO-5510 to be specific) and it has an RS232 serial connection to computer and we want to connect it to Arduino Uno board. I know how to interface the Do meter to the arduino board, but the problem is how can i use the output of the meter as an input or as a process so that we can make a program that control a relay which turns it on and off.

this meter has a 16 digit data stream in the format of this: D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0,

AND EACH digit indicate the following status:

D15 - Start Word= 02
D14 - Reading polarity for the Display
0 = Both upper and lower display value are “+”
1 = Upper “-”, Lower “+”
2 = Upper “+”, Lower “-”
3 = Both upper and lower display value are “-”

D13 - annunciator for lower display
0 = no symbol 1= degree celsius 2= degree farenheit

D12 & D11 - Annunciator for upper display
01 :degree celsius 07= mg/L
02 :degree farenheit 06= percent O2

D10 - Decimal Point (DP) for lower display
0 = No DP, 1=1DP, 2=2DP, 3= 3 DP

D10 - Decimal Point (DP) for Upper display
0 = No DP, 1=1DP, 2=2DP, 3= 3 DP

D8 to D5 Lower Display reading, D5=LSD, D8=MSD

D4 to D1 Upper Display reading, D1=LSD, D4=MSD

D0 = End Word =0D

RS232 setting
Baud rate 9600
parity No Parity
data bit no. 8 Data bits
stop bit 1 Stop bit.

I dont know how to use those datas and I dont know how to program them and to start the program. Please help me and bear with my Grammar because Im not very fluent in this language. Thank you in Advance and Godbless…

Is the data stream a 16 character string of ascii characters that are separated into blocks?

If so, your can use string functions to separate each character into its own variable and process it as required.

Weedpharma

Yes i know it is a 16 character strings. but i dont know how to start or how to make a program, can you help me or make some example so that i can study them. thanks Weedpharma for your help.

The Arduino IDE has lots of examples built-in.

My first attempt would be to grab a frame of data and dump it out in hex, because (to me)

D13 - annunciator for lower display 0 = no symbol 1= degree celsius 2= degree farenheit

isn't clear whether 0, 1, 2 represent actual values, or ASCII characters.

Sir/Maam AWOL can you teach me how can i verify if those are represent Actual values or ASCII char. Thank you your help is much appreciated.

(uncompiled, untested)

void setup ()
{
  Serial.begin (9600);
}
void loop ()
{
  if (Serial.available ())
  {
    int x = Serial.read ();
    if (x < 16)
    { 
      Serial.print ("0");
    }
    Serial.println (x, HEX);
  }
}

void setup() {
// put your setup code here, to run once:
{
Serial.begin (9600);
}
void loop ()
{
if (Serial.available ())
{
int x = Serial.read ();
if (x < 16)
{
Serial.print (“0”);
}
Serial.println (x, HEX);
}
}

Arduino: 1.6.5 (Windows XP), Board: “Arduino Uno”

Testing.ino: In function ‘void setup()’:
Testing:7: error: a function-definition is not allowed here before ‘{’ token
Testing:17: error: expected ‘}’ at end of input
a function-definition is not allowed here before ‘{’ token

This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.

You introduced those errors, not me.

Please remember to use code tags when posting code.

this is the output i get from your program, thanks…

OUTPUT.JPG

I mean that the error you posted is not from the code that I posted in reply #5.

I'm sorry, but it's just one of those facts you're going to have to accept.

OK, sorry I thought you were still talking about the error message - I can see your photo now. Yes, those are ASCII decimal digits, specifically "114"

Please stop PMing me.

Sorry I dont mean It like that and I accept my wrong, Im just only asking If what should i do next I’ ve already run the program, In the one I attached pic. is the one that seen in The serial monitor of the arduino software, and i dont know what those things means…thanks…

What should I do next Sir/Maam AWOL, thanks..please bear with me, because I am a newbie in programming...thanks a lot..

Well, if [u]all[/u] you're seeing is "114", I'd be very, very worried.

(that was a hint for you to fill in details)

AWOL: Well, if [u]all[/u] you're seeing is "114", I'd be very, very worried.

(that was a hint for you to fill in details)

what do you mean with these sir, please help me a little bit more.

You posted a picture showing just 3 characters, but your first post suggests your protocol consists of sixteen characters. Where are the other characters? How have you got the device wired-up?

Please, I'm effectively blind here - I can't see what you can - if you want help, you're going to have to start helping others to help you.

Ok sir I got what you mean, sorry for the inconvenience i brought up, maybe I can post here the specification sheet of the meter, I dont know yet how to wire it to arduino, but i can up from someone that we need to find the Rx, Tx of the meter in order to establish a serial connection bet. them with the arduino..

Have a look at using SoftwareSerial - that should be OK at 9600. Don't forget to use RS232 level shifters/inverters

Sir/Maam Good Day.

We already given a code regarding our thesis and i Dont know what is missing with the code and i dont know also how to test it. wether it gives an output or not. May I ask you again some help regarding this. So that I can proceed to the next step I am needed to do. Thank you in Advance and God bless us all.

here is the code given to us.

#include <SoftwareSerial.h>

int DigitCount;
char Polarity;
char Annun_lower,Annun_higher[2];
char DP_lower,DP_higher;
char Display_lower[4],Display_higher[4];

SoftwareSerial mySerial(2,3);

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
mySerial.begin(9600);
DigitCount = 15;
}

void ProcessData() {
//Put your code here to process received data
}

void loop() {
// put your main code here, to run repeatedly:
if (mySerial.available())
{
int RecvByte = mySerial.read();
switch (DigitCount) {
default:
DigitCount = 15;
case 15:
if (RecvByte==2) DigitCount–;
break;
case 14:
if (RecvByte>=0 && RecvByte<=4)
{
Polarity = RecvByte;
DigitCount–;
}
else
{ //Out of range. Probably out of sync. Reset to start
DigitCount = 15;
}
break;
case 13:
if (RecvByte>=0 && RecvByte<3)
{
Annun_lower = RecvByte;
DigitCount–;
}
else
{ //Out of range. Probably out of sync. Reset to start
DigitCount = 15;
}
break;
case 12:
case 11:
if (RecvByte>0 && RecvByte< 8)
{
Annun_higher[12-DigitCount] = RecvByte;
DigitCount–;
}
else
{ //Out of range. Probably out of sync. Reset to start
DigitCount = 15;
}
break;
case 10:
if (RecvByte>=0 && RecvByte<3)
{
DP_lower = RecvByte;
DigitCount–;
}
else
{ //Out of range. Probably out of sync. Reset to start
DigitCount = 15;
}
break;
case 9:
if (RecvByte>=0 && RecvByte<3)
{
DP_higher = RecvByte;
DigitCount–;
}
else
{ //Out of range. Probably out of sync. Reset to start
DigitCount = 15;
}
break;
case 8:
case 7:
case 6:
case 5:
Display_lower[8-DigitCount] = RecvByte;
DigitCount–;
break;
case 4:
case 3:
case 2:
case 1:
Display_higher[4-DigitCount] = RecvByte;
DigitCount–;
break;
case 0:
if (RecvByte==0x0d)
{
ProcessData();
}
DigitCount = 15;
break;
}
}
}

I will also attached the manual of the meter..thanks...Your help is highly appreciated.