How Can We Help?

Radar Function using Ultrasonic

You are here:
< All Topics

for addition object detection a simple function can be added using widely available SR04 Ultrasonic with PWM output to interrupt the vehicle at a set distance , this uses the SR04 Ultrasonic with ideal range of 2m and max 5m but because ultrasonic has a wider sensor arc its resolution is arbitrary at best and mainly use as low cost obstacle trigger detection.

Updater Radar scope design only refresh after re-scan

Setting up the Bluetooth telemetry

Bluetooth setup with the USB TTL and Arduino IDE

Arduino IDE>Tools>Serial Monitor  (hold the Button while Plugging the USB) to go programming mode Set (Baud 38400) (Both NL & CR)

Hold Press when sending AT command (Version 5)

AT : check the connection

AT+VERSION : Check Version

HC-05 (Recommended)

AT+NAME=Change name    (Synerduino)

AT+PSWD=1234 (Version 2)

AT+PSWD=“1234” (Version 3) (Possibly works on Version 5)

AT+UART=57600,1,0 (for synerduino Radar)

Read Application Baud

available in Linux and Windows 32 and 64

Application 57600 – Baud 57600 Forward Servo
Application 57600 – Baud 57600 ReverseServo
Application 115200 – Baud 115200 Forward Servo
Application 115200 – Baud 115200 Reverse Servo

Read Arduino Sketch

5 Meter range us100 Y401 sonar (Aug 22 2023 update distance of sonar to 5 meters Note: sensitivity or acurracy may Vari )
2 trigger servo range

Inorder for this to work Bluetooth radio must be set to a on Communication serial on any device to baud 57600
Radar_F and Radar_R are servo reverse option

in the application folder look for the Data file>Data Folder>

COM11 //Serial COM Port your bluetooth telemetry is on (change this to the comport your Raday Bluetooth/Radio is on)
SynerFlight Radar //Title of the Radar

Arduino Sketch> Radar_Arduino_sketch-5m5.ino

Sonar
const int trigPin = D2;
const int echoPin = D3;

input trigger distance
int inputdistance = 120; // set Distance to trigger the PWM Aux Switch in cm (change this to adjust trigger distance)Stop
int inputdistance1 = 120; // set Distance to trigger the PWM Aux Switch in cm (change this to adjust trigger distance)Steer
int inputdistance2 = 110; // set Distance to trigger the PWM Aux Switch in cm (change this to adjust trigger distance)Reverse

myServo.attach(4); // Defines on which pin is the Radar servo motor attached this is where the sonar is mounted to

Defines on which pin is the Aux trigger input is attached this is connected to the Shield Aux 14 or A 15 PWM input for synerduino Arduino
myServoA.attach(5); // Defines Trigger
myServoC.attach(6); // Defines Trigger
myServoC.attach(7); // Defines Trigger

Pin for LED indicator or trigger ADC V, I, RSSI for Synerduino STM
pinMode( 13 , OUTPUT); // LED indicator
pinMode( 12 , OUTPUT); // LED indicator
pinMode( 11 , OUTPUT); // LED indicator
or you can change the sketch input on

synerflight_radar8.pde>

Download Ultrasonic Radar Application

Note: is available in EXE and PDE formats – to use PDE format download the Processing Application form Processing.org

Note: the application has its corresponding baud as application name and in the application folder contains a data folder > data.txt COM20 change this to suit your comport your devices is assign to

Firmware Hex file and Hex uploader

supports 328P boards Nano and Promini

Arduino/Processing.org sketch notes

change this value to change distance trigger

/set Distance to trigger the PWM Aux Switch in cm/ eg: 100cm
int inputdistance = 100; // set Distance to trigger the PWM Aux Switch in cm (change this to adjust trigger distance)

Table of Contents