Wi-Fi Embedded Webcam

M. Kathiresan, A. Robson Benjamin and C. Vijayan

21736
Advertisement

The camera should be synchronised by issuing sync command until it acknowledges c328syn() routine, which is part of the IP.c file, as listed below. After taking pictures, suitable reset command is issued to camera module for taking fresh pictures. The Reset() routine is also included in the IP.c file for the same.

The sync command is sent as given below:
[stextbox id=”grey”]void c328syn(){
BYTE a[6],i;
char k[6];
s1:
do{
send(C328R_COMMAND_PREFIX);
send(C328R_COMMAND_SYNC);
send(0x00);
send(0x00);
send(0x00);
send(0x00);
DelayMs(10);
}[/stextbox]

Download source code: click here

785_table1 AE7_table-2

The camera uses ten commands as given in Table I. In the IP.c file you can find various routines for communication with camera including setup(), snap() and getpic(). Camera setup () routine is used for configuring camera for size of the image and light frequency etc. Snap () routine is used to take pictures and getpic () routine is used to retrieve pictures. Get() routine retrieves image data in packets and sends the packets through ENC, packet by packet, until all image data are sent. To display in HTML page we use ne_print () routine.

The list of main subroutines used in the IP.c source code is given in Table II.

Construction and testing
Actual-size, single-side PCB layout of the Wi-Fi embedded system is given in Fig. 8 and its component layout in Fig. 9.

Assemble the components on the PCB and connect power supply to the circuit. Before switching-on the circuit burn the hex code into the microcontroller. You need MPLAB IDE version 8.36.00.00 along with MCCC18 compiler v3.84 for compiling the code and burning the hex code into the microcontroller. Take care of the following:

1. PC should be connected to either wireless modem or wireless router with modem. Note that connection between the board and router should be wireless, but the connection between PC and the router should be non-wireless. Hence PC should be connected to Ethernet port of the router.
2. The modem or router should be configured as follows:
SSID=kathir, and security=none. If you want to change SSID name, change it in wf_config.h file and compile and program the microcontroller.
3. Camera should be connected to the board through RS232 cable.
4. When you switch-on the circuit, you will see default IP address as 169.254.1.1. Then it will switch over to a new IP address, say, 192.168.43.51, depending on your network. You can see this address on your LCD screen also. Since DHCP client is enabled, you get the correct IP address in LCD display.
5. On typing the 192.168.43.51 IP address in address bar of your web browser, a screen will appear with ‘ELECTRONICS FOR YOU’ on top as shown in Fig. 10.
6. If you click ‘switch-on’ button, you can see live video being captured by the camera on your PC screen.

Fig. 8: Actual-size, single-side PCB layout of the Wi-Fi embedded system
Fig. 8: Actual-size, single-side PCB layout of the Wi-Fi embedded system
Fig. 9: Component layout for the PCB
Fig. 9: Component layout for the PCB

Note that, since the processor speed is limited to 40 MHz, we cannot increase camera speed baud rate beyond 57600. Hence we cannot display a smooth live video. You can click ‘switch-off’ button to close the captured image.

Fig. 10: Main web page
Fig. 10: Main web page
Fig. 11: Captured video
Fig. 11: Captured video

Further applications
By careful PORT forwarding of wireless router to local IP address, appliances can be controlled through the webcam from any place in the world. Besides, by using high-speed ARM processors we can increase the camera’s baud rate and thereby display live pictures smoothly by using AJAX in webpage design.

Monitoring of parameters such as temperature, pressure, voltage and current can be done via the Internet from anywhere in the world by connecting suitable sensors to input port of the microcontroller. Since PIC18F4620 has limited memory space, this feature was not included in this article.


The author M. Kathiresan (M.Sc) was a sub-divisional engineer (retd) at mobile services of BSNL, A. Robson Benjamin (M.Sc, Ph.D) is associate professor of physics at American College, Madurai and C. Vijayan (M.Sc, M.Phil) is associate professor of physics at Vellaichamy Nadar College, Madurai

SHARE YOUR THOUGHTS & COMMENTS

Please enter your comment!
Please enter your name here