Home
LAMPIRAN A Program pada arduino uno
Contents
1. 0 return retval retval camera initial SDCameraC328R CT JPEG SDCameraC328R PR_80x60 SDCameraC328R JR_640x480 if retval 0 blink retval Set kamera ColorType PreviewResolution JPEGResolution Jika Error tandai dengan kedipan LED retval camera setPackageSize 100 if retval 0 return retval retval camera setLightFrequency SDCameraC328R FT_50Hz if retval 0 return retval delay 2000 return retval LAMPIRAN B Data Sheet Camera C328 oooco oco W Woo coco Wo WoW0WoWom0W0mom m Data Sheet Sensor PIR oooooooooo Wo W Wc ooWo W co Wc W W W0m mmm C328 7640 gt COMedia Ltd JPEG Camera Module HAHBAMA 3 W UART Interface General Description The C328 7640 is VGA camera module performs as a JPEG compressed still camera and can be attached to a wireless or PDA host Users can send out a snapshot command from the host in order to capture a full resolution single frame still picture The picture is then compressed by the JPEG engine and transferred to the host thru serial port Block Diagram Amigos VCC VGA GND Image JPEG TxD Sensor Compression RxD Engine EEPROM program Features Small in size 20x28mm VGA resolution down sample to QVGA or CIF 3 3V operation Low power consumption 60mA User friendly commands to control the module UART interface of up to 115 2Kbps Auto detect baud rate and make connection to the
2. 512 bytes size AA 06 08 00 02 00 ACK AA OE 06 xx 00 00 Get Picture JPEG preview picture AA 04 05 00 00 00 ACK AA OE 04 xx 00 00 Data JPEG preview picture ACK package ID A ed 0000h AA OE 00 00 00 00 Image Data Package ACK package ID 0001h AA OE 00 00 Image Data Package The Last Image Data FOFOh AA OE 00 00 Note FO FO xx yy Don t care Image size returned by C328 ACK package ID C328 7640 JPEG Compression Module 11 2004 8 19 5 2 Preview Picture uncompressed preview picture Initial preview VGA AA 01 00 06 07 72 ACK AA OE 01 xx 00 00 Get Picture preview picture AA 04 02 00 00 00 ACK AA OE 04 xx 00 00 Data preview picture I frame AA 0A 02 Image Data whole picture ACK AA OE OA xx 00 00 Note xx ZZ Don t care Image size returned by C328 KC7783R PIR Module Low Cost version This is a low cost version of the PIR module It is designed for cost sensitive consumer product Except the IC package format all the mechanical and electrical spec is same as KC7783 Features IC soft package by dice bonding technique Small size 25 x 35mm Ball lens is included as standard configuration 3 leads flat cable for easy connection 4 mounting holes on board High Sensitivity High immunity to RFI Power up delay to prevent from false triggering Output High for direct connect to control panel Specification Min Typ Max
3. Unit Lens Dimension unit in mm Operation Voltage 47 5 12 V Standby Current no load 300 uA Output Pulse Width 05 Sec Output High Voltage 5 UV Detection Range 5 M Operation Temperature 20 25 50 C Humidity Range 95 Note 1 All other features and specification please refer to KC778B 2 Minimum output pulse width can be customer specified Standard Configuration PIR controller KC778B in dice form PIR Sensor RE200B by NICERA Lens Ball lens of 60 detection angle Connector 3 leads flat cable Power GND O P 37 Sa Vertical View Pattern Application Note 1 The PIR sensor is sensitive to the temperature change and therefore to prevent from operating the module in rapid environmental temperature changes strong shock or vibration Don t expose to the direct sun light or headlights of automobile Don t expose to direct wind from heater or air conditioner 2 This module is designed for indoor use If using in outdoor make sure to apply suitable supplemental optical filter and drop proof anti dew construction 3 Detection range might be varied in different environmental temperature condition
4. preview VGA AA 01 00 07 yy 07 yy 07 ne AA OE 01 xx 00 00 Set Package Size 512 bytes size AA 06 08 00 02 00 ACK AA OE 06 xx 00 00 Snapshot compressed picture AA 05 00 00 00 00 ACK AA OE 05 xx 00 00 Get Picture snapshot picture AA 04 01 00 00 00 ACK AA OE 04 xx 00 00 Data snapshot picture ACK package ID Ne res 0000h AA OE 00 00 00 00 Image Data Package 512 bytes ID 0000h ACK package ID 000 I h AA OE 00 00 Image Data Package 512 bytes ID 0001h I The Last Image Data Package FOFOh AA 0E 00 00 Note FO FO xx yy Don t care Image size returned by C328 ACK package ID C328 7640 JPEG Compression Module 9 2004 8 19 4 2 Snapshot Picture uncompressed snapshot picture Initial preview VGA AA 01 00 06 07 zz ACK AA OE 01 xx 00 00 Snapshot uncompressed picture AA 05 01 00 00 00 ACK AA OE 05 xx 00 00 Get Picture snapshot picture AA 04 01 00 00 00 ACK AA OE 04 xx 00 00 Data snapshot picture AA OA OT Image Data whole picture AA OE OA xx 00 00 Note xx zz Don t care Image size returned by C328 C328 7640 JPEG Compression Module 10 2004 8 19 5 Getting JPEG preview pictures video for RS232 Make sure connection is made before the following communication 5 1 JPEG Preview Picture Initial JPEG preview VGA AA 01 00 07 yy 07 ACK AA OE 01 xx 00 00 Set Package Size
5. LAMPIRAN A Program pada arduino uno include lt NewSoftSerial h gt include lt SDCameraC328R h gt void getJPEGPicture callback uint16 t pictureSize packageCount byte package void blink int times int sync camera void int ledPin 2 int PIRPin Ch SDCameraC328R camera void setup pinMode ledPin pinMode PIRPin OUTPUT INPUT digitalWritet ledPin HIGH int retval 0 Serial begin 57600 retval camera InitializeSD if retval 0 blink retval retval sync camera if retval 0 blink retval digitalWrite ledPin Inisialisasi LOW void loop for uint1l6_t 130 191000 int retval 0 retval digitalRead PIRPin if retval HIGH digitalWrite ledPin i retval sync camera if retval 0 blink retval sprintf camera filename HIGH TA0422079 05d jpg uint16 t packageSize uintl6 t Set Pin 2 sebagai output untuk LED Set Pin 3 sebagai input dari PIR LE Set LED dalam posisi ON Inisialisasi 1 Deklarasi variabel retval 0 Penanda Awal Set Baudrate komunikasi serial 57600 Inisialisasi SDCard Jika Error tandai dengan kedipan LED Inisialisasi Kamera Jika Error tandai dengan kedipan LED Set LED dalam posisi OFF Penanda Akhir Deklarasi variabel retval 0 Baca nilai dari PIR Jika terdeteksi gerakan Set LED dalam posisi ON Inisialisasi Kamera Jika Er
6. al Release Note 1 Jan 28 2004 official released v1 0 2 Feb 24 2004 official released v1 1 y Fix the definition of verify code y Fix the bug of unable jump to power save mode y Fix the incorrect connection speed after wake up from power save mode 3 Apr 24 2004 official released v2 0 y Add auto baud rate detection y Add support of 9600bps 19200bps 38400bps y Disable the 8 bit colour for uncompressed picture 4 Apr 12 2005 official released v2 1 y Add command to change the light freguency between 50 60 Hz y Add more descriptions of the resolution selection 5 Aug 19 2005 official released v3 0 y Add description of the auto power mode y Add FAQ section COMedia Ltd gt BARRA RZ E Rm 802 Nan Fung Ctr Castle Peak Rd Tsuen Wan NT Hong Kong Fax 852 2414 3050 Tel 852 2498 6248 Email sales comedia com hk tp www comedia com hk ht General Description The C328 module is a highly integrated serial camera board that can be attached to a wireless or PDA host performing as a video camera or a JPEG compressed still camera It provides a serial interface RS 232 and JPEG compression engine to act as a low cost and low powered camera module for high resolution serial bus security system or PDA accessory applications OV7640 8 OV528 VGA Image emo Compression Sensor Engine EEPROM C328 camera module Program eee OE E E Figure 1 System block diagram Feat
7. e Number Error 10h Unexpected Command 06h Set Transfer Package Size Wrong 11h SRAM JPEG Type Error 07h Command Header Error FOh SRAM JPEG Size Error 08h Command Length Error Flh Picture Format Error 09h Send Picture Error F5h Picture Size Error Qah Send Command Error ffh 12 Light Frequency AA13h The host issues this command to change the light frequency of the C328 7640 12 1 Light Frequency Type 50Hz 00h 60Hz Olh C328 7640 JPEG Compression Module 2004 8 19 Command Protocol 1 SYNC Command SYNC T AA OD 00 00 00 00 SE ACK C328 AA OE OD xx 00 00 SYNG AA OD 00 00 00 00 ACK AA OE OD xx 00 00 2 Make Connection with C328 7640 Send the SYNC command at 14400bps until receiving ACK command from C328 7640 usually an ACK command is receive after sending 25 times of SYNC command This must be done after power up SYNC AA OD 00 00 00 00 SYNC AA OD 00 00 00 00 SYNC AA OD 00 00 00 00 Max 60 times I I I SYNC AA OD 00 00 00 00 ACK AA OE OD xx 00 00 SYNG AA OD 00 00 00 00 ACK AA OE OD xx 00 00 C328 7640 JPEG Compression Module 8 2004 8 19 3 Initial Get Picture Snapshot Set Package Size Set Baudrate Reset and Power Off Command SYNC Get Picture Snapshot Set Package Size Set Baudrate Reset Power Off 4 Getting a Snapshot for RS232 Make sure connection is made before the following communication 41 JPEG Snapshot Picture eg 640x480 resolution Initial JPEG
8. e program memory is built in for C328 7640 to provide a set of user friendly command interfacing to external host C328 7640 JPEG Compression Module 2 2004 8 19 Board L RS 232 EEPROM J 3 3V Tx Rx GND 28mm OV7640 8 OV528 Top View Bottom View Figure 2 C328 7640 board layout and serial interface pin Serial Interface 1 Single Byte Timing Diagram A single byte RS 232 transmission consists of the start bit 8 bit contents and the stop bit A start bit is always 0 while a stop bit is always 1 LSB is sent out first and is right after the start bit lt q Single Byte Transmission ww I va CHa e Ya 914 Litd dois Figure 3 RS 232 single byte timing diagram 2 Command Timing Diagram A single command consists of 6 continuous single byte RS 232 transmissions The following is an example of SYNC AA0D00000000h command d SYNC Command i TT A cui a nO i i Single i i i Byte Figure 4 RS 232 SYNC command timing diagram C328 7640 JPEG Compression Module 3 2004 8 19 Command Set The C328 7640 module supports total I I commands for interfacing to host as following Command ID Number Parameterl Parameter2 Parameter3 Parameter4 Initial AA01h 00h Color Type RAW JPEG Resolution Resolution Still image only GetPicture AA04h Picture Type 00h 00h 00h Snapshot AAOSh Snapshot Type Skip Frame Skip Frame 00h A e o gy o S
9. ength These three bytes represent the length of data of the Snapshot Picture Preview Picture or JPEG Preview Picture 9 SYNC AAODh Either the host or the C328 7640 can issue this command to make connection An ACK command must be sent out after receiving this command C328 7640 JPEG Compression Module 6 2004 8 19 10 ACK AAOEh This command indicates the success of last operation After receiving any valid command ACK command must be sent out except when getting preview data The host can issue this command to request image data package with desired package ID after receiving Data command from C328 7640 The host should send this command with package ID FOFOh after receiving a package to end the package transfer Note that the field command ID should be 00h when request image data package 10 1 Command ID The command with that ID is acknowledged by this command 10 2 ACK Counter No use 10 3 Package ID For acknowledging Data command these two bytes represent the requested package ID While for acknowledging other commands these two bytes are set to 00h 11 NAK AAOFh This command indicates corrupted transmission or unsupported features 11 1 NAK Counter No use 11 2 Error Number Picture Type Error Olh Parameter Error Obh Picture Up Scale 02h Send Register Timeout Och Picture Scale Error 03h Command ID Error Odh Unexpected Reply 04h Picture Not Ready Ofh Send Picture Timeout 05h Transfer Packag
10. et Package AA06h 08h Package Size Package Size 00h O Ii tie Set Baudrate AA07h Ist Divider 2nd Divider 00h OOh Reset AA08h Reset Type 00h 00h xh Power Off AA0 00h 00h 00h 00h Data AAOAh Data Type Length Byte 0 Length Byte I Length Byte 2 SYNC AAODh 00h OOh o bh ACK AAOEh Command ID ACK counter 00h Package 00h Package EJ TT NAK AAOFh 00h NAK counter Error Number 00h Light AA13h Frequency 00h 00h 00h Frequency Type If the parameter is OxFF the command is a special Reset command and the firmware responds to it immediately 1 Initial AA01h The host issues this command to configure the preview image size and color type After receiving this command the module will send out an ACK command to the host if the configuration success Otherwise an NACK command will be sent out 1 1 Color Type C328 7640 can support 7 different color types as follow 2 bit Gray Scale Olh 4 bit Gray Scale 02h 8 bit Gray Scale 03h 12 bit Color 05h 16 bit Color 06h JPEG 07h 12 Preview Resolution 80x60 01h 160x120 03h 1 3 JPEG Resolution Since the Embedded JPEG Code can support only multiple of 16 the JPEG preview mode can support following image sizes It is different from normal preview mode 80x64 01h 160x128 03h 320x240 05h 640x480 07h C328 7640 JPEG Compression Module 4 2004 8 19 2 Get Picture AA04h The h
11. fication Description a gt gt m i M mM 5 mM M To LO al To 1 N LO Mm O O O D A q o amp o 00 x 00 L l N N Mm N N m O O O O NE 28 25 20 20 20 16 16 Focal length mm 463 22 25 36 36 60 60 Board M remen Note All lens holder are with 14x14 thread of 12mmx0 5 height H will be varied from different lens spec 2mm pitch o to ad Note In order to facilitate people for better understanding the communication with the module we have developed an EV kit C328 EV232 for user to run under PC Windows environment However this module is not designed for PC application Such PC evaluation is only for better understanding of command control Rev 3 0 Information of Alternative Lens solution for C328 Note we suggest to use lens of IR cut filter built in for outdoor application C328 7640 Standard 3 Detail spec and dimension pls refer to the spec sheet of C328 configuration j 7 F No 2 8 I f 4 63mm i FOV 57 diagonal y Te a IR cut filter built in Lge Ti al tt C328 3620BW IR F NO 2 0 f 3 6mm No IR cut filter on the lens FOV 66 diagonal Rev 3 0 C328 2225BW No IR cut filter on the lens C328 2520BW No IR cut filter on the lens C328 6016BW IR No IR cut filter on the lens F No 2 5 f 2 2mm FOV 118 diagonal F No 2 0 f 2 5mm FOV 100 diagonal FOV 36 diagonal Rev 3 0 C328 7640 User Manu
12. host Power saving mode Various lens options Pin Description Pin Description i NCC Power3 3VDC o TxD DataTransmit 33V all RxD DataReceve 33V ar GND Power Ground i O Connector specification 2mm pitch 4pin single row Reference part no Suyin 190600 Bottom View Mating connector Suyin 140600 Command Summary Detail Command control please refer to the user s manual 1 Initial To configure the image size color type 2 Get Picture Get Picture type 3 Snapshot Set snap shot image type 4 Set Package Size Set the package size to transmit data from module to Host 5 Set Baudrate Change the baud rate 6 Reset Reset the whole system or reset the state machine 7 Power Off To enter sleep mode 8 Data Set the data type and length for transmitting data to host 9 SYNC Sync signal to connect between host and module 10 ACK Command to indicate the communication success 11 NAK Command to indicate the communication fail with error code Rev 3 0 Electrical ification Voo 3 3V 10 TA 0 to 25 C Symbol Parameter Condition Min Typ Max Unit VDD DC supply voltage 3 0 3 3 3 6 V lo Norma Operation Current Operating 60 mA Is Suspend Current Suspend 100 uA ViH High level input voltage TTL 2 0 VIL Low level input voltage TTL 0 8 Len i
13. ode it is not necessary to set the package size for uncompressed image C328 7640 JPEG Compression Module 5 2004 8 19 5 Set Baudrate AA07h Set the C328 7640 baud rate by issuing this command As the module can auto detect the baud rate of the incoming command host can make connection with one of the following baud rate in the table The module will keep using the detected baud rate until physically power off 5 1 Baudrate Divider Baudrate 14 7456MHz 2 x 2nd Divider 1 2 x Ist Divider 1 Baudrate 1 Divider 2 Divider Baudrate 1 Divider 2 Divider 7200 bps ffa Ob 28800bps 3th om 9600 bps bfh 01h 38400 bps 2m Olh 14400 bps 7fh 01h 57600 bps I fh 0h 19200 bps 5fh 01h 115200 bps Ofh 01h 6 Reset AA08h The host reset C328 7640 by issuing this command 6 1 Reset Type 00h resets the whole system C328 7640 will reboot and reset all registers and state machines Olh resets state machines only 7 Power Off AA09h C328 7640 will go into sleep mode after receiving this command SYNC command AAODh must be sent to wake up C328 7640 for certain period until receiving ACK command from C328 7640 8 Data AAOAh C328 7640 issues this command for telling the host the type and the size of the image data which is ready for transmitting out to the host 8 1 Data Type Snapshot Picture Olh Preview Picture 02h JPEG Preview Picture 05h 8 2 L
14. ost gets a picture from C328 7640 by sending this command 2 1 Picture Type Snapshot Picture Olh Preview Picture 02h JPEG Preview Picture 05h 3 Snapshot AA05h C328 7640 keeps a single frame of JPEG still picture data in the buffer after receiving this command 3 1 Snapshot Type Compressed Picture 00h Uncompressed Picture 01h 3 2 Skip Frame Counter The number of dropped frames can be defined before compression occurs 0 keeps the current frame 1 captures the next frame and so forth 4 Set Package Size AA06h The host issues this command to change the size of data package which is used to transmit JPEG image data from the C328 7640 to the host This command should be issued before sending Snapshot command or Get Picture command to C328 7640 It is noted that the size of the last package varies for different image 4 1 Package Size The default size is 64 bytes and the maximum size is 512 bytes Data Size Image Data Verify Code 2 bytes 2 bytes Package size 6 bytes 2 bytes lt 4 Package Size P ID gt Package ID starts from zero for an image Data Size gt Size of image data in the package Verify Code gt Error detection code equals to the lower byte of sum of the whole package data except the verify code field The higher byte of this code is always zero i e verify code lowbyte sum byte 0 to byte N 2 Note As the transmission of uncompressed image is not in package m
15. ror tandai dengan kedipan LED ole i Persiapkan file penampung retval camera snapshot SDCameraC328R ST_COMPRESSED 0 if retval 0 blink retval Lakukan pengambilan gambar kompres ke dalam JPEG Jika Error tandai dengan kedipan LED retval camera getJPEGPicture SDCameraC328R PT_JPEG PROCESS_DELAY amp getJPEGPicture_callback if retval 0 blink retval Ambil gambar dari kamera dan Simpan ke dalam SDCard Jika Error tandai dengan kedipan LED delay 500 digitalWrite ledPin LOW Set LED dalam posisi OFF else digitalWrite ledPin LOW Set LED dalam posisi OFF Fungsi getJPEGPicture callback Dipanggil setiap kali paket data JPEG diterima not used void getJPEGPicture callback uint16 t pictureSize uintl6 t packageSize uint16 t packageCount byte package Digunakan untuk melakukan fungsi lain selain menyimpan ke dalam SDCard PE Fungsi blank Digunakan untuk mengedipkan LED sebanyak kode Error void blink int err if lerr return while 1 for int i 0 1 lt erre at didgitalWrlte leQPin HIGH delay 200 digitalWritetlLedPin LOW delay 200 delay 1000 Fungsi sync camera Digunakan untuk mempersiapkan kamera Setting mode kerja kamera er return values Edo 0 success ES ERRCODE Camera sync errorcode int sync camera int retval 0 retval camera sync if retval
16. ures Small in size low cost and low powered 3 3V camera module for high resolution serial bus security system or PDA accessory applications 4 On board EEPROM provides a command based interface to external host via RS 232 UART 115 2Kbps for transferring JPEG still pictures or 160x128 preview 8bpp with 0 75fps On board Omni Vision OV7640 8 VGA color sensor 4 Built in JPEG CODEC for different resolutions Built in down sampling clamping and windowing circuits for VGA QVGA 160x120 or 80x60 image resolutions 34 Built in color conversion circuits for 2 bit gray 4 bir gray 8 bit gray 12 bit RGB 16 bit RGB or standard JPEG preview images No external DRAM required m nfiguration 1 Camera Sensor The C328 7640 module uses OmniVision OV7640 8 VGA color digital CameraChips with an 8 bit YCbCr interface 2 ON528 Serial Bridge The OV528 Serial Bridge is a JPEG CODEC embedded controller chip that can compress and transfer image data from CameraChips to external device The OV528 takes 8 bit YCbCr 422 progressive video data from an OV7640 8 CameraChip The camera interface synchronizes with input video data and performs down sampling clamping and windowing functions with desired resolution as well as color conversion that is requested by the user through serial bus host commands The JPEG CODEC can achieve higher compression ratio and better image quality for various image resolutions 3 Program EEPROM A serial typ
Download Pdf Manuals
Related Search
Related Contents
Philips Streamium Wireless Multimedia Adapter SLM5500 "user manual" Réactif IgE Flex - Siemens 製品安全データシート 改訂日:2008年3月20日 1.製品 Westinghouse 52-Inch Specification Sheet BENDIX PNU-179 User's Manual m103 - アンブレラカンパニー Internal Kick-Off Meeting Réunion de lancement interne Copyright © All rights reserved.
Failed to retrieve file