£80 Wide angle + Night Vision Security camera

£80 Wide angle + Night Vision Security camera

thingiverse

<h1>This project has been iterated to a new version, please check my profile for the Mk4</h1> Big 'ole disclaimer: If you do not have experience working with electricity before, be aware that in this project I'll be repurposing a laptop charger, just make sure you're comfortable with that, or find another way to power the project. The aim of this project was to create a robust, cost-effective security camera based on the Raspberry Pi Zero 2W. At current prices, I was able to make this for £80 - minus printing costs -HARDWARE- Parts used: 2 x Pi Zero 2W: (£17/£15) https://thepihut.com/products/raspberry-pi-zero-2 https://thepihut.com/products/raspberry-pi-zero-w 2 x Micro SD card (16GB will be fine) (£5) https://www.ebay.co.uk/itm/264783161833 1 x ZeroCam Fisheye: (£15) https://thepihut.com/products/zerocam-fisheye-camera-for-raspberry-pi-zero 1 x eBay special IR sensor: (£14) https://www.ebay.co.uk/itm/354891749089 1 x Pack of assorted 2.5 standoffs + screws (8 x 15mm, 4 x 10mm, 2 x nuts, 4 x m2.5 screws) 2 x Heatsinks: (£1) https://thepihut.com/products/heatsink-for-raspberry-pi-zero-2 2 x USB 6v-40v 5A 5V power supply: https://kunkune.co.uk/shop/power-converter-modules/dual-usb-dc-dc-6v-40v-to-5v-3a-double-usb-charge-step-down-converter-module/ 1 x Laptop Charger / power supply / something which can push 5V 3A per Pi I used an old Lenovo Laptop charger, so this cost me nothing, but used 60w laptop chargers or something of the like will be fine. 2 x Micro USB cables (some short angled ones preferrably, if you don't have them, they're dirt cheap) Now that you have the hardware sorted, it's time to assemble it all. Print out the inner enclosures (innerpienclosure & innerpienclosure upper) once those have printed out, start printing off the lid and main case. Whilst those are printing, sand down the inner frames so you haven't got any stringing or zits. Once that's done, make sure the screw holes are unimpeded by any support material if you have used supports (I didn't need to) Add the heatsinks to the Pi's, and plug in the CSI cable from the wide angle lens into the bottom Pi. Screw in the screws into the bottom of the frame that has the square-circle cut-out, then put the wide angle lens in through the hole, and add a little super glue just to keep it in place, but it should be a tight-ish fit. Once that's done, screw the 15mm standoffs onto each corner, and place the next Pi on top, repeat the same process. Then unscrew the lens from the night vision sensor, and push the assembly through the hole in the frame, then screw the lens back in. Be extra careful to not damage the exposed sensor during this process, and if you find yourself straining to fit it in the hole, stop, and sand it down. The acrylic frame that I have behind the sensor is unnecessary, and I'm only using it because I had it laying around, it will hold without it. Once the camera is securely in place in the frame, push it onto the standoffs, and secure it with nuts. Next, plug the CSI cable into the second Pi. Once that's done, you're pretty much done from a hardware perspective. -SOFTWARE- I'm going to be using a computer that has a docker instance of MotionEye on it, it's got a cheap 2tb HDD attached to it, so it should be able to record a few days footage at a time at full resolution. On the Pi itself, I'm going to be using a great tool called Cam2Web (https://github.com/cvsandbox/cam2web), as it is super easy to configure, and then just a standard install of Raspbian (latest will work). So flash your SD cards with raspbian, during the imaging process, if you're using the official tool, start SSH, and add your wireless network. If you're not using the Raspi imager, then have a mini-hdmi and some dongles to hand. When you've powered the Pi up, and done the usual setup, open a terminal and do: git clone https://github.com/cvsandbox/cam2web sudo raspi-config When in this menu, enable the legacy camera stack under "Interfaces", also enable I2C as I've had some compatibility issues when this was disabled. Reboot your Pi after. At this stage, with the camera plugged in, hopefully you can see some sign of life from one of the LEDs, if not, check your cables, they can be tricky, make sure they're the right orientation. If you cannot see any life, you might have a defective unit. In a terminal run the command vcgencmd get_camera Your output should indicate that you have a detected and supported camera Once you've verified your camera is working, go ahead and compile Cam2Web, I learned that I am a complete idiot, as I compiled it on my main linux machine and just completely forgot that they're different CPU architectures -dumbass alert- I would recommend compiling it on a more powerful ARM chip, as I had some issues with gcc on the Pi Zero, so, I used my Pi 3a+ to do it instead. If you're having issues compiling this, I may upload compiled binaries at some point, as this project is no longer maintained by the looks of things. Once compiled, run: chmod +x cam2web ./cam2web You should see that it is now streaming on port 8000, verify this by checking in a browser. You can find your Pi's IP by typing "ifconfig" in terminal. You can also see all of cam2web's options by doing ./cam2web -? for instance I'm using: ./cam2web -size:7 -fps:20 This tells the binary to stream at 1080p 20fps Hopefully you now have a semi-working camera! Now to get it running at startup there's many different methods, I'm just going to be modifying the rc.local file. To do this in console type: sudo nano /etc/rc.local Before the script ends, you want to add the line: cd {path to your compiled binary} ./cam2web {any flags you want to run} Is this the best way to do this? Probably not, do I care? Not particularly, it works and that's what matters. If you want to make any suggestions, please feel free, or alternately make your own version! Next, you're going to want to set up a static IP address for the pi, so that motioneye knows where it's requesting to. Go ahead and edit the DHCPCD.conf file in /etc, and un-comment the static ip address configuration, whilst supplying your own information in. I would recommend using the current IP that your pi has been given, as you know it's free. You can find out this information, as well as your routers IP by typing "ifconfig" into a console. That's everything done on the pi side of things now! Just reboot [sudo reboot] and check that everything is working as it should be. Now you're going to want to set up some NVR software, as I said before, I'm using motioneye, as it's free and does everything I need it to. https://github.com/motioneye-project/motioneye/wiki/Install-in-Docker I have this running on an Ubuntu thin-client PC which sits away and just does this 24/7. -FINAL STEPS AND ASSEMBLY- Ok, now you should have your pi working outside of the case. Go ahead and sand down the external case, I'd recommend using some 180 grit sandpaper to do this. Make sure to get in the holes for the lenses and IR sensors, as I've found that these areas in particular are prone to stringing. -SIDE QUEST: Painting & Finishes- Once it's all sanded down, I'd recommend using some automotive body filler, this stuff is great as it leaves a smooth finish that you can paint easily. After that, sand it down and leave it for a few hours, you can generally tell if its set because just naturally it will feel smooth to the touch, sanding it again with some fine sandpaper before applying filler primer, and then finally spray paint of your choice. -SIDE QUEST COMPLETE- Back to the assembly. I've only left a small hole at the rear for cable entry, I'm using 1.5mm CSA flex cable, although really you should be using HI-Tuff or something else which is actually rated to be outside permanently. Drill out the hole to the required size for your cable to fit snugly inside, but, don't glue it in yet as we need to sort out the mounting first. For mounting, I've left out any holes on the file, however, if this is something you'd like to see, let me know and I'll make some versions with the holes pre-made. This is so that you can adapt it to how you see fit. My mounting holes needed to be on the left, so I marked up the holes from this: [https://www.thingiverse.com/thing:67911] and then secured it to the case using some M4 nuts and bolts. Now that mounting and the cable are sorted, we can install the inner workings of the camera into the external case! Make sure you're happy with how it looks first because it will be a right pain to change after. Pull the cable through into the hole, until enough is showing where you can strip the ends, I'm using WAGO 221 connectors because I have literally hundreds laying around, but any other kind of connector block will work (or you can solder them, but please try isolate them somehow) Connect the positive to the connector, and then put in two wires, each going to the +5v on each PSU, I would recommend tinning these cables, since it's going outside, and this should hopefully prevent some corrosion [I may be entirely wrong, this is just what I was taught when I was training to be an electrician]. Repeat the process for the GND. Once all your power is sorted, move the PSU's out of the way, and place your internals inside the case, do yourself a favour and make sure the micro-usb cables are plugged in, because there's no way in hell you're fitting your fingers in there to plug them in. Carefully push the front-facing components through the holes, if you feel an undue amount of resistance, stop, and sand it down. I've gone through like 5 prototype cases now, and I'm confident I've got the tolerances down to a tee, they didn't need sanding for me, but, due to variances in how every printer is set up differently, I wouldn't be surprised if that 0.01mm made a difference. Now that all the front-facing components are inside, make sure to seal up the gaps between the IR-photodiode, and the emitter, I used hot-glue, and then just spray painted it (make sure to use masking tape to cover the lenses if you also decide to do this!) With everything in place, you're ready to put the lid on (which is designed to be a tight fit, but does go on without sanding) and then once you've mounted the socket for the ball to go into, you can get it mounted up! On the other side of the flex cable, you're going to want to figure out which cable is your +VDC and which one is GND, for most laptop cables there is a sensing wire which is designed to check how the battery is charging, I'm not going to attempt to explain how to get those to work, as I tried, searched around for answers, and couldn't find any. So, after much cannibalisation of my 3 spare laptop chargers, the final one was a Lenovo Yellow-tipped plug design, which only has +VDC as the inner core and GND as the shield. [THIS MIGHT NOT BE STANDARD] After that, I connected the +VDC to the brown of the flex, and the GND to blue, then the cameras powered up! I checked motioneye, and sure enough, the feeds were up, after some tweaking of the rotation settings, it's now working perfectly. -FINAL THOUGHTS- I hope that you're able to make this project without any hitches, in terms of thing's I'd/likely will do differently in the future, I'll probably design a better looking case, but this is functional, and easy to print. I'll also explore using ASA as a filament next time as that could be better in the sun than PETG. Also, Arducam make a multi-input board for the pi-zero, so maybe I could utilise that at some point to get rid of one Pi from the build, but at current prices, it was cheaper for me to just buy another pi-zero, and then also not have to worry about the added challenges that that would have in terms of getting two independent streams from what is supposedly one video device, anyway, that's an issue for another day. Please feel free to leave a comment if you have any thoughts or suggestions, and my programming ability is that I can download other peoples code off of GitHub for my own projects, I'm by no means qualified at all, so any ways to do this better would be appreciated!

Download Model from thingiverse

With this file you will be able to print £80 Wide angle + Night Vision Security camera with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on £80 Wide angle + Night Vision Security camera.