The following code group sets the CMU-01 camera’s
internal registers. We are setting the lighting for fluorescent
lights, Color Mode; auto white balance on. The white balance command takes approximately five seconds to adjust.
SerOut2 tx, 6, [“CR 45 7 18 44
19 33”, 13]
LCDOut “Color & AE on”
LCDOut 254, 192, “Wait 5 sec.”
The following programming line commands the
CMU-01 to turn off the Color Mode balance.
SerOut2 tx, 6, [“CR 45 7 18 40
19 32”, 13]
These next commands put the CMU-01 into Poll Mode
(PM). This restricts the camera to sending a single packet of
information when a processing function is called.
SerOut2 tx, 6, [“PM 1”, 13]
The following lines put the CMU-01 into Raw serial
transfer Mode (RM) where the “ACK\r and “NCK\r”
confirmations are not sent after each command.
SerOut2 tx, 6, [“RM 1”, 13]
This next code group sends the text message to the
user via the LCD to place a target in front of the C-Bot.
The user is given five seconds to accomplish this task.
LCDOut “Place Target”
LCDOut 254, 192, “5 sec.”
For x = 0 TO 10
SerOut2 tx, 6, [“L1 1”, 13]
SerOut2 tx, 6, [“L1 2”, 13]
In addition to the text message, the green LED blinks.
In case the LCD is turned off to conserve power, the
blinking LED also informs the user to place their target in
front of the lens.
The next command tells the CMU-01 to Track the
color found in the Window (TW). When this command is
initiated, the CMU-01 shrinks its FOV window to 1/4 size of
its standard resolution, captures the color in the window,
then restores the window to its original size. To get an idea
of the TW, look at Figure 12. The black section represents
the 1/4 size capture color window.
SerOut2 tx, 6, ["TW", 13]
Here is a method to make
simple servomotor wheels. We
start with a 2” diameter hard
wood dowel and cut 3/8” thick
disks from it.
Figure A shows one wood
disk, a paper guide (Figure B
shows an enlarged version), and
a push pin to mark the
disk. The guide is aligned
onto the wood disk. The
push pin is pushed
through the paper in the
exact center of the disk
as shown in Figure C.
Remove the paper
and push pin from the
wood disk. Next, align a
servomotor horn onto it.
Align the push pin hole
to the center of the center screw hole on the servomotor horn. Attach the aligned
servomotor horn to the wood
disk using #4 x 1/4” long sheet
metal screws (see Figure D).
FIGURE A. Wood
disk, paper guide,
and push pin.
FIGURE B. Paper guide.
1) File flat the side of the
servomotor horn that touches
the wood disk.
2) After the servomotor horn
is attached, remove
the horn to drill a 1/4”
hole through the center of the wood disk.
Next, reattach the servomotor horn. The
drilled hole allows you
to attach the wheel to
the servomotor using
the horn screw.
FIGURE D. Finished wheel.
3) The bare wood
wheels are a little slippery. So, I placed a small 1/4" wide
black rubber band around the circumference of the
wheels for traction. This worked out very well.
FIGURE C. Push pin
pushed through the
paper marking disk.
The next command puts the text message on the LCD
that the target has been captured.
LCDOut “Target Captured”
This command reads a switch position to determine
whether the program should operate in Run or Test mode.
IF PORTB.4 = 1 Then RT2