Software Developement
In week 4, i am doing my coding for my colour sensor. Colour sensor are used to detect the remains stain at
the whiteboard after the cleaning.
The colour sensor are controlled by the arduino nano and give feedback
to the motor driver to control the movement at the whiteboard.
From Figure above , pin S0,S1,S2,S3 are defined as the output of
the colour sensor and sensorOut is
the input to detect any colour. S0 and S1 act
as the output frequency scaling selection inputs
and S2 and S3 as the selection input for photodiode type. The frequency scaling of the colour
sensor are also set to 20%. This frequency-scaling feature optimizes the sensor's performance for different frequency
counters or microcontrollers.
Figure show the program to set
the frequency scaling to detect black colour.
The reason why to detect
the black colour
is because black colour marker pen are commonly used at the whiteboard. When the sensor detect the black colour,
the reading of the black colour will be display
at the serial monitor. The threshold for the black colour are determined from the reading at the serial monitor.
The threshold for black colour is
around the value 80 and 90. The relationship
between colour sensor and motor is, if the reading is between 80 and 90 that is mean the colour sensor
detect the dirt left on the whiteboard. The
colour sensor will send input to the motor so that the motor will move forward
and backward two times to make sure the whiteboard are cleaned.