Depth Transducer on UART2

I am working on a project that involves interfacing a depth transducer to APM 2.5 and am having a little trouble.

As mentioned before, this is APM 2.5 that I am working with. I have had a pin array mounted to the board to gain access to the UART2 interface. This is where I intend to connect the depth transducer, an AT400 series model from Radarsonics. According to its specifications, the depth sensor communicates at 4800 baud, 8 bits, 1 stop bit, and no parity or flow control. I have verified that the transducer is working by connecting it to the serial port of a Linux desktop and tapping into the serial tty.

On the transducer, there are three wires: a ground, a +12V, and the signal. The signal wire is connected directly to the APM's UART2 Rx pin. The +12V goes to the power supply. The ground wire is tied with a -12V wire that leads back to the pin interface which I have connected to the ground on the APM (there's no difference to my situation whether I connect this wire to the ground on the APM or not).

I took the APMrover 2.47 firmware and made modifications to the source to allow GPS location and depth to be printed to the telemetry log. I created a separate function in the code for this and added it to the built-in scheduler in APMrover2.pde. All of this works fine and I can get output in the telemetry logs periodically, as I specified in the scheduler.

The problem comes when reading data from the depth transducer. In the system.pde file, I have added the appropriate statement to initialize the UART2 port to communicate at 4800 baud with read and write buffer sizes both at 128. When the scheduler executes my depth-logging function, about half of the time, it reports that the buffer is empty and the other half of the time I get only a single character before it finds that there's nothing left to read in the buffer. And the times when I do get a character, it's always either a '?' or a '{', neither of which are in the output specification of the transducer.

What have I done incorrectly?

Thanks in advance.

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Admin

    @Marshall,

    Have you taken a look at my Pontoon RSV Project: Link ?

    My GPS/Depth Finder .ino code is in a post near the bottom of the page. This should give you an idea of what the depth finder serial data capture code should look like.

    Regards,

    TCIII AVD

    • I inspected your code, and rewrote my code based on it. It hasn't allowed me to get the NMEA string from the sensor, but the output is considerably different. Now, I am always able to get input from the transducer, but it is always one character that fills the entire buffer. There still does not seem to be any correlation to the output spec either.

      The HAL interface provides me with a class called UARTDriver that is used to communicate. The functions present in the class are different from the ones you have for the Arduino. May I ask what the listen() function is doing?

      I have attached the code that I used for this past run and also the output that arrived in the telemetry log I grep'ed out. The function I created, log_depth(), should be at the bottom of the file, or around there.

      full_buffer_log.txt

      APMrover2.pde

    • Admin

      @Marshall,

      The listen() function is looking for the GPS string $GPRMC and the Depth Finder string $SDDBT at which time it will capture the data that is in those two strings.

      I am not a very good Arduino programmer and have used other programmers' example code to produce my own so I will probably not be able to help you very much.

      Regards,

      TCIII AVD 

This reply was deleted.