I made some radar projects using simple HC-SR-04 ultrasonic sensor. These are very basic ultrasonic sensor work on a carrier frequency of 40khz. There are 4 pins, 2 for the power and other two for the echo and trigger. But I want to use this sensor underwater motion and distance tracking system. That’s why an upgradation is required in this case. Here I got one a02yyuw ultrasonic sensor, this one can work with Arduino easily and the required voltage logic is also compatible.

But here I will design a PCB to use this sensor with seeed studio grove shield. We can put all the electronics like voltage regulator, Signal and power led with I/O pins on a 20x20mm PCB. Seeed studio is giving a chance to assemble your PCBs using fusion service in free. Just give an idea and complete your designs. Every approved design may win up to $300 cash and 2 free PCBA.

A02yyuw ultrasonic waterproof sensor:

Ultrasonic distance sensor determines the distance to a target by measuring time lapses between the sending and receiving of the ultrasonic pulse. This is an easy-to-use commercial-grade ultrasonic sensor module of high performance and reliability, featuring much smaller blind zone, wider sensing angle and a certain penetration power(smog, dust) compared with other similar sensor.

The ultrasonic sensor adopts closed separated probe, waterproof and dustproof, which could be well suitable for harsh and moist measuring environment. All the signal processing units are integrated inside the module, so users can directly obtain the distance value through Asynchronous Serial Interface. With 9600bit/s band rate, the sensor can easily communicate with upper-host or other MCU, which greatly shortens the developing cycle for users.

SPECIFICATION

This sensor is originally supplied by DFrobot or you can get one by using PCB fusion service provided by Seeedstudio.

Ignite Your Passion, Fire Your Thoughts:

In order to give back to our community and make your great ideas a reality, Seeed Fusion are launching the Grove Sensor Co-brand Campaign to help engineers turn their Grove designs into real products that the community can purchase.

If your design is selected by us and the designer is happy to license the product to Seeed for manufacture and sale, then we will produce your Grove Modules Design at Seeed Fusion and make it available via Seeed Bazaar. After providing specific software documentation and Getting Started instructions, the designers will receive the payment over $300USD directly from Seeed Fusion.

Getting excited? Keep reading to find out more.

Components required:

1) Arduino Nano/UNO

2) 16X2 LCD with 12C module

3) Custom PCB from Seeed Studio

4) A02yyuw ultrasonic sensor

5) External battery (9v)

Circuit diagram:

Because this sensor works on serial interface that’s why for the signal RX and TX Led's are embedded on the PCB. For power an external Led is there. This sensor works 3.3-5v, so you can find 5v regulator AMS1117 there.

Further connection are done with Arduino, you can mount this directly on Arduino with the grove connector and pin headers. Here VCC to 5v, GND to GND, RX to TX and TX to Rx. You can follow the above given schematics. Green wire is TX which goes to RX of Arduino and Blue is RX which goes to TX of Arduino.

My Grove sensor PCB:

I designed this PCB in Altium and exported the files as Gerber along with Bom and Pick and place file. After modifying the Bom as per requirements I uploaded all of these files to Seeed studio fusion. They are providing full SMT and PCBA assembly service in good price. Download all the required Gerber, BOM and CPL from here. You can see more details from here.

Arduino code:

// Include the Software Serial library
#include <SoftwareSerial.h>
#include <Wire.h> // Library for I2C communication
#include <LiquidCrystal_I2C.h> // Library for LCD

LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 16, 2); 

// Define connections to sensor
int pinRX = 10;
int pinTX = 11;

// Array to store incoming serial data
unsigned char data_buffer[4] = {0};

// Integer to store distance
int distance = 0;

// Variable to hold checksum
unsigned char CS;

// Object to represent software serial port
SoftwareSerial mySerial(pinRX, pinTX);

void setup() {
  // Set up serial monitor
  Serial.begin(115200);
  // Set up software serial port
  mySerial.begin(9600);
  Wire.begin();
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("A02YYUW Test");
  lcd.setCursor(0,1);
  lcd.print("Please wait...");
  delay(1000);
  lcd.clear();
}

void loop() {

  // Run if data available
  if (mySerial.available() > 0) {

    delay(4);

    // Check for packet header character 0xff
    if (mySerial.read() == 0xff) {
      // Insert header into array
      data_buffer[0] = 0xff;
      // Read remaining 3 characters of data and insert into array
      for (int i = 1; i < 4; i++) {
        data_buffer[i] = mySerial.read();
      }

      //Compute checksum
      CS = data_buffer[0] + data_buffer[1] + data_buffer[2];
      // If checksum is valid compose distance from data
      if (data_buffer[3] == CS) {
        distance = (data_buffer[1] << 8) + data_buffer[2];
        // Print to serial monitor
        Serial.print("distance: ");
        Serial.print(distance);
        Serial.println(" mm");
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print("Distance:");
        lcd.setCursor(10, 0);
        lcd.print(distance);
        
      }
    }
  }
}

Required libraries:

No external sensor library is required just install the compatible screen and software serial library from the library manager section under the tool menu. Here I am using Liquidcrystal_12c to run this 16X2 lcd screen.

Working and testing:

Firstly I tested the sensor in Air and check the readings of different objects. It works very well and much accurate than other ultrasonic sensor available in market.

Then I put the sensor in the water, it is IP67 rated, there is no chance of damaging. I took many readings inside water. Readings are very accurate in water. This sensor is very useful in making under water motion, distance monitoring project. A very thanks to Fusion and seeed studio team for providing me such a great SMT service.