Hello friends, I hope you all are doing great. Today, I am going to share the new Dissolved Oxygen Sensor Library for Proteus Simulation. Fish, shrimp and the bacteria that clean a pond all breathe the oxygen dissolved in the water, and when it runs low they suffocate - usually at night, without warning. The common analog dissolved oxygen kit for Arduino measures it with a galvanic probe and a small signal board. With this library you can run a full Proteus simulation of that kit, convert its voltage to mg/L with the kit's own formula and saturation table, compensate the water temperature and control an aerator.
Dissolved Oxygen Sensor Library for Proteus
Latest version: V1.0 (December 2026, this tutorial)
Related parts: PH-4502C pH Sensor · TDS Meter · DS18B20 Temperature Sensor
Helping Tools
- Serial Monitor Advance: a serial terminal window for the UART of your board
- Serial Monitor Expert: the serial monitor with extra debugging tools
- LCD Library for Proteus V3.0: 16x2, 20x4 and I2C LCDs to show your readings
The demo is a fish pond monitor: an Arduino UNO V4.0 reads the oxygen and a waterproof temperature probe, shows mg/L and the saturation on a 16x2 LCD, switches an aerator when the oxygen falls in the night and sounds an alarm when the fish are in danger.
NOTICE: Our team has put a lot of effort into these small parts: the bodies, the animation and the pop-ups are all our own design, and you get them free. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below or in the water quality board of our forum. And if our free libraries help you, you can buy us a coffee. So, let's get started with the Dissolved Oxygen Sensor Library for Proteus Simulation:
What Is a Dissolved Oxygen Sensor?
Water holds a little oxygen from the air, a few milligrams per litre. How much it can hold depends on the temperature: fresh water at sea level holds 14.6 mg/L at 0 C, 9.1 mg/L at 20 C, 8.3 mg/L at 25 C and only 7.6 mg/L at 30 C. That maximum is called saturation, and a measurement is often given as a percentage of it. In a pond the real value swings far around it: plants and algae make oxygen in sunlight - the water can go above 100 % in the afternoon - and everything in the pond uses it up at night, so it is lowest just before dawn.
The Galvanic Probe
The kit's probe is a galvanic cell: a platinum cathode and a lead anode in a cap filled with sodium hydroxide (0.5 mol/L NaOH), closed by a thin membrane. Oxygen passes through the membrane and is reduced at the cathode while the lead anode corrodes, and the current is proportional to the oxygen's partial pressure. Unlike the older polarographic probes it needs no polarising voltage and no warm-up time - but it does take about 90 s to settle to 98 % of a change, and its anode is used up slowly, so the electrodes last about a year.
- Range 0 - 20 mg/L, 0 - 40 C, up to 50 psi, a 2 m cable with a BNC plug.
- The membrane cap is filled 2/3 with the electrolyte; the electrolyte is changed monthly, the cap every 1 - 5 months.
- The probe uses oxygen right at its membrane, so the water must move gently past it.
The Signal Board
The probe plugs into a 42 x 32 mm board with a BNC socket and a 3-pin connector: A (the signal), + (3.3 - 5.5 V) and - (GND). The board amplifies the probe's tiny signal to 0 - 3.0 V. Because the probe measures the partial pressure, the voltage is really the fraction of saturation: about 0 V without oxygen, and a certain voltage - Vsat - in water saturated with air. Every probe has its own Vsat, so it must be calibrated: the kit's example uses 1600 mV at 25 C.
The Formula and the Temperature
Two things change with the temperature. The membrane lets more oxygen through when it is warm, so Vsat rises - the kit uses 35 mV per C. And the water holds less oxygen when it is warm. The kit's formula handles both:
- Vsat(T) = CAL_V + 35 mV x (T - CAL_T) - the calibration moved to the water temperature.
- DO = V x DO_Table[T] / Vsat(T) - the fraction of saturation times the saturation at that temperature.
- DO_Table holds the saturation in ug/L from 0 to 40 C: 14460 at 0 C, 8250 at 25 C, 6410 at 40 C.
That is why a dissolved oxygen sketch needs a temperature sensor in the same water - here our waterproof DS18B20 from the DS18B20 Library for Proteus.
How Much Oxygen Fish Need
- 5 mg/L or more: fine for most fish.
- 3 - 5 mg/L: stress, slower growth; time to aerate.
- Below 2 - 3 mg/L: most fish are in danger; below 2 mg/L fish die.
- Trout and other cold-water fish need even more.
Features of the Dissolved Oxygen Library
- A real-looking board: the signal board at its true size with the BNC socket and the probe's cable, the amplifier and the A + - connector; the power LED lights at Run.
- The probe's physics: the output follows the fraction of saturation, with the membrane's 35 mV per C, so the kit's formula reads true.
- The real saturation: from the standard equation for fresh water at sea level.
- The board's limits: 0 - 3.0 V - with a 1.6 V calibration the top is near 15 mg/L.
- Calibration: VSAT sets the probe's output in saturated water; a pop-up button puts the probe in air-saturated water so you can read it.
- A pop-up: the oxygen against the fish limits and the saturation mark, the signal with the formulas and what an UNO reads; graphs, an event log and a check page.
- A complete package: about 3.0 MB with the library, our DS18B20, I2C LCD, resistors, LEDs and buzzer, our Arduino UNO V4.0 and the demo, without the source code of the model.
The Dissolved Oxygen Sensor in Proteus
The device is DOSENSORTEP in TEPDOSENSOR.LIB, under Modules > Sensors, with the model TEPDOSENSOR.DLL. Search DOSENSOR or oxygen in Pick Devices. Its three pins are the board's connector. Its properties: PROFILE (DEMO or STEADY), DO for STEADY, TEMP - the water temperature, the same as the DS18B20's - VSAT, the calibration in mV at 25 C, and RESPONSE, the time constant (0.3 s by default - fast time; the real probe takes about 23 s).
Download Dissolved Oxygen Sensor Library for Proteus Simulation
Click the button below to download Dissolved-Oxygen-Sensor-Library-for-Proteus-v1.0.zip (about 3.0 MB, without the source code of the models):
Dissolved Oxygen Sensor Library for Proteus V1.0- README.txt: installation, the demo, the wiring, troubleshooting and the limits of the simulation.
- Proteus Library Files:
TEPDOSENSOR.LIB,TEPDS18B20.LIB,TEPI2CLCD16X2.LIB,TEPRESISTOR.LIB,TEPLED5MM.LIB,TEPBUZZER.LIBandArduinoV4TEP.LIB. - Proteus Model Files:
TEPDOSENSOR.DLL,TEPDS18B20.DLL,TEPLCD.DLL,TEPRESISTOR.DLL,TEPLED5MM.DLL,TEPBUZZER.DLLandTEPARDUINO.DLL. - Arduino Code: the demo sketch (Wire, OneWire and DallasTemperature).
- Proteus Simulation: the demo project, its HEX file and copies of the DLLs.
No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.
How to Install Dissolved Oxygen Sensor Library for Proteus Simulation
- Close Proteus and extract the whole zip file, for example to your Desktop.
- Copy the files from Proteus Library Files into the LIBRARY folder of Proteus.
- Copy the files from Proteus Model Files into the MODELS folder.
- Delete
TEPDOSENSOR.IDXfrom the LIBRARY folder if it is there. - Start Proteus, press P and search for DOSENSOR.
Proteus Simulation of a Fish Pond Monitor
The demo uses an A4 sheet with our Arduino UNO Library for Proteus V4.0. The DO board (U1) has its output on A0; the DS18B20 waterproof probe (U2) sits in the same water on D2 with its 4.7 k pull-up (R1). A 16x2 LCD from our I2C LCD 16x2 Library for Proteus sits on the I2C bus at 0x27; a green LED on D5 is the aerator, a red LED on D6 the low-oxygen alarm, and BZ1 from our Active Buzzer Library for Proteus on D8 sounds with it. The Arduino's monitor is built in, the same window as our TEP Serial Monitor Advance for Proteus. Open DO-Fish-Pond-ArduinoUnoV4.pdsprj.
The DEMO is a recorded night in a fish pond at 26 C, played in fast time: the evening near saturation, the oxygen falling through the night, an aerator switched on, and daylight with photosynthesis. As in a recording, the aerator LED shows what the sketch decides; in a real pond that pin would switch the aerator through a relay.
The Sketch
The calibration is two constants - the probe in air-saturated water gave 1600 mV at 25 C:
const unsigned int CAL1_V = 1600; // mV: the probe in air-saturated water ...
const byte CAL1_T = 25; // ... at 25 C (a single-point calibration)
The DS18B20 needs up to 750 ms for a 12-bit conversion, so the sketch never waits for it: it starts a conversion, reads the oxygen four times a second meanwhile and collects the temperature 800 ms later:
water.setWaitForConversion(false); // never block: start a conversion, read it 800 ms later
The temperature, rounded down to whole degrees like the kit's code, is the index into the table:
const byte t = constrain((int)tempC, 0, 40); // the table's index: whole degrees, like the kit's code
Then the kit's two lines: the calibration moved to this temperature, and the oxygen:
const float vSat = CAL1_V + 35.0 * ((int)t - CAL1_T); // the probe gives more as the membrane warms
const float dO = mV * DO_Table[t] / vSat / 1000.0; // mg/L
The aerator works like a thermostat with a gap: on below 4 mg/L, off at 6.5 mg/L. Below 3 mg/L the red LED and the buzzer warn that the fish are stressed.
Dissolved Oxygen Simulation Results
Open the project and press Run. The demo runs 11.4 simulated seconds and took about 2 minutes 50 seconds on our PC with the pop-up open and the pictures being taken. Click U1 for its pop-up. Every number below comes from one simulation run, the demo exactly as it ships.
The Evening
At power-on the galvanic probe needs no polarising time, and the board lights its power LED. The monitor confirms the start-up: "DS18B20 found: 1; calibration: 1600 mV in saturated water at 25 C". The water is at 26.0 C, where it holds 8.11 mg/L when saturated, so the sketch moves the calibration to Vsat = 1600 + 35 x (26 - 25) = 1635 mV. The first status line, at 2.06 s, reads 1411 mV: 1411 x 8110 / 1635 = 7.00 mg/L, 86 % of saturation. The pop-up at 1.0 s shows the evening pond at 7.47 mg/L, 92 %, and the signal card spells out the same formulas with the live numbers.
The Night
Through the night the fish, the plants and the bacteria use the oxygen and nothing makes new oxygen. At 4.06 s the monitor reads 977 mV, 4.84 mg/L, 60 %; the pop-up at 4.0 s turns amber - LOW - at 4.66 mg/L. At 5.06 s the oxygen falls under the cut-in: "aerator ON at 3.80 mg/L", the green LED lights and the LCD shows AERATOR.
The Fish in Danger
An aerator does not work instantly, and the oxygen keeps falling. At 6.06 s the monitor prints "LOW OXYGEN - the fish are stressed" with 581 mV, 2.88 mg/L and 36 %: the red LED lights, the buzzer sounds and the LCD says "LOW O2!". The pop-up at 6.2 s turns red - "FISH STRESS - 2.70 mg/L (33 %): aerate now". Its signal card shows the probe's lag too: the water calls for 544 mV, but the output is still at 573 mV, which an UNO reads as 117 counts = 2.84 mg/L. A real probe lags far more - about 23 s.
The Aerator at Work
The aerator wins: at 6.81 s "oxygen above 3 mg/L again", and the pop-up at 7.6 s shows 5.78 mg/L, 71 %, "the aerator lifting it". At 8.07 s the monitor reads 1270 mV, 6.30 mg/L, 78 %, and at 8.32 s "aerator OFF at 6.54 mg/L" - the cut-out at 6.5 mg/L. The gap between 4 and 6.5 mg/L keeps the aerator from switching on and off all the time.
Daylight
In the morning the plants and algae start to photosynthesise. The pop-up at 9.6 s shows 8.64 mg/L - 107 % of saturation, and its banner turns blue for supersaturated water. At 10.07 s the monitor reads 1841 mV, 9.13 mg/L, 113 %, and the pop-up at 11.4 s shows 11.50 mg/L, 142 %, with the output at 2.285 V - still under the board's 3.0 V top, which at this calibration and temperature is 14.9 mg/L.
The Graphs, the Event Log and the Check Page
The Graphs page plots the oxygen, the saturation, the board's output and the moments below 3 mg/L: the night's valley and the morning's climb past 100 % are easy to see. The Event log lists each stage of the pond and the low-oxygen warning. The Check page sums up the run: the supply at 5.00 V; the signal 2.285 V for 11.50 mg/L, with the 3.0 V top at 14.9 mg/L here; the water at 26.0 C, saturation 8.11 mg/L; the oxygen amber because it fell below 3 mg/L once; and the calibration, 1600 mV at 25 C.
The Arduino's built-in serial monitor prints the start-up - the DS18B20 found and the calibration - then a status line every 2 s with the water temperature, the probe's millivolts, the oxygen and the saturation, and a line of its own for each change: the aerator on or off and the low-oxygen alarm. Its times come from millis(), which starts when the sketch starts, a few hundredths of a second after the simulation does.
Calibrating Your Own Probe
Put the probe in water that has been stirred or bubbled with air for 10 minutes - or hold the wet probe in still, damp air - wait for the reading to settle and note the millivolts and the temperature. Those are CAL1_V and CAL1_T. In the simulation: set VSAT to another value, click "100 % (calibrate)" in the pop-up and read the millivolts on the monitor - that is your new CAL1_V, with CAL1_T = the water temperature (26 C in the demo). For the best accuracy over a wide temperature range, calibrate at two temperatures and draw a straight line between them, as the kit's two-point option does.
Other Water Sensors
Dissolved oxygen is one of the key numbers of water quality. Our PH-4502C pH Sensor Library for Proteus measures the acidity and our TDS Meter Library for Proteus the dissolved salts - together with oxygen and temperature they cover an aquarium, a pond or a hydroponic tank.
Try It Yourself
- Click U1 while the simulation runs and use the chips: 2 mg/L sets off the alarm, 16 mg/L runs the board into its 3.0 V top, 100 % shows the calibration value.
- Set TEMP and the DS18B20's TEMPERATURE to 10: the water holds more oxygen, Vsat falls, and the readings stay right because the sketch knows the temperature.
- Set only TEMP to 10 and leave the DS18B20 at 26: the sketch uses the wrong temperature and the readings go wrong - the temperature sensor must be in the same water.
- Set VSAT to 1300 without changing CAL1_V: every reading is about 20 % low until you calibrate.
- Set RESPONSE to 23: the probe follows as slowly as a real one, and the night's changes lag behind.
Ideas to Extend the Demo
- Drive a real aerator through a relay, with a minimum run time so the pump does not start too often.
- Add the two-point calibration and store it in the EEPROM.
- Log the oxygen every few minutes and warn before dawn if the night's trend points below 4 mg/L.
Your Own Sketches
The demo sketch is in the zip file, and you can change it in the Arduino IDE. New to Arduino? Start with our Arduino Tutorial for Beginners. Export the compiled binary, and set the UNO's PROGRAM property to the new file. Our guide on How to get the HEX file from Arduino shows you where the file ends up.
Things to Know Before Using a Real Dissolved Oxygen Probe
- The electrolyte: 0.5 mol/L NaOH is corrosive - wear gloves; fill the cap 2/3 and screw it on upright without bubbles.
- Maintenance: refill monthly, change the membrane cap every 1 - 5 months, polish the cathode if the zero drifts.
- Flow: keep the water moving past the membrane.
- Temperature: never above 40 C; always give the sketch the water temperature.
- Salt and altitude: the table is for fresh water at sea level; sea water holds about 20 % less oxygen.
Troubleshooting
- The reading is far off: calibrate - CAL1_V must match your probe.
- The reading follows the temperature: the sketch is not getting the water temperature.
- The reading stops at 14 - 15 mg/L: the board's 3.0 V top.
- Near 0 in clean water: no electrolyte, a holed membrane or no supply.
- The part is not simulated:
TEPDOSENSOR.DLLis missing from MODELS and from the project folder.
Limitations of the Simulation
- The board's output, the fraction of saturation, the kit's temperature constant and formula and the fresh-water saturation follow the kit's documents and the standard equation; the board is our own drawing.
- Our own figures: VSAT 1600 mV at 25 C, a 100 ohm output, 5 mA, RESPONSE 0.3 s in fast time, the DEMO's curve.
- The DEMO is a recorded pond in fast time: the aerator does not change the simulated oxygen.
- Not modelled: salinity, air pressure, the flow dependence, membrane ageing.
- Arduino is a name of Arduino; this library is not made or endorsed by Arduino, Labcenter or the maker of the kit.
- Tested in Proteus 8.5 in November 2026 (the demo as shipped). Proteus 7 is not supported.
So, that was all about the Dissolved Oxygen Sensor Library for Proteus Simulation. I hope it helps your fish sleep well. If you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!