underwater fish detector - Page 1
Forum section: electronics / projects

author: fedimakni
author_rank: Regular Contributor
timestamp: February 27, 2024, 02:38:33 pm
content: I would like to create an underwater fish detector - completely operating underwater (personal project)The enclosure will be a waterproof hollow cylinder (possible material to use are: acrylic, Polycarbonate or PVC), a PCB will be sealed inside that enclosure containing the sensor (the sensor of choice should not be waterproof because it will be inside a waterproof enclosure).The fish can pass through that hollow and will be detected while passing. the inner diameter of the enclosure will be in the centimeter range to allow one fish to pass at a time.Note:I am not dealing with precise measurements or long range (no need for those expensive high precision sensor)I cannot use big or expensive sensors due to budget related reasons and size constrainmax operating voltage of the PCB is 12V (preferably 5V or 3.3V)Here's a link to picture that illustrate the idea for better understandinghttps://drive.google.com/file/d/13LIXOK5Zvt1R61uHieQIGLCPWyVfH69t/view?usp=drive_linkI am using 2 sensors so i can make sure i detect that it passes throughoptional receivers can be implemented if the sensor i use is just a transmitter and not transducerHere comes the challenging part, the sensor choice, i will list some i thought about and i hope i can get some ideas from you that can help me.- Ultrasonic sensor (i saw some people successfully did it but nothing is documented with low cost sensors):Challenges:Blind distance of ultrasonic sensor for small measurements.I don't know if the acoustic wave can pass through acrylic hit the fish and be detected- Optical sensor (such as VL53L1 or any other choice)Challenges:Require clear waterwater can scatter the light but i am using it for short distance so i don't know if it will work or notrequire transparent enclosure- ESP32 camera (image recognition algorithm)Challenges:Require complex algorithmRequire clear waterI would like to hear if you have any other idea or if i can improve one of the suggested ideas to successfully achieve the project.Thank you very much.

author: David Hess
author_rank: Super Contributor
timestamp: February 27, 2024, 03:23:17 pm
content: I think optical will be the easiest.I wonder if an LC tank circuit with the inductor wrapped around the fish tube would work.

author: DaJMasta
author_rank: Super Contributor
timestamp: February 27, 2024, 03:52:25 pm
content: I'd think optical is the way to go as well, but rather than a distance sensor, you could probably just have some IR illumination and then a photodiode or two - just looking for something opaque to pass through the beam. You'd want to keep the emitted light out of the visible band so you don't effect their behavior in using it. You could also use several emitters or detectors to measure movement/avoid murky water causing issues/discern multiple fish from one/etc. Provided you can seal a hole in the enclosure, you could also potentially get the optical parts in direct contact with the water and then just seal the electronics side.Ultrasonic would be possible, but I doubt practical in this situation. To get a good measure of what's in the water, you'd probably want the transducer to interface directly with the water, not through a separate enclosure. There may still be meaningful data can can be had from a dry sensor, but the difference between the reflection of the enclosure and the reflection of the fish in the water outside of it will be subtle, and it will probably be a good chunk of effort to identify that signal.

author: fedimakni
author_rank: Regular Contributor
timestamp: February 27, 2024, 03:52:58 pm
content: Do you mean detecting the electromagnetic field change when the fish pass through the tube?I was really thinking about it, but i don't know how to make it and how to measure the change in that E-field. Do you have any idea or any video showcasing such approach?Thanks

author: fedimakni
author_rank: Regular Contributor
timestamp: February 27, 2024, 03:56:24 pm
content: Thanks for your answer.Do you mean i need to use multiple light transmitter on one side and multiple receiver on the other side?Do you think IR can pass through water?

author: Kleinstein
author_rank: Super Contributor
timestamp: February 27, 2024, 04:23:35 pm
content: Water is not good in passing IR light. The wavelength of choice is more in the blue or green range. Here the absorbtion is lowest. With the relatively short distance it should still work with not so clean water. Over the long run algee groth on the detector parts can be an issue that would effect most of the sensors.Ultrasound should also work, but the transducers are a bit more rare and may be more expensive.

author: fedimakni
author_rank: Regular Contributor
timestamp: February 27, 2024, 04:30:58 pm
content: Thanks KleinsteinDo you any knowledge about someone tried something similar that it works, so at least i can get idea from his experience?Thank you for your answer

author: DaJMasta
author_rank: Super Contributor
timestamp: February 27, 2024, 08:07:27 pm
content: Water doesn't transmit infrared as well as shorter wavelengths, but you will have more than enough output from a standard LED to go a few inches through a pipe, so the reduced transmission should be negligible even at 850nm or so, which prevents you from lighting up the inside of your counter and dissuading fish from going through it.A single LED and photodiode would work, but if you wanted more output or several sensors to try and get more info (speed of movement, size of the fish, error checking for very turbid water, etc.) multiple could be useful and easy to implement.

author: coppercone2
author_rank: Super Contributor
timestamp: February 28, 2024, 12:34:22 am
content: ultrasonic might be detrimental to fish, lots of research is emerging about how sonar is not good for wild life. low power light beam (blocked to only go in one path like a laser) is the best solution for anything but a boat.there is lots of research going on right now on how to quiet down aquatic environments. everything from reducing sonar power as much as possible to decreasing propulsion noise with special propellers and quieting engines etc.And quiet in engineering is always more impressive then loud. you could sell something quiet because its quiet.

author: David Hess
author_rank: Super Contributor
timestamp: February 28, 2024, 02:59:31 am
content: Quote from: fedimakni on February 27, 2024, 03:52:58 pmIt would really be a change in the h-field. The capacitor and inductor form a resonate tank for an oscillator, and then a measurement is made of the frequency. This is just a way to measure reluctance, but offhand I have no idea if a reluctance sensor will detect a fish, but reluctance sensors are very sensitive.Metal foil could be placed on each side of the tube making a capacitor, and there are lots of ways to accurately measure capacitance. As the fish swims through, the dielectric constant between the plates changes so the capacitance changes. The dielectric constant of water is about 78.4, but again, I have no idea what the dielectric constant is of a fish.With some more sophistication, both methods can be extended to measure loss, as with a metal detector, giving even more ability to discriminate.

author: moffy
author_rank: Super Contributor
timestamp: February 28, 2024, 06:35:02 am
content: Quote from: David Hess on February 28, 2024, 02:59:31 amIt might be salt water, not the best dielectric, certainly not distilled water even if fresh. I think I read a while back that green light has the lowest absorbtion rate in water back when the US navy was researching light based detection underwater but I could be wrong, and it might be irrelevant because of the short distances. I would think doppler sonar at a moderately high frequency would be the best for detecting something in motion. Maybe even in combination with some sort of light detection.

author: Berni
author_rank: Super Contributor
timestamp: February 28, 2024, 06:42:29 am
content: You don't want to capacitively detect fish.The fish is mostly made out of water, and it is swimming in water. So it will be hard to tell apart the fish from the water it is swimming in.Optical is the way to go if you have a tube where you can place things on both sides of it. Be it LED on one side and photo detector on the other side. Even more convenient is placing the LED and detector on the same side and then put a mirror on the other side. Yes water does attenuate red and infrared light, but not to the point where it would be a perfect filter or something. Sure you might have trouble getting a red laser to go 100m trough water without putting a lot of power into it, but for 10cm you won't really see any meaningful attenuation. The long wave infrared is what absolutely will not go trough water for any meaningful distance (but LEDs are not even capable of producing those wavelengths).Tho this being in water you could have issues with dirt building up on the optical surfaces and blocking your beam. So it might need some cleaning every few months.If you want it to be robust to dirt then ultrasonic is the way to go. You can get some automotive piezzo ultrasonic transceivers that are completely sealed, so they should work under water. Then you send pulses into it at its resonant frequency and quickly listen back for a echo. If the echo arrives sooner than usual, you got a fish in there.

author: Kleinstein
author_rank: Super Contributor
timestamp: February 28, 2024, 08:22:34 am
content: Using red or NIR may indeed be good, depite the high absorbtion in water. The fishes would not see it so much. The water may also shield it from external light (e.g. the sun).2 pairs of LED/sensor may be a good idea, as this would allow seeing the direction of the movement. Here it may help if the 2 pairs are not too far apart (less than the length of the fish). 1 LED and 2 sensors could be enough for this.For ultrasound the distance is a bit short to get a classical echo for a distance measurement, but the fish will most likely change the acoustic response enough to see a difference. It may need some experimenting on how different the fish is from just water. With sensitive systems they even use ultrasound to tell different chemicals aprart and do a check if the contend is what it is supposed to be. The sonic response has quite some information, but it can be hard to directly calculate back to a single property. It is more like a signature / hash : small differences can be seen, even of not clear what has changed.A capacitive detection could be tricky and also react to changes in the water (e.g. salt). In theory one should be able to see the electric flield that a life fish produces from it's body - kind of doing a swim by EKG.

author: fedimakni
author_rank: Regular Contributor
timestamp: February 28, 2024, 09:52:03 am
content: Thank you all for the response:I have 2 questions:- Optical: How to choose the right LED in that case? i heard that blue because it has low wavelength can be good even in murky water, but will normal led work or i need special LED? do you think i need a special optical lens in order to not allow the light to spread in all direction?- Ultrasonic: I am currently checking the options of how to create one: i think there are 2 approach1. using normal ultrasonic sensor mounted to the PCB and if the enclosure is thin enough, the wave can go into the water and detect the fish (i can make the receiver on the other side of the tube) but i am not sure if the wave can bypass the enclosure2. use a piezo as transmitter and seal it and let it exposed to sea water and i can detect the echoes with the same approach on the other side.What do you think about that?

author: Kleinstein
author_rank: Super Contributor
timestamp: February 28, 2024, 10:14:39 am
content: For the LEDs I would choose 850 nm as the fishes can very likely not see it. The absorbtion length in water should be a few 10 cm, so long enough to get light through and still have it somewhat shielded from above. There are fotodiodes / foto transistors with IR filter (e.g. 750 nm). In water the lense action of the case is essentially eliminated. So even of the LEDs are highly focussed in air, in water this would no longer apply, as the refractive index of water is relatively close to that of the plastic lense/case. One can expect quite some spreading of the light and wide angle emitters / detectors under water.The simple plastic case versions as used for IR remotes should be OK. Depending on the light from above one may still need to modulate the light to suppress the background and get better sensitivity.One could try out the basic optics and electronics likely without the tube first. For a first test maybe use a red LED, so one can see things.There are ready-made remote detector chips (e.g. TSOP1xxx series) with demodulation. If one finds a typ that can be water proofed it could be an easy option, though it needs a complicated modulated signal and only gives a digital out.

author: Berni
author_rank: Super Contributor
timestamp: February 28, 2024, 10:30:47 am
content: Any LED works, tho the photo detectors tend to only be no filter or with an IR pass filter, so using IR has an advantage there of helping you get a better signal using a filtered receiver. Also having something that fish can't see is a benefit to avoid affecting their decision to go trough. IR is good there since in general animals don't see IR, or they see it poorly if they do. But yes as said above, the lens on a LED might not work so well in water due to the refractive index, but it might still work well enough, the distance is short after all.As for waterproofing piezzo transducers yourself. Do NOT do that. The science behind sound transmission can be quite complicated and so you need to know what you are doing if you plan to encapsulate a transducer yourself. Just grab an off the shelf potted water proof transducer, they are cheap and common as they are used in cars as parking sensors.

author: fedimakni
author_rank: Regular Contributor
timestamp: February 28, 2024, 10:54:06 am
content: Thanks, I actually checked some waterproof ultrasonic sensor, but i noticed that don't operate well underwater. They don't like to be submerged into the water. so operating them with cars just in the case of rain or water splash is ok but other than that, they may not be that reliable or can be damaged overtime.

author: Berni
author_rank: Super Contributor
timestamp: February 28, 2024, 11:18:33 am
content: Yeah water is going to affect the sensor. The datasheet will have specs for use in air, but some specs might shift a fair bit once in water, so you will need to characterize it yourself. It might need the operating frequency adjusted to match the new resonance or it might need stronger drive...etcThe reason for getting an off the shelf one is that it was potted in a way that gives it good acoustic coupling to the outside. You can also buy multiple of them and rely on their properties being similar, so that the driving circuitry does not need adjustment for each sensor.

author: Harrow
author_rank: Regular Contributor
timestamp: February 28, 2024, 12:23:41 pm
content: Quote from: David Hess on February 27, 2024, 03:23:17 pmThis has my vote because it's such a cool idea! Is a fish different enough from water? As I always say, there's one sure way to find out! Not too much work to set up and then observe readings as fish pass through. If you make it very high-Q, maybe it will be sensitive enough??? Whichever you decide, this is a fun and kooky little project. :-)

author: voltsandjolts
author_rank: Unknown
timestamp: February 28, 2024, 12:27:32 pm
content: We have a fish ladder locally with a fish counter in it. Uses a trained AI camera system apparently.

author: fedimakni
author_rank: Regular Contributor
timestamp: February 28, 2024, 12:31:26 pm
content: HarrowThank you for the response,Do you have any picture or video that can showcase the idea? i tried to understand it but i couldn't get it well. Do we need to make like an electromagnetic cage and detect the change in that field? but what kind of device is used to detect that change?I really think it's a cool idea but how can i start with it? Thanks again.

author: fedimakni
author_rank: Regular Contributor
timestamp: February 28, 2024, 12:33:28 pm
content: voltsandjolts,Do you have a link for that product? thanks

author: Harrow
author_rank: Regular Contributor
timestamp: February 29, 2024, 02:26:37 am
content: Quote from: fedimakni on February 28, 2024, 12:31:26 pmI guess have a wire wound around the tube a few times to create an air-cored inductor (in this case water-cored) and then add the capacitor to make the LC resonant circuit. Then excite the circuit with an oscillator voltage source set to the resonant frequency. When the fish goes through the tube, the change in inductance value will be seen as a blip in line current as the change in resonant frequency creates line current.Alternatively, you could have plates either side of the tube and it's the capacitance that changes, not the inductance. As others have pointed out, a fish might not make any noticeable difference to the relative permeability or permittivity of the water, but I just liked the concept - novel thinking by David! ;-)Would you believe, I just googled "permittivity of fish vs water" and people have actually measured it, LOL!!! The internet will never cease to amaze me.https://www.researchgate.net/figure/Dielectric-constant-of-four-species-of-fish-within-the-temperature-range-of-20-100C-at_fig2_337585960

author: David Hess
author_rank: Super Contributor
timestamp: February 29, 2024, 01:40:32 pm
content: Quote from: Harrow on February 29, 2024, 02:26:37 amI like the inductance or capacitance idea because it does not require sealing a cut through the tube.Quote

author: eutectique
author_rank: Frequent Contributor
timestamp: February 29, 2024, 02:21:10 pm
content: Quote from: Harrow on February 29, 2024, 02:26:37 amwithin the temperature range of −20-100°CI could not find the power levels though.

author: fedimakni
author_rank: Regular Contributor
timestamp: February 29, 2024, 02:33:42 pm
content: The capacitance check is very interesting, but i think it require to use 2 plates exposed to sea water and then measure its capacitance correct?i think it can work too, but i think it require a good material choice as the sea water can affect those plates over time right?

author: eutectique
author_rank: Frequent Contributor
timestamp: February 29, 2024, 02:50:52 pm
content: Quote from: fedimakni on February 29, 2024, 02:33:42 pmYou will then measure conductivity of sea water and fish within. You should avoid exposing the plates.

author: fedimakni
author_rank: Regular Contributor
timestamp: February 29, 2024, 02:53:38 pm
content: But if they are not exposed to sea water how the plates will act as capacitance? i think with around 20-30 cm gap it will be really not noticeable enough. What do you think?

author: eutectique
author_rank: Frequent Contributor
timestamp: February 29, 2024, 03:25:58 pm
content: Quote from: fedimakni on February 29, 2024, 02:53:38 pmHere is a good explanation of the theory behind the capacitor:https://en.wikipedia.org/wiki/Capacitor#Theory_of_operationIf you expose two plates to sea water they will form a resistor, generally speaking.

author: Kleinstein
author_rank: Super Contributor
timestamp: February 29, 2024, 03:49:57 pm
content: One could have the electrodes in direct contact to the water or have a thin isolating layer on top. The isolator acts like a series capacitor and would reduce the current flow quite a bit.Not to distract the fishes one would have to use a weak field anyway. With seewater the water is likely more in the resistive regime and little actual capacitance. The fish than would be more a change in resistance. The system would thus also react to chances in water composition (e.g. after rain or fresh water from a river).

author: voltsandjolts
author_rank: Unknown
timestamp: February 29, 2024, 05:31:00 pm
content: Quote from: fedimakni on February 28, 2024, 12:33:28 pmNo technical info, just some general info and press releases from SSE, the hydro dam owner.https://www.pitlochrydam.com/https://tayrivers.org/news/pitlochry-dam-fish-counter/There is also this description of an AI fish detection system:https://www.anthropocenemagazine.org/2023/10/artificial-intelligence-it-turns-out-excels-at-the-humble-pursuit-of-counting-fish/https://blog.roboflow.com/using-computer-vision-to-count-fish-populations/

author: Kleinstein
author_rank: Super Contributor
timestamp: February 29, 2024, 05:33:05 pm
content: The camera + AI adds the identification of the fishes. For just counting it would be more overkill.

author: qtbits
author_rank: Newbie
timestamp: March 01, 2024, 08:04:31 am
content: Personally - I'd go with the ESP32 + camera - There are already examples for "face" recognition and with a bit of effort it could be "trained" for fish. Also... you may want to do more than just counting a a later date.Plus you get the wireless (shouldn't "fry" the fish too much).

author: Njk
author_rank: Frequent Contributor
timestamp: March 02, 2024, 06:40:19 pm
content: Remember the air flow sensor in certain car engines. There is a filament (or film) resistor which is heated by current and cooled by air flow. The flow is measured by measurement the resistance value that depends on the temperature. Use a setup like this. When the fish is passing through the tunnel, it changes the thermal balance inside the tunnel. To simplify the detection, use a set of two similar tunnels and measure the difference (assuming social interaction in fish society is not so advanced so they will not try to fool you by passing both the tunnels simultaneously).

author: Harrow
author_rank: Regular Contributor
timestamp: March 02, 2024, 09:06:51 pm
content: Quote from: fedimakni on February 29, 2024, 02:53:38 pmI'm not sure why, but I was visualising a large salmon squeezing through a 4-inch tube. With a larger tube and smaller fish, I'm guessing it's probably not noticeable. Now I wish I had some salmon and a tube to find out. I also wish I knew enough about AI to set up and train a camera system. ;-)

author: fedimakni
author_rank: Regular Contributor
timestamp: March 03, 2024, 04:10:33 am
content: HarrowThank you for your response. Did you try the capacitor approach before? could you share more details about the setup and the taken measurements?

author: moffy
author_rank: Super Contributor
timestamp: March 03, 2024, 05:10:32 am
content: If at all considering the camera approach, OpenCV, a large free computer vision toolkit might be of interest:https://opencv.org

author: Harrow
author_rank: Regular Contributor
timestamp: March 03, 2024, 06:14:10 am
content: Quote from: fedimakni on March 03, 2024, 04:10:33 amSorry, no, I've not tried this. It was David's idea and I just thought it was a fun approach, but I've never tried it myself.

author: David Hess
author_rank: Super Contributor
timestamp: March 03, 2024, 09:15:30 pm
content: For the capacitor plate approach I was thinking of the capacitor plates placed outside of the pipe that the fish is traveling through, with another pipe around them sealing them off from the water. I was not thinking of allowing the plates to contact water.