Introduction: Behind You! Anti Creeper Alert System

If you've ever been wearing headphones and had someone come up behind you, you know how scary it can be. Well, if you'd like to live a life without fear, I have the perfect project for you! Stay tuned for a video of this demo in action!

This project uses LabVIEW, LabVIEW MakerHub LINX, a chipKIT WF32, a motor, a PmodHB5 (h-bridge), and the PmodMAXSONAR (ultrasonic range finder) in order to alert you if someone is 2 feet or closer behind you. When they reach 2 feet, a motor connected to an object (in this case an awe-inspiring MakerHub flag) will begin to spin and the object will tap against your shoulder or arm.

This project can be completed with the LabVIEW Home Bundle which is a specially licensed version of LabVIEW 2014 SP1. Digilent also sells the LabVIEW Physical Computing Kit which includes LabVIEW Home Bundle and the chipKIT WF32.

Step 1: Materials

Picture of Materials

1) LabVIEW

2) LabVIEW MakerHub LINX

3) chipKIT WF32

4) A motor

5) PmodHB5

6) PmodMAXSONAR

7) 4x AA batteries

8) Wires!

9) Velcro or other adhesive to connect your electronics to your chair.

Step 2: Wiring and Jumper Settings Part 1

Picture of Wiring and Jumper Settings Part 1

First, since we're going to power the chipKIT WF32 with batteries, we need to move the jumper pictured above to the EXT position.

Next, we'll set up the PmodMAXSONAR. The PmodMAXSONAR has 6 connections. The first pin is an analog reading, the second and third are the TX and RX connections for UART connection (the used method), the fourth pin is for reading PWM values from the Pmod and converting those to distances. Pin 5 is ground and pin 6 is Vcc = 3.3V. Since we're using UART communication for the Pmod, we need to connect pins 2, 3, 5, and 6. Pin 2 connects to digital channel 40 on the WF32 and pin 3 connects to digital channel 39 on the WF32. These two channels correspond to UART1 on the WF32 (UART0 is used for connection to LabVIEW). Also connect ground and 3.3V to the corresponding pins on the Pmod.

Step 3: Wiring and Jumper Settings Part 2

Picture of Wiring and Jumper Settings Part 2

Now we'll connect PmodHB5. Pin 1 determines the direction of the motor so connect this to digital channel 26 on the WF32. Pin 2 is the PWM pin so connect this to pin 3 on the WF32 (PWM pin). Pins 3 and 4 on the PmodHB5 are sensors that we can ignore. Connect pin 5 to ground and pin 6 to 3.3V. Now connect the PmodHB5 to the motor via the connector like it is pictured above.

Now all we need to do is wire power to the board and the PmodHB5 screw terminals to power the motor. Connect the power from the 4 AA batteries to the positive terminal on the PmodHB5 and connect the ground from the 4 AA batteries to the negative terminal on the PmodHB5. From there, connect a wire from the positive screw terminal to the positive lead on the chipKIT WF32 J14 external power supply input and connect a ground wire to the ground lead on the WF32 J14 external power supply input.

Step 4: LabVIEW Setup and Downloads

In this project I'm using the built in WiFi on the chipKIT WF32. Here is a list of the supported devices for LabVIEW MakerHub LINX (LINX). LINX allows you to interface with your microcontroller using LabVIEW. To get started with a microcontroller and LINX, check out this Instructable.

If you're using a chipKIT WF32, the Instructable above also contains information about how to set up the WiFi connection. Once your microcontroller is using WiFi, download the zip file linked below.

This zip file contains the main VI as well as the three subVIs for the PmodMAXSONAR. There is an open VI, a read VI, and a close VI. Extract the zip file to somewhere on your computer. When opening the main VI called "PmodMAXSONAR_Demo", LabVIEW will prompt you to find the three subVIs. Just browse to where you extracted the zip file and select the appropriate subVI.

Step 5: LabVIEW Code

Picture of LabVIEW Code

Now that the VI knows where all the subVIs are, open the front panel so you can change a few of the settings. Under TCP Configuration, use the IP Address and Port you wrote to your board when uploading the WiFi firmware. For DO Channel, select the channel that connects to pin 1 on the PmodHB5 which is 26 in this case. For the UART Channel, select UART channel 1.

Click Run (or control + r) to run the VI. You'll notice the distance reading in the indicator on the front panel. When you're done, click the stop button.

This VI reads the distance from the PmodMAXSONAR and once the distance is less than 24 inches, the motor is turned on by writing a PWM value of 1 to the PmodHB5 which then provides full power to the motor from the batteries.

That's it! You can now listen to your music completely relaxed knowing no one can sneak up on you. Try using these subVIs for other projects using the PmodMAXSONAR.

Comments

About This Instructable

999views

10favorites

License:

Bio: Software Engineer at Digilent Inc.
More by Sudharsan Sukumar:Raspberry Pi Rainbow RulerGetting Started With the Raspberry Pi 2 (LabVIEW)LabVIEW Tutorial: Game Discounts
Add instructable to: