26
Adviser : Chao- Huang Wei Student ID : M9920106 Student : Shin-An Chen 指指指指 : 指指指 指指 :M9920106 指指 : 指指指

Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

Embed Size (px)

Citation preview

Page 1: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

Adviser : Chao-Huang Wei Student ID : M9920106Student : Shin-An Chen

指導教授 : 魏兆煌學號 :M9920106姓名 : 陳信安

Page 2: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

2

I. Introduction

II. CMOS image sensor,

Microcontroller and other devices

III. Communication between

microcontroller and CMOS image

sensor

IV. Design circuit and write program

V. Results and Conclusions

OUTLINE

Page 3: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

3

Introduction Solar energy has been used in many traditional technologies for centu

ries.

Solar energy is currently used in a number of applications: heat, electricity generation, desalination of seawater…

There are many ways to determine Sun’s angle and one of them uses sensors.

Using CMOS image sensor in Sun tracking system is both high productivity and low price

Page 4: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

4

Algorithms to determine the Sun’s position

In the triangle ΔOAP, we have:

(1)

Similarly, in the triangle ΔSOP

(2) Substituting (2) into (1), we get

α

H

O (x0, y0)

P (x, y)x

y

z

β

A

B

S

Incident Sun ray

CMOS Image sensor

Lens

Image of Sun

00 ycostanHy

cosH

yy

H

OPtan

0

0

costan

sintan

yHy

xHx

cos

OAOP

