Step 1: Remotely Controlled VGA Camera – Circuit Diagram
Let’s start from designing schematics. As an electronic design automation tool called gEDA is chosen (http://www.geda-project.org). Despite its enormous popularity Eagle system was eventually rejected as the dimensions of main PCB are not covered by Eagle’s free license and the cost of license of substantial. At the same time, gEDA has enough capabilities to allow us design this project.
Two circuit diagrams need to be designed – one for main module and one for GSM transport module.
Step 2: Remotely Controlled VGA Camera – PCB design
Using PCB tool (http://pcb.geda-project.org) design PCB layouts for both boards. We route them manually to achieve best possible results and taking into account technological capabilities of a PCB manufacturer. An inexpensive Chinese fabrication house Pcbart has been picked up, its capabilities for ‘standard PCBs’ might be found at http://www.pcbcart.com/cart.php?page=capability___standard_pcb. To bring overall cost down we design two layer boards.
After submitting Gerber files for both PCBs in two weeks our boards are finally delivered. At the same time ordering electronic components in accordance with BOM files so that upon PCBs arrival we will be able to start soldering straight away.
Step 3: Remotely Controlled VGA Camera – Soldering
Not just saying that soldering of those small SMD components is possible, it is actually easy. It is fun. The most difficult component to be soldered is ATMega1280. But all we need to accomplish our mission is:
– A clamp tool with magnifier (available at http://cpc.farnell.com/duratool/d00269/clamp-tool-with-magnifier/dp/TL10478),
– A soldering station. We used old Duratech TS1560 and were pretty happy with the results,
– Soldering paste in syringe packaging (we used SMD291SNL available at http://www.digikey.com/product-detail/en/SMD291SNL/SMD291SNL-ND/1160001?cur=USD
That is it. That is all we need. Believe us, you can do it.
When soldering is completed, clean your PCBs and do visual check. If it is all good, time to flash bootloader.
Step 4: Remotely Controlled VGA Camera – Flashing Bootloader
A bootloader is a compact executable code often flashed in upper program memory area implementing basic transfer protocol and facilitating self-programming function, making possible firmware updates without need to have an external programmer.
Next we need an ISP programmer, let’s take as an example USBtinyISP AVR ISP Atmel Programmer (for example, this one: http://www.ladyada.net/make/usbtinyisp). It costs around $15USD, supplied with two flat cables (for 10 and 6 pin connectors) and is capable of providing a flashing board with +5V. Download USB drivers required for the programmer, they are available at http://blog.arduino.cn/wp-content/uploads/2009/05/usbtinyisp-w32-driver-v112.zip. Connect the programmer to a PC over a USB cable, Windows should report about newly found device and will ask for drivers. Unzip and install just downloaded archive. Now in Device Manager a new device called USBtinyISP AVR Programmer should appear in LibUSB-Win32 Devices group.
Donwload and install WinAVR from http://winavr.sourceforge.net. Open Command Prompt and type ‘avrdude’ – you should get list of options as a result.
Connect main module and the programmer with 10-wire flat cable but before make sure that programmer’s ‘PWR’ jumper is closed – in this case the module will be powered by USBtiny.
Donwload latest firmware from http://sourceforge.net/projects/defendline2/files/latest/download. Already compiled bootloader could be found at CPP\BootLoader\ATmegaBOOT_168_atmega1280.hex. Now it could be flashed to the board, type the following line in Command Prompt:
avrdude -p m1280 -c usbtiny -U flash:w:ATmegaBOOT_168_atmega1280.hex
When programming is done, set FUSE bits with the follwoing consecutive commands:
avrdude -p m1280 -c usbtiny -U hfuse:w:0x98:m
avrdude -p m1280 -c usbtiny -U lfuse:w:0xD7:m
avrdude -p m1280 -c usbtiny -U efuse:w:0xFF:m
Disconnect USBtiny from your PC and main module. Now the main module may be programmed without USBtiny.
Step 5: Remotely Controlled VGA Camera – Flashing Firmware
Connect the main module to external power supply and to PC via USB, Windows should report about newly found virtual COM port and will install the drivers automatically. Alternatively, VCP drivers could be downloaded from http://www.ftdichip.com/Drivers/VCP.htm and installed manually. When it is done, in Device Manager a new device called USB Serial Port should appear in Ports (COM&LPT) group.
To activate bootloader hold SB1 button while the module is being powered up and until red LED starts blinking. Without releasing SB1 enter the following command (substitute ‘com4’ with appropriate COM port):
avrdude -p m1280 -c avrisp -P com4 -b 57600 -U flash:w:DefendLineII.hex
Note, that this time we use ‘avrisp’programmer type and explicitly defined COM port and baud rate.
When the flashing process is completed the module automatically restarts and it is ready for configuration process.
Step 6: Remotely Controlled VGA Camera – Server Side
Server-side application is implemented as a set of PHP scripts using MySQL database as data storage. If you want your scripts to be easy accessible from GSM network it would be very reasonable to install them at a host provided by a webhoster. The following applications should be available on a hosting site: PHP5, PHPMyAdmin, MySQL.
Using create_struct.sql from the archive attached here, create a new DB structure by means of PHPMyAdmin. Grant full privileges to a DB user that will be used to access the database.
Copy the whole structure PHP/dl/*.* to your remote host. Make sure that *.php files have permissions for execution and upload and mixed folders have write permissions.
Now a few modifications in /dl/include/config.inc.php must be done. Redefine db_user and db_pass by filling them with database credentials. Fill web_user_MD5 and web_pwd_MD5 with MD5 sums, calculated for web username and web password appropriately.
You should be able to login to access DefendLine data http://yourhost/dl/dlRep.php. There should be an empty list.
Imitate some data submitted by a remote security system. Open the following link: http://localhost/dl/dlLog.html, fill the fields appeared then submit the form. Check http://localhost/dl/dlRep.php again. There should be one record. Setting up procedure complete.
The picture attached shows our web interface with some pictures uploaded.
For more detail: Remotely Controlled VGA Camera – Overview