I used to turn off all electrical appliances when I was leaving for several days. However, very often I want to know if everything is in order at home: whether it has burned, collapsed, or was robbed. Alas, I was not able to find a completely autonomous device on the market that could monitor the room and send photos to the owner. I had to make such a gedget with my own hands.
I had no experience in working with microelectronics, so I first had to learn the basics of this science. I was warmed by the thought that I would assemble a unique device that no one else had done. I would like to propose what has happened after five months of work today to your judgment.
Principle of operation
The camera is quite simple. She sleeps most of the time. Once an hour, it wakes up, registers in the GSM network, connects to the POP3 server and checks if there are any new letters. If there are new letters, then the device turns on the camera, saves the image in JPEG to the SD card, connects to the SMTP server and sends the image to the specified address. After that - sleep. ')
The device configuration is in the settings file on the SD card. As a cellular operator, I had to use AT & T.
Assembly process
The first step was the selection of components. I decided to follow the path of least resistance and stopped at the following parts:
ATmega 328P with Arduino on board. There are a lot of libraries, code samples, etc. for this controller. I decided to work with a frequency of 16Mhz.
LinkSprite JPEG Camera . This is a very easy-to-use camera: it takes a 640x480 image and compresses it in JPEG. The device supports the usual serial protocol.
GSM modem MTSMC-G2-IP . This GSM modem bribed me with built-in support for POP3 and SMTP. Otherwise, it is not much different from its competitors.
MicroSD card for storing information.
Any infrastructural trifle: 74HC4052 to manage a conversation with different devices, several voltage regulators and an excellent switch TPS2020 .
The most difficult was to make the circuit consume as little electricity as possible during sleep. The power of each component is controlled by the TPS2020. Thus, only ATmega works. The example of Nightingale helped me a lot. As a result, my circuit consumes 0.14mA during sleep. This means that the device can work for up to a month without changing the batteries (I used CR123A batteries, mainly because of their size).
Is the theory developed? Let's build a prototype. First, we will prove to ourselves that everything works as we expect, and secondly, we will feel like kulkhackers.
Looks great. The next step is to write and debug the code. Programming for the ATmega 328P is as easy as for any Arduino. I configured my Eclipse to work with this chip and the AVRISP mkII programmer . The AVR Eclipse Plugin came in very handy: the project’s build and firmware were made with a couple of mouse clicks.
The controller code was developed within two to three months. The latest version of the code can be found at code.google.com . I never would have thought that 12Kb is a lot of memory, and 16Mhz is very fast.
When the code was more or less stable, and the table was completely overwhelmed with a prototype, it was time to solder everything together. I decided to use the Arduino format: it was too easy to find cheap components. This is what happened:
It is time to start the last part - the body. Alas, DIY projects do not always have an attractive shell. So I decided to use the three-dimensional printing service and do exactly what I want.
I did not like the 3D modeling programs. Somehow it is unnatural - to drive in a three-dimensional space with a two-dimensional mouse. Fortunately, I found OpenSCAD , a free program where models are set in a simple script language. For example, a sphere with a radius of 5 is a sphere(r=5) . Beauty.
Caliper, several weeks of modeling, an order for Ponoko and here's the result:
The model was printed with amazing accuracy: the parts came together without any modifications. Model source code can be found at code.google.com .
Camera assembly. Here's what happened:
Here is a video demonstrating camera performance and picture quality:
Conclusion
Now I can be calm about the house: the camera will keep a close eye on it. Batteries should be enough for about a month, if mail is checked once an hour.