xtan)yy(xyy

xxtan

000

0

Page 5: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

5

This research study concentrates on how to use CMOS image sensor and microcontroller in Sun tracking system.

PIC18F4520

CMOS Image Sensor

SRAMSignal Data

Data

Counter

Ad

dress

Page 6: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

6

CMOS technology is used in many fields.

Advantages of CMOS imager sensors are low power consumption, low voltage, direct digital output, small size and simple to design.

CMOS image sensors are with high performance and reliability.

OpticsSensor

Digital Imaging

Processing

Storage Display

InterfaceUser

Interface

Page 7: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

7

Color CMOS image sensor KAC-9647

CMOS: Complementary Metal- Oxide- Semiconductor KODAK KAC-9647 Array format (number of pixels): Total: 488x 672 (pixels)

Active: 488(V) x 648(H) (pixels) Effective Image Area Total: 2.93mm x 4.03mm

Active: 2.93mm x 3.89mm Resolution: 300,000 pixels Optical format: 1/4‘’ Pixel size: 6.0μm x 6.0μm Video Output: 8 & 10 Bit Digital Frame Rate: 68 frames per second

KODAK KAC-9647

Page 8: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

8

Microcontroller – PIC18LF4520Microcontroller – PIC 18LF4520

- Package: 40-pin DIP- Program memory: Flash (32k)- Data memory: Sram (1536 bytes), Eeprom

(256 bytes)- I/O Ports: Port A, B, C, D, E- 4 timers- 10-bit A/D module: 13 input channels

Other devices• SRAM (Static Random Access Memory• Counter 74AC161• RS232• MOSFET P channel• 74HC14…

SRAM CY7C1049CV33

Page 9: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

9

Overall chip block diagram

CMOS image sensor KAC-9647

Analog pixel values

Digital pixel values

Page 10: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

10

Communication between microcontroller and image sensor

Inter-Integrated Circuit (I2C)

I²C is a multi-master serial computer bus and used to attach low-speed peripherals to a motherboard, embedded system, or cell phone.

Write operation

Read operation

A = acknowledge (SDA LOW)Ā = not acknowledge (SDA HIGH)S = START conditionP= STOP conditionFrom sensor

From master

S W PAARegister Address Data Byte

Device AddressS W A PAARegister Address ĀDevice AddressS R

‘1’ read

‘0’ write

‘0’ write

Data Byte

Device Address A

Page 11: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

11

Digital video port

The captured image is placed onto a flexible 10-bit digital port (d [9:0]).

d9d8d7d6d5d4d3d2d1d0

d9d8d7d6d5d4d3d2d1d0

KAC-9647 Processor

Pixel clockRow triggerFrame trigger

Page 12: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

12

KAC-9647 has two ways to transfer data into microcontroller: “Master mode” and “Slave mode”.

MASTER MODE

Sensor sends the signal of row (hsync) and frame (vsync) to microcontroller after it finishes one row or frame.

Row n Row n+1

Invalid pixel data

pclk

d[9:0]

hsync

Frame n Frame n+1

Invalid pixel data

pclk

d[9:0]

vsync

Page 13: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

13

Every pixel in every row is consecutively read out, one pixel at a time. Scan direction can be programmed.

CDS/Shift Register

1 2

01234567891011121314151617

Analog Data Out

Line A

ddress

3 4 5 7 8 9 10 11 12

13 1415 16 1760

Progressive scan

Page 14: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

14

Design circuit

MicrocontrollerPIC 18LF4520CMOS image

sensorKAC-9647

RAMCY7C1049

WR

RD

Master Clock

Pixel Clock

Row trigger

Frame trigger

Row valid

Frame valid

I2C Clock

I2C Data

DataComputer

Counter74AC161

DATA

Address

Pixel Clock Pixel Clock

RS232

CL

EA

R

INP

UT

, LO

AD

Page 15: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

15

Design circuit

5V

5V

PETE

Q0 Q1 Q2 Q3

CLOCK

CARRY OUT

PETE

Q0 Q1 Q2 Q3

CLOCK

CARRY OUT

PETE

Q0 Q1 Q2 Q3

CLOCK

CARRY OUT

Counter 1 Counter 2 Counter 3

PETE

Q0 Q1 Q2 Q3

CLOCK

CARRY OUT

Counter 4

PETE

Q0 Q1 Q2 Q3

CLOCK

CARRY OUT

Counter 5

Five counters 74AC161 are connected

Page 16: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

16

The circuit was drawn by Protel 99SE program. Schematic editor was transferred to the PCB editor.

Electronic schematic

Printed circuit board

Page 17: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

17

Design circuitMake the circuit

Board Master

LPKF ProtoMat C40

Circuit CAM

Page 18: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

18

Write programWrite program MPLAB IDE is a software program to develop applications for Microchip

microcontrollers MPLAB debug and compile program code, that write by C language or Assemble.

Program

Circuit MPLAB

Power

Page 19: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

19

Flowchart of C program code

Start

Receiving Data

Reset all counters & sensor

Address increases

Turn off power of sensor

Start to read SRAM

Finish 1 picture?

End

Yes

No

Transmit data

The end of frame?

No

Yes

Page 20: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

20

The following picture is the circuit, which consists of Microcontroller

PIC 18LF4520, CMOS image sensor KAC-9647, SRAM HM628512,

82C55, 74HCT245 and others.

Results

CMOS Image sensorCMOS Image sensor

Counter-74AC161Counter-74AC161PIC18LF4520PIC18LF4520

RS232RS232

ICSPICSP

SRAMSRAM

IRF7422D2IRF7422D274HC1474HC14

Page 21: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

21

Results Graphical user interface (GUI) is written by Visual Basic 6.0 of Microsoft

cooperation.

It can receive data from microcontroller and store all data into text format file or excel format file.

Text file

Excel file

Interface

Visual Basic code

Page 22: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

22

Results

GUI can read data of any 24-bitmap image and show it again. It is also transfer to monochrome image. However, GUI can not show clearly the image from KAC sensor.

GUI read one image in computer and show it

Page 23: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

23

The circuit operates well.

Counters and SRAM run synchronously

Microcontroller can control the CMOS image sensor

SRAM can store all data in to its memory.

Computer can receive data and save in text file or excel file.

However, the received image is not clear.

Results

Page 24: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

24

Conclusions

Using counters and SRAM is a good method to overcome a problem of fast transmitting data of sensor.

The circuit was made by CNC machine and welded by hand. Thus, it can put into practice in anywhere and utilize easily.

Without the framegrabber card in computer and low cost & high reliability of sensor, the price of the circuit decreases remarkably. It is also able to apply the circuit in devices that price is considered. However, it makes the data process and image display more sophisticated.

It concerns about the solutions to keep sensor clean from conditional environment (dust, noise…).

Page 25: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安

references

[1]Pham Thi Thu Hien, “Using CMOS image sensor andmicrocontroller in sun tracking system”, 2007

Page 26: Adviser : Chao-Huang Wei Student ID : M9920106 Student : Shin-An Chen 指導教授 : 魏兆煌 學號 :M9920106 姓名 : 陳信安