GROUP ASSIGNMENT
IoT COLOUR-BASED DETECTOR PROJECT
Prepared by :-
Mustaqim | Faiz | Syafril | Haziq | Nad
MEK576
INSTRUMENTATION AND MEASUREMENT
BACKGROUND
Limitations of Traditional Colour Detection Methods
Often time-consuming, labor-intensive and prone to
errors due to manual intervention or specialized
equipment.
Smart & Connected Systems
Enables the development of smart homes and other
connected systems that can adjust lighting,
temperature and other devices based on colour
detection.
INTRODUCTION
This project combines IoT technology and colour
sensing to create a system that detects and identifies
colour.
To develop a device that accurately senses colour in
the environment.
Its algorithm may analyzes the data and identifies the
specific colour based on predefined approaches.
OBJECTIVE
To create a working IoT device that can detect and
identify colours accurately in real-time.
To improve programming skills by working with
Arduino board and others.
TYPE OF COMPONENTS
Arduino UNO R3
Colour sensor TCS3200
LCD display
Breadboard
Wire
MAIN COMPONENTS
Arduino UNO R3 Colour sensor TCS3200
WIRING DIAGRAM
FLOW CHART
https://cloud.smartdraw.com/editor.aspx?templateId=
490dad73-de30-42bf-9a58-1789d56c1afd&flags=12
8#depoId=47487989&credID=-50943517
PSEUDOCODE
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define s0 4 //Module pins wiring
#define s1 5
#define s2 6
#define s3 7
#define out 8
LiquidCrystal_I2C lcd(0x27,16,2);
int data,r,g,b;
void setup()
{
lcd.init();
pinMode(s0,OUTPUT); //pin modes
pinMode(s1,OUTPUT);
pinMode(s2,OUTPUT);
pinMode(s3,OUTPUT);
pinMode(out,INPUT);
PSEUDOCODE
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(1,0);
lcd.print("COLOUR DETECTOR");
Serial.begin(9600); //intialize the serial monitor baud rate
digitalWrite(s0,HIGH); //Putting S0/S1 on HIGH/HIGH levels means the output frequency scalling is at
100% (recommended)
digitalWrite(s1,HIGH); //LOW/LOW is off HIGH/LOW is 20% and LOW/HIGH is 2%
}
PSEUDOCODE
void loop() //Every 2s we select a photodiodes set and read its data
{
digitalWrite(s2,LOW); //S2/S3 levels define which set of photodiodes we are using LOW/LOW is for RED
LOW/HIGH is for Blue and HIGH/HIGH is for green
digitalWrite(s3,LOW);
Serial.print("Red value= ");
GetData(); //Executing GetData function to get the value
r=data;
Serial.print(r);
digitalWrite(s2,LOW);
digitalWrite(s3,HIGH);
Serial.print("Blue value= ");
GetData();
PSEUDOCODE
b=data;
Serial.print(b);
digitalWrite(s2,HIGH);
digitalWrite(s3,HIGH);
Serial.print("Green value= ");
GetData();
g=data*0.65;
Serial.print(g);
lcd.setCursor(0, 1);
if(r<b&r<g&r> 5) lcd.print(" -RED- ");
else if(r<b&g<b&b<20) lcd.print(" -YELLOW- ");
else if(b<r&b>g&b<25) lcd.print(" -BLUE- ");
else if(r>25&b>25&g>25) lcd.print(" -CANNOT DETECT- ");
Serial.println();
delay(2000);
}
PSEUDOCODE
void GetData(){
data=pulseIn(out,LOW); //here we wait until "out" go LOW, we start measuring the duration and stops
when "out" is HIGH again
//The higher the frequency the lower the duration
delay(20);
}
LEARNING OUTCOME
Understanding of IoT Technology
Gain the knowledge of how to connect IoT devices
and transmit data to LCD display.
Hardware Integration
Obtain the proficiency of how to integrate hardware
components such as Arduino board and colour
sensor module.
LEARNING OUTCOME
Sensor Data Processing
Developing the colour detection algorithm that will
require processing sensor data to identify and
classify colours.
Programming Skills
Gain hands-on experience in programming of
Arduino board with another components using C++
language.