I recently bough a DS1603LV1.0 from Amazon. This sensor is suppose to be able to detect the water depth of a container, without even touching the water. However, after running the code for the library, it says it cannot even detect the sensor. I cannot tell if I need some other component to make this work, the wiring is bad, or the sensor is bad. Any opinion or answer is welcomed.
Connection: VCC -> 5V, GND ->GND, TX PIN -> pin 4, RX ->Pin5.
Library: Arduino_DS1603L/DS1603L.ino at master · wvmarle/Arduino_DS1603L · GitHub
I'm not familiar with your sensor or library but I would first check the baud rates are all the same between your code, the sensor and the IDE monitor.
I just changed them to all be 9600 and the serial output is legible! Unfortunately, I think the sensor is faulty as it just gives me the same value regardless of the amount of water. But regardless, thank you for the reply.
I don't understand this sensor. In the graphics it looks like it is a water or no water sensor, kind of like a float switch. But it has a serial output and suggests it reports in mm.
Have you tried it with a flat sided container? I would suggest if it is not glued to the container you at least wet the interface and have a small a gap as possible.
Apparently this sensor can give an accurate output of how much water is in a container. I tracked down this library from this forum page:
The page has multiple people saying its capable of outputting a value in mm. I have glued this sensor to the bottom of a container filled with water but it doesnt seem to register anything.
Thank you for the suggest JohnRob. I actually ditched the library in favor of just using the SoftwareSerial.h library.
The sensor reads like so: value1 (sensor turns on, always 255), value 2 (receiver received nothing so its always 0), value 3 and 4 seem to be the accurate measurements of the water.
I'm not sure how I can create a line of code to only accept the last 2 values. Should I create a for loop counter that collects the value whenever i=3, or is there a better way to do that?
As I said originally I found sorting the easiest method. I wasn't in C so my code would be useless to you.
But...
Create an array of int 16 chars long (a few more than you plan to sample)
In a for loop
collect 15 samples
Then use a sort routine. Google Arduino sort array and you will find many options.
In another loop add the array numbers array[10] + array[11].....array[14]
then divide by 5 and you have a pretty solid value. This step basically ignores the highest 5 and the lowest 5 samples. Hopefully throwing out the "bad" samples.