We would all love to have superpowers, but you probably don’t want to expose yourself to toxic chemicals or radiation in order to get them. Fortunately, there are some abilities that we can closely approximate with a little technology.

For example, Spider-Man has a “spider sense” that alerts him to nearby danger, and Daredevil’s “radar sense” lets him see nearby objects, even in the dark. Using an ultrasonic range sensor we can sense how far away objects are. This would let you navigate in the dark or detect when someone is sneaking up behind you.

View this project on Instructables: instructables.com/id/Ultrasonic-Spider-Sense/

Project Steps

Decide on How You Want the System to Alert You

The first thing that you need to decide is how the system will alert you to the oncoming danger. There are a lot of options to choose from. Here are a few examples:

Sound — you can use a small piezo buzzer to let you know how far away something is. Using the PWM output of the Arduino, you can change the pitch of the buzzer to indicate how far away something is. You can easily hide these buzzers somewhere in a coat. The disadvantage of a buzzer is that other people nearby may also hear the buzzer, so you may give away the fact that you know that they are coming.

LEDs — LEDs are probably the simplest kind of indicator that you can use. They are silent and discreet. They can be hidden in a number of places. For instance, you can hide LEDs under your sleeve. The fabric of a thin cotton shirt will let you see the LEDs when they are lit up but still cover them up when they are not turned on. The disadvantage of this system is that you need to be looking at them in order to notice the alert.

Vibration — you can have the output of the sensor activate a pager motor. The major advantages of this option are that it is almost silent and it doesn’t require you to be looking in any particular direction. It is also the option that is most similar to Spider-Man’s spider-sense which is described as a “tingling” feeling at the base of his skull.

You can also combine multiple kinds of alerts. For instance, you can have a buzzer alert you when someone first comes in range of the sensor. This could prompt you to look at an LED display to see exactly how far away they are.

Optional Output Driver Circuit

The digital pins on an Aduino can only output a maximum of 40 mA (It is recommended that you stay below 20 mA). Many output devices will require more than this to operate — for example, a pager motor can require between 50 mA and 200 mA. If you want to use higher powered output devices, you need to build some kind of external driver circuit.

Here is a simple example of a driver circuit. The power for this circuit can be supplied by the 5V pin. The 5V pin is directly connected to the voltage regulator that powers the board, so it can output a much higher current than the digital pins. Check the specifications of your board for an exact number.

First prototype everything on a breadboard. Then I soldered it onto perf board.

Connect the Ultrasonic Range Sensor to the Arduino

The ultrasonic sensor has four pins on it — GND, Vcc, NC, and SIG. GND connects to the GND pin on the Arduino. Vcc connects to the 5V pin on the Arduino. NC has no connection. SIG connects to a digital output pin on the Arudino. This ultrasonic sensor came with a short female to female connector cable. I added a second set of wires so that I mount the sensor further away from the Arudino board. To connect two female ends together, I used four short pieces of wire that were clipped from resistor leads.

If you are using an external driver circuit like the one described in the previous step. You will need to have two wires connected to the 5V pin on the Aduino board. In this case, you may consider connecting the driver circuit to the 5V pin on the Arduino and connect the Vcc wire on the sensor to the corresponding connection on the driver’s circuit board.

Sample Arduino Code

const int pingPin = 2;

int sensingRangeUnit = 11; int buzzerLimit = 100; int buzzerFrequency;

void setup() {

pinMode(3, OUTPUT); // sets the digital pin 3 as output for a buzzer pinMode(4, OUTPUT); // sets the digital pin 4 as output for an LED pinMode(5, OUTPUT); // sets the digital pin 5 as output for an LED pinMode(6, OUTPUT); // sets the digital pin 6 as output for an LED pinMode(7, OUTPUT); // sets the digital pin 7 as output for an LED pinMode(8, OUTPUT); // sets the digital pin 8 as output for an LED pinMode(9, OUTPUT); // sets the digital pin 9 as output for an LED pinMode(10, OUTPUT); // sets the digital pin 10 as output for an LED pinMode(11, OUTPUT); // sets the digital pin 11 as output for an LED pinMode(12, OUTPUT); // sets the digital pin 12 as output for an LED pinMode(13, OUTPUT); // sets the digital pin 13 as output for an LED Serial.begin(9600);


void loop() { long duration, inches, cm;

pinMode(pingPin, OUTPUT); digitalWrite(pingPin, LOW); delayMicroseconds(2); digitalWrite(pingPin, HIGH); delayMicroseconds(5); digitalWrite(pingPin, LOW);

pinMode(pingPin, INPUT); duration = pulseIn(pingPin, HIGH);

// convert the time into a distance inches = microsecondsToInches(duration); cm = microsecondsToCentimeters(duration); Serial.print(inches); Serial.print(“in, “); Serial.print(cm); Serial.print(“cm”); Serial.println();

if (inches < (sensingRangeUnit*1)) { digitalWrite(4, HIGH); } else { digitalWrite(4, LOW); }

if (inches < (sensingRangeUnit*2)) { digitalWrite(5, HIGH); } else { digitalWrite(5, LOW); }

if (inches < (sensingRangeUnit*3)) { digitalWrite(6, HIGH); } else { digitalWrite(6, LOW); }

if (inches < (sensingRangeUnit*4)) { digitalWrite(7, HIGH); } else { digitalWrite(7, LOW); }

if (inches < (sensingRangeUnit*5)) { digitalWrite(8, HIGH); } else { digitalWrite(8, LOW); }

if (inches < (sensingRangeUnit*6)) { digitalWrite(9, HIGH); } else { digitalWrite(9, LOW); }

if (inches < (sensingRangeUnit*7)) { digitalWrite(10, HIGH); } else { digitalWrite(10, LOW); }

if (inches < (sensingRangeUnit*8)) { digitalWrite(11, HIGH); } else { digitalWrite(11, LOW); }

if (inches < (sensingRangeUnit*9)) { digitalWrite(12, HIGH); } else { digitalWrite(12, LOW); }

if (inches < (sensingRangeUnit*10)) { digitalWrite(13, HIGH); } else { digitalWrite(13, LOW); }

if (inches < buzzerLimit) { buzzerFrequency = (((buzzerLimit – inches)*255)/buzzerLimit); analogWrite(3, buzzerFrequency); } else { analogWrite(3, 0); } delay(100); }

long microsecondsToInches(long microseconds) { // According to Parallax's datasheet))), there are // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per // second). This gives the distance travelled by the ping, outbound // and return, so we divide by 2 to get the distance of the obstacle. return microseconds / 74 / 2; }

long microsecondsToCentimeters(long microseconds) { // The speed of sound is 340 m/s or 29 microseconds per centimeter. // The ping travels out and back, so to find the distance of the // object we take half of the distance travelled. return microseconds / 29 / 2; }

Or, you can download it HERE

Mount the Arduino in an Insulated Project Housing

It is always best to have your Arduino board in some kind of a housing. This helps to protect the board and it helps to keep all the wires in place. To secure the board in place, you can tape one of more sides of the board to the wall the housing. Then, cut holes in the side of the housing for any wires.

Mount All of the Parts onto an Old Jacket

Now you need to attach the sensors, the alarms, and the arduino to an old jacket.

The Ultrasonic sensor can be attached to the side of a sleeve. This lets you easily move it around and point it in any direction that you want. The board for the sensor had three large mounting holes on it. These were convenient places to sew the board to the coat — just loop thread through each hole and through the sleeve to secure it in place.

A buzzer can be attached to the inside collar of the jacket or in a hood. Just sew it to the fabric at the mounting holes.

An LED strip can be positioned inside a sleeve of the jacket or in the sleeve of a shirt.

The Arduino and its housing can usually fit into one of the front pockets. You may need to cut a hole in the inside of the pocket to run the wires from the Arduino to the inside of the coat.

Run all of the wires through the inside of the jacket. To prevent the wires from getting tangled, you may want to sew the wires to the inside of the jacket at several points.

Use Your Ultrasonic Sensor to Detect Hidden Objects and Oncoming Danger

You can now use your sensor to detect objects in the dark or sense when someone is sneaking up behind you. Just point the ultrasonic sensor in any direction and monitor your chosen alert system. Point the sensor behind you and you will know when people are approaching, even without seeing them. Point the sensor in front of you to detect objects in the dark. It is just like having super powers … sort of.