Ultrasonic Oxygen Sensor Code

Hi, can anyone share code for Ultrasonic Oxygen Sensor to measure Oxygen Purity, Flowrate & Temperature.

Board details: Gas board, Winpower, Ver:OCS_3F_3.0 suitable for personal Oxygen Concentrators.

Got a code on searching the forum, tried to run the code but not successful as it was not complete it seems (may be).

Thanks in advance.

It clearly said in the comments that the code posted was a mess with several errors. The OP never responded to any questions so I would consider it to be useless.

Now if you want to ask a question then please supply a link to your board, and the data sheet for the device, along with a schematic showing how you have connected it all up the Arduino you are using, and we can start to see if we can help you.

Hi, thanks for the reply.
Sorry, as a new user I can't upload the datasheets/document, but provided you the datasheet link below.

Using Arduino Mega 2560. Using pin8 (RX) pin9(TX)

Thanks, it looks straightforward enough. So exactly what do you want to do with it?

The first thing is to get the Arduino reading some data and then take it from there. So first of all how are you powering this and your Arduino?
The data sheet says
Connect sensor pin Vin-RXD-TXD-GND with 12V-TXD-RXD-GND.(Customers must use 3.3v/5vTTL level.

Why on Earth are you doing that? You have a Mega and that contains four serial ports so use one of the spare three ports available to you. Pin 14 is the TX output for Serial3 and Pin15 is the RX input for Serial3.

The first thing you need to establish on your sensor is which pin is sending data because the TX pin on the sensor could be an input or an output depending on if it is classed as a terminal or a computer. You need to connect the RX pin of the Arduino, which is an input to the Pin that is sending data.

The simplest way is to power up your sensor and look with an oscilloscope and see if you are getting pulses sent on the TX or RX pin of your sensor. If you haven’t got an oscilloscope the simplest way is to take a resistor and LED and connect one end to the 5V pin on the Arduino, connect the Arduino ground to the sensor’s ground and put the other end on the sensor’s TX and RX in turn. On one of them you should see the LED flicker every half second. The one that flickers should be connected to the Arduino’s RX3 pin and the other one to the TX3 pin.
Test that the LED lights up when you connect the other end of the resistor / LED to ground.

Connect sensor pin Vin-RXD-TXD-GND with 12V-TXD-RXD-GND.(Customers must use 3.3v/5vTTL lev

Do that and report back.

thank you, changed to pins 14 & 15 still getting some meaningless characters.
Can you find out the mistakes in the code?

That code is crap forget it. If you are serious about needing help then please do what I said. What was the result of your tests.

Oh, but I'm a newb, don't have code. I'm from Mechanical Engineering, trying to upload code for my DIY Oxygen Concentrator. If you can help me with any code source, it will be of great use for me.

I doubt very much if you will find any code for this. Therefore you will have to write it yourself. I have not got that device so I can't write code for you. The best I can do is to mentor you and we can work together to try and write it.

I can do no more that that.

That is so great. I will make it simple for both of us. What I'm looking for is send:

11 01 01 ED

to get
something similar to this in hex : 16 09 01 00 CD 00 00 00 C2 00 1E 33 (the last number being Checksum)

Now I'm almost there in finding the code for this purpose. Once get one I shall update you.

Till then relax, have a cup of coffee... bro

Why is that? Because that data sheet says the device power up in the automatic state where it sends a reading every half second.

It also says that the default baud rate is 9600 so are you setting the serial port to that speed?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.