Interfacing a MaxBotics ultrasonic range sensor to a WiSense node

MAXBOTIX makes highly reliable ultrasonic range sensors. I have used them in the past for vehicle detection in covered parking lots.

lv_max_sonar_ez_pic

This sensor can output ranging data serially. The serial parameters are –

  • 9600 bps
  • 1 stop bit
  • No parity bit
  • The serial output on the sensor’s TX pin needs to be inverted. I did this by using an opamp.

maxbotix_interface

In the block diagram (above), the +ve input is fixed at Vcc/2. The -ve input is connected to the MaxSonar’s TX pin. When the TX pin is low (0 Volts), the -ve input is lesser than the +ve input (Vcc/2), as a result the Op-Amp drives it’s output to Vcc volts. When the TX pin is high (Vcc volts), the -ve input is higher than the +ve input (Vcc/2), as a result the Op-Amp drives it’s output to 0 volts.

If the RX pin on the sensor is pulled high for at least 20 micro-seconds, it will trigger the sensor to perform a ranging operation. This will take around 49 milli-seconds.

I added an FFD app (ffd_app_wl.c) which periodically gets range data from this sensor and sends it to the external gateway app via the coordinator node. I used this app to measure the water level in the 1000 litre tank on the terrace.

The sensor driver is implemented in two files.

  • Pltfrm/src/max_sonar.c
  • Pltfrm/inc/max_sonar.h

Here is the code from ffd_app_wl.c.

max_code_2

.

.

.

.

.

.

.

.

.

.

.

.

max_code_1.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

You can take a look at the code on bitbucket.

Here is a snapshot of the gateway app running on the laptop connected to the coordinator node.

max_dist_gw_app_log

Some pics of  the test setup –

max_sonar_ffd_intf_pic

max_sonar_ffd_intf_pic_2

.

.

.

.

.

.

.

.

.

.

.

.

.

References:

Posted on February 16, 2015, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: