This is my first arduino based instructable i hope you will like it:) I'm a big fan of the first Alien movie and the "old-sci-fi" gadgets, so I decided to make a fully operational portable motion-tracker. In this tutorial I will show you every step how I made it so you can make your own one. Plus at the end I will give you some advice according to my experiences so you can make an even better one. This was the first time I used a tft-lcd monitor and some faild attempt I was so happy when I realised how can I use it:)(Of course i will show you how can you use it properly)
I hope you are gonna enjoy this instructable and maybe some of you will make his/her own one. So let's start the making:)
Step 1: What You Need:
Materials and parts:
- Arduino Mega (because of the pins )
- 2.4" TFT display (I used one from mcufriend)
- 3 pcs PIR sensor (HC-SR501)
- 1pcs ultrasonic distance sensor (HC-SR04)
- 1pcs piezo buzzer
- 1pcs 100ohm resistor
- some male-male jumper cable
- many male-female jumper cable (for the display and the sensors)
- 1pcs 11*11 cm junction box
- 1pcs 15*11*7 cm junction box
- 1pcs toggle switch
- plastic sheet(I used some oddments)
- a few screw with the screw nuts
- 1 paif of bicycle handlebar grip
- warning tape (for the good looking )
- 1pcs 9v battery
- 1pcs 9v battery clip
- 1pcs Male Power Jack Plug 5.5 x 2.1mm
- 2.1*5.5 male plug
- some shrink tube
- electrical tape
- mini breadboard
- pvc tube
- paint spary (coloring the junction boxes)
- soldering iron
- rotary tool
- glue gun
- Jig saw
- Hole saw cutter
Step 2: The Circuit
The plan was a device what can sensing motion in three different way, so I needed three PIR motion sensors on the three different sides of the device. And an ultrasonic distance module on the front. For the sensors I used a part of the mini breadboard for the common 5V and common GND. And one of the 9V clip's cable soldered to the toggle switch so i can turn it ON/OFF. I soldered a 100Ohm resisitor to the piezo buzzer it protect the arduino board. I had to use an arduino MEGA because of the display it needs a lot of pins and an UNO doesn't have enough for the display and the sensors. Good to know the ultrasonic sensor maximum range is about 4 meter and the PIR motion sensor's maximum range is about 7 meter. But you can modify The PIR sensor's range and the delay time with 2 tiny potentiometer on the sensor. In the first picture you can see there is a lot of jumper wire so i mad a schematic picture with fritzing. It makes easier to connect correctly the sensors:)
Step 3: The Code
This part was a bit tricky, because when I tried to use the tft lcd screen always got a white screen. After some reading I realized it's not a rare problem if you use clone arduino board with not adafruit displays .I needed some hour to find the solution. (I find it in someone's instructable:) ). To save you some time you can download the modified libraries and the code what I used. After I learned how to avoid the whitescreen problem it was really fun to learn how to draw on the tft display. I'm sure i will do some other project with this type of displayshield. When I read about these sensors I noticed that they need some time to calibrate themself so to fill this time I write a "boot display" in the setup part. In the code you can check how to code a PIR sensor and the ultrasound module. I learned to use them from otherone's instructables and some great website:) I write a code that calculate the distance in cm so you need to rewrite it if you want to see it in inch. If you have any suggestion about to improve the code pls leave a comment:)
I put here 2 videos to show you the device in progress.
(Here the URLs so you can check it from phone too)
I tried to leave a comment for every important line or function, but if you have anny question about a code pls ask i will answer as soon as i can.
!IMPORTANT:This code is only working on arduino mega if you want to use it on an uno board you need to modify the SWTFT library uncomment uno_line and comment the mega_line!
(I want say a big thank you for these people who amended these libriaries)
Step 4: The Shell
For the shell of the device i used 2 junction boxes. The bigger one contains the arduino mega and the batteries. The other one contains the tft display. I painted the boxes with a paintspray. Good to know the plastic is becoming dry in a few hours, but on the rubber caps the paint can't be completly dry. It seems I shouldn't use this paint for rubber. After the painting I cutted 2 parts from an old unsed plastic sheet. With this 2 parts i fixed the 2 junction boxes with some screws and screw nuts. For the handle I used a piece of PVC tube. I cutted the surplusage. And I had to cut a line for the wires from the display and the distance module. I also cutted a rectangle shape hole on the top of the little junction boxe for the display. After the cutting with the jig saw I drilled the holes for the handle. Then i painted the parts. For the toggle switch i used the junction box's cutted part. After everything is dried i put the rubber caps back to their places.
Step 5: Assembling
The first step was the cabling. That was a bit meticulous work. Because there wasn't soo much place and i needed to put every jumper cable into the proper hole. After that i putted the buzzer and the left and right PIR sensor into the junction box, connect to the arduino. Good to know these sensors really sensitive so i had to overshadow them somehow. For that i used the rubber caps. I cutted a little hole on them as you see on the pictures. I fixed the sensors with some electric tape. I also used electric tape to fix the utrasonic module and the front PIR sensor. I cutted in half and vertical the bicycle grips for the handler. I don't like wasting so i used the unused grip part as a spacer for the display in the smaller junction box. I hided the orange edges of the display with some black electric tape. I glued one of the unused rubber cap to the bottom of the device so it can hide the end of the green pvc tube. For the good look i put some yellow/black warning tape on the device. Last step was to unplug the usb connector and plug the male power jack plug. Switch it ON and start Tracking motion:)
I bought the snesors and the arduino from ebay the other materials from local home improvement store. The final cost of the device is about 15-20 USD.
The final conclusion of the project is you can make literally everything what you want with the proper arduino board and some sensor and module. You can make a better looking shell if you have a 3D printer and your device could have a longer working time if you replace the 9v battery with a rechargeable or Lipo battery. And with a bigger display it looks better. Or if you use more distance mesure module you can mesure the distance in multiple way.
Now you now how to make a Motion Tracker if one of you make his/her own please leave a "I made it" comment and share with me the result. I would love to see your own gadgets.
Maybe this device will help you avoid Xenomorphs.
If you have any question please feel free asking me!