Sonar Project

Hi
I am currently working on a fish finder project using an Arduino mega to create the adjustable timing pulses and an adjustable frequency oscillator that is required. The transmit pulse width needs to be adjustable from 50us to 500us, during the transmit pulse an oscillator that is adjustable needs to run at 150 kHz - 200 kHz. The main timing pluses have to be in 3 selectable ranges of 12.5ms 25ms and 50ms. Can anyone help with the code for this, as this is my first project with an Arduino and I can’t get my head around the code?
I have started on the transducer pulse circuit giving two outputs of 940 Volts and 470 Volts peek to peek which will be selectable to give a HI and LOW power output. I would like to later on incorporate the receiver circuit into the Arduino for signal processing, and the output displayed on a laptop like a normal fish finder.

As a first project, this is not a good start. Start with basics read switches and turn on LEDs etc. Get familiar with the device and electronics.

Working with the voltages required also presents a problem. Very few of us would want to help with dangerous voltages.

Weedpharma

A timer can be used to create the signal (PWM). Then you turn on and off the signal in loop(), or use another timer for that purpose.

Details depend on whether the standard libraries support the required frequencies and timing. E.g. analogWrite() can be used to create a PWM signal, but the default frequency is below 1kHz, so that you need another function to change that frequency as required. Read more about analogWrite() and the BlinkWithoutDelay, Ping and similar examples.

The receiver most probably requires an analog amplifier and filter, to convert the analog input signal into a digital level square wave. I assume that you have the required skills for that part of your project. The software part again depends on your specific requirements (time resolution...), whether polling in loop() is sufficient or you need another timer for higher resolution.

The Arduino timers can be used for a broad range of different applications, so that you may or may not find code examples or libraries matching your specific requirements. Many cases require coding at low (hardware) level, so that you should learn more about timers and related registers and control bits. But ultrasonic applications are somewhat standard, try searching the forum e.g. for "range finder" or "ping" for more information.

I have made quite a few analogue sonar type projects in the past, but this will be the first time integrating one with an Arduino. The ones that I have made in the past are based around 555 timer circuits to control the timing pluses etc., but the Arduino will keep the timing signals more stable and more user adjustable. I have worked in the electronics trade for some time, but have not used an Arduino and am just trying to work out the programming code of it to produce the required timing signals.