View
217
Download
0
Tags:
Embed Size (px)
Citation preview
C328-7640 JPEG Compression VGA Camera Module
Camera Details: Low-cost ($47) & low-
powered (3.3V) and very small in size
RS-232 interface: A wide range of baud rates ranging from 9600 to 115.2K bps for transferring images
Built-in color conversion circuits for 4 gray/16 gray/256 gray/12-bit RGB/16-bit RGB images.
Auto detect baud rate and make connection to the host
Camera operations and features
On-board EEPROM provides a command-based interface to external host via RS-232.
A RS-232 transceiver set-up has to be used as communication interface. The MAX3232CUE chip is used.
Sample picture from the camera
The picture is displayed using the MATLAB ‘imshow’ function.
Details: Resolution: 80 x 60 Color type: 12 bit color 4
bits for Red, 4 bits for Green and 4 bits for Blue
Total Size: 7200 bytes
Sample picture .. This is a picture taken of a
red ball on a black background (a black binder here)
This is the type of image that is expected to be seen in the project.
Color detection algorithm will be run on this type of images.
It takes less than 6 seconds to transfer the entire image from the camera to the host.
Vector distance algorithm for color detection
Lets say we are searching for “green” color. Pure green exists when the values of the pixels are R = 0, G = 255, B = 0.
The pixel we took in is a vector
Pixel = [R G B]
The eculedian distance between those 2 vectors is
D = sqrt((R-0)^2 + (G-255)^2 + (B-0)^2)
Code
So the algorithm goesfor each pixel { 1. compute the distance between that
pixel and the reference color (D) 2. if D<Threshold then current pixel is accepted
else current pixel is NOT accepted
}
Threshold
"Threshold" is a constant value and has to be set manually according on the "tolerance" desired for application (a high value of Threshold means that less "clear" green pixels will be considered as green, whereas a lower value of Threshold will make the algorithm quite "strict")
Actuator
Stepper Motor Precise positioning High static torque for blocking the ball from moving toward the
camera Rotate 90º at 7.5º per full step (12 steps) Half-stepping method (24 steps) to eliminate stiff movement of
Full-stepping method
Stepper Motor Controller
1B3
2B6
3B11
4B14
1C2
2C7
3C9
4C16
CLMP11
CLMP28
U1
ULN2064
HCS12
B3B2B1B0
Coil DCoil CCoil BCoil A
Stepper Motor
5V
Power
ULN2064 – Quad Darlington Switches
Commands and Step Sequence
Commands RCW: Rotate
counterclockwise 90º Pause: Step motor stops Resume: Step motor
resumes rotational movement
When pause activates, motor will pause after the last RCW is finish executing
Allow future expansion or additional commands
Sample Step SequenceStep Number Coil A Coil B Coil C Coil D
1 1 0 0 1
2 1 0 0 0
3 1 1 0 0
4 0 1 0 0
5 0 1 1 0
6 0 0 1 0
7 0 0 1 1
8 0 0 0 1
Ball Dispensing Mechanism
Motor arm pushes one ball at the bottom of the tube
Next ball falls after previous ball has been pushed out
User Interface:GUI & Commands
Serial CommunicationRS-232Javax.comm package
Default Commands:Start SystemStop System
Override Commands:Pause SystemResume SystemClear
Proposed Bit Patterns
Commands Bit Pattern (8 bits) Commands10000000 Start01000000 Stop00100000 Pause00010000 Resume00001000 Clear Balls
Status Bit Pattern (8 bits) System Status00000100 Running00000010 Paused00000001 Stopped11111111 Error
Operating Conditions
Uniform black background Single colored ball Brightly lit room Size of the ball
Potential Difficulties
Jamming of balls “Extreme” shades of red, green or blue might not be
detected Poor lighting conditions Motor controller overheats