I have shelved the phased sonar for now, its extremely complicated and its going to take time to figure out, so the next idea was a mechanically rotating scanning sonar, using count74s code as a start I replaced the stepper motor code with servo code and replaced the LIDAR code with serial sonar code. This gave me a waterproof rotating rangefinder that I can run in a number of ways. Because im using the feedback pin to set the rangefinder orientation rather than the servo input it means I can use other inputs to drive the rangefinder scan like camera following or direct rc control.
first attempt just got the 8 segments but after adding a heart beat I got the 72 segment
the plan now is to 3d print something more hydrodynamic so when I rotate the sonar transducer the boat doesn’t weave from side to side the plan is to mount the sonar transducer it on the end of a brass tube under the boat driven by a servo using a belt to increase the angle so i can use a regular servo.
my next design will have the transducer embedded into it rather than on the end, this “tube” should focus the sonar on a much smaller field of view giving much more accurate returns.