In this post I’ll explain how to build your own IP camera software that makes our IP camera a “smart” camera.
We’ll make camera control software that:
- Monitors the signal coming from the PIR sensor
- Snaps pictures with the webcams when motion is detected
- Stores pictures both locally and on-line
I’m using ANSI C to develop this code. The nice thing about coding in ANSI C on an embedded device is that the executable will be very small. So we won’t take up much space on the precious 8mb of flash. Additionally, since linux was written in C we can make use of a lot of the tools and libraries that are part of linux to do some heavy lifting for us. Things such as having a permanent process/service running (daemon) and controlling it or things such as logging are good examples of things that standard linux functions do well.
The structure of the code is as follows. We have the basic logic of the program in two files motion-detect.h and motion-detect.c. The .h file is mostly used for the declarative side of the program naming variables and functions. The .c file is used hold the program logic.
On the next page I’ll explain the main functions of the program…