This system scans the horizon (with the sweep() command). At each angle of the sweep the proximity sensor finds the closest object and returns the distance.

The code then uses this distance and the current angle to find the relative location in cartesian coordinates (x,y). The relative coordinate system can be seen on the picture of the radar head. x = 0 is straight ahead, negative x is to the right, and positive x to the left. y is the distance forwards.

The x,y coordinates are then saved in an array of an array of dataPoints with structure below:

typedef struct {

int x;

int y;

} dataPoint;

After a full sweep, the system prints out the data using Serial or Buetooth serial. Using the commands below.

The printDataVisual (serial print) or printDataVisualBluetooth (serial print

over Bluetooth) commands print out the radar map.

A quick explanation of the map:

  • If multiple data points were collected for the same x,y coordinates ( there's limited resolution) then the map prints out a number representing the number of datapoints for that spot. E.g. if (10,10) is 3 then 3 data points were recorded for that spot.
  • The size of the radar map is constantly adjusted for the max and min x as well as max y, to reduce print time (the slowest aspect).
  • Before printing, the array of data points is sorted in ascending y order using bubble sort (could obviously be improved).
  • dashes represent the bounds of the map.
  • The dash down the middle is the center line a.k.a. x =0.


The system is connected to my computer using Bluetooth. I use a program called CoolTerm to connect to the device. I would advise creating a separate Arduino program that simply connects the Bluetooth to your device. Sample code below.

Once you have it connected, upload the code for the radar and begin the sweep by sending "sweep" over. Make sure you do not send \n (return command) or any other letters to begin the sweep.

//bluetooth commands

// D displays baisc settings

//$$$ to enter CMD mode, make sure to set to NEWLINE

//--- to exit CMD mode

//C,number to connect

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup() {










void loop() {