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.
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.
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.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
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.
Some pics of  the test setup –
.
.
.
.
.
.
.
.
.
.
.
.
.
References:
Posted on February 16, 2015, in Uncategorized. Bookmark the permalink. Leave a comment.
Leave a comment
Comments 0