RPi CCTV in Action :
A simple web interface to control the RPi CCTV :
What you need to build this (hardware) :
- Raspberry Pi (preferably raspberry pi-3, for on-board wireless, or raspberry pi zero w, although you can achieve similar result without much effort using other boards)
- Pan & Tilt frame, I used one available here on amazon – https://www.amazon.in/gp/product/B010M25JVU/
- 2 servo motors. I used sg90 micro servo motors since I had them handy, however you can also use other similar ones available
I have recently started liking GoLang quite a bit, so I decided to try to make use of it for a small IOT project that I’ve been meaning to do for a long time. In my search I came across Gobot, which is a framework for building robots written in golang. It comes with support for a lot of development boards available in the market such as Raspberry Pi, Beaglebone, Arduino, and several more. Not only that it also has drivers available for a wide variety of devices which can be used to create all sorts of nifty robots.
Here is the repository with all the source code : https://github.com/dhruvasagar/rpicctv
NOTE : In order to generate PWM (Pulse Width Modulation) signals while using Gobot, you will need to install https://github.com/sarfata/pi-blaster. This was required in my project since servo motors are controlled using PWM signals.
The best thing about Gobot is that with very little code I was able to expose the entire hardware (the 2 servo motors) via a JSON API. This meant that I could easily create user interfaces for the web / mobile and by consuming the API I could control my CCTV camera remotely over wifi!