Skip to content

SuongLuong/Portable-Color-Dectection-Device

Repository files navigation

TCS34725 RGB Color Sensor & the Raspberry Pi

TABLE OF CONTENTS

I. Introduction

II. Thing used in this Project

III. Project Schedule

IV. Setting Up

V. Printed Circuit Board PCB and Soldering

VI. Power Up and Unit Testing

VII. Production Testing

I. Introduction

The TCS34725 RGB color sensor board can be used to detect the color of objects. It works with the Raspberry Pi using an I2C connection. When used to detect the color of things, the led should be on and the object should be put on the top of the enclosure closely. The theory of sensing the color of objects is Reflective Sensing Theory as below.

d (retrieved from http://home.roboticlab.eu/en/examples/sensor/color)

  • An System Diagram for the Project. It explains the connection between Raspberry Pi and the sensor.

image (drawn from lucidchard https://www.lucidchart.com/documents/edit/7af3db7f-a6f4-4ede-a7d2-054a490fb571/0)

II. Things used in this project

  • The TCS34725 Color Sensor
  • Rasberry Pi 3 B+ module
  • 6-pin Headers
  • 2x20-pin Header
  • Essential Softwares: Remote Desktop Connection / VNC Viewer, Fritzing(PCB Designing), CorelDraw(Enclosure Design), Product Printer in Prototype Lab.

The TCS3472 device provides a digital return of red, green, blue (RGB), and clear light sensing values. An IR blocking filter, integrated on-chip and localized to the color sensing photodiodes, allows color measurements to be made accurately. The TCS3472 an ideal color sensor solution for use under varying lighting conditions and through attenuating materials.

sensor (retrieved from: https://www.adafruit.com/product/1334)

raspberry (retrieved from https://www.google.com/search?q=raspberry+pi+3&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiz-YLm5pjfAhWE_YMKHWn6C_8Q_AUIDigB&biw=1440&bih=720#imgrc=7EPdukg2I5VbWM:)

  • The pin header from Prototype Lab:

fdasfsdafsda

haha

  • Bill of Materials/Budgets: Total for hardware components. More detail Budget

image

III. Project Schedule

The schedule for my whole project.

image

This project can be done in about 1 week time if all components are ready. The ordering process may be longer if you order outside Canada. Some websites to purchase: ElmWoodElectronic

IV. Setting Up

Student Raspberry Pi Image Creation and Test Code

  1. Download, unzip, and copy the folder contents of http://downloads.raspberrypi.org/NOOBS/images/NOOBS-2017-08-17/NOOBS_v2_4_3.zip into the SD card (at least 8GB).

  2. Insert the SD Card into the Raspberry Pi. For first time usage, a HDMI cable, a wireless mouse and a separate screen is required.

  3. Perform necessary update as instructed by the Pi steps by steps.

  4. Open the terminal in the top left corner of the screen and input the following lines (this takes quite a long time):

wget https://raw.githubusercontent.com/six0four/StudentSenseHat/master/firmware/hshcribv01.sh \
-O /home/pi/hshcribv01.sh
chmod u+x /home/pi/hshcribv01.sh
/home/pi/hshcribv01.sh

  1. Reboot the RPI

Enterprise Wi-Fi

Connect to the Raspberry Pi through Wi-Fi will be easier. This is the instruction for connection the Raspberry Pi to the Humber Wifi:

  1. In /etc/network/interfaces:

    auto lo
    iface lo inet loopback
    iface eth0 inet dhcp
    allow-hotplug wlan0
    iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    iface default inet dhcp
    
  2. In /etc/wpa_supplicant/wpa_supplicant.conf:

    sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
    
    # sample network configuration for Humber College myWi-Fi
    # change text in <> to your account values (remove the < and > while doing this )
    network={
    	ssid="myWi-Fi@Humber"
    	key_mgmt=WPA-EAP
    	auth_alg=OPEN
    	eap=PEAP
    	identity="<YourHCNetID>"
    	password="<YourHCnetPassword>"
    	phase1="peaplabel=0"
    	phase2="auth=MSCHAPV2"
    	priority=999
    	proactive_key_caching=1
    }
    
    # Sample network configuration for joining Eduroam Wi-Fi network
    # change text in <> to your account values (remove the < and > while doing this )
    network={
    	ssid="eduroam"
    	scan_ssid=1
    	key_mgmt=WPA-EAP
    	eap=PEAP
    	identity="<YourHCnetID>@humber.ca"
    	password="<YourHCnetPassword>"
    	phase1="peaplabel=0"
    	phase2="auth=MSCHAPV2"
    	proactive_key_caching=1
    
    }
    
    # Sample network configuration for joining a home wi-fi network.
    # change text in <> to your network values (remove the < and > while doing this )
    network={
    	ssid="<yourNetworkSSID"
    	psk="<yourNetworkPassword>"
    	proto=RSN
    	key_mgmt=WPA-PSK
    	pairwise=CCMP
    	auth_alg=OPEN
    }
    
    #Sample networtk configuration for joining open, unsecured network
    network={
    	ssid="<yourNetworkSSID>"
    	key_mgmt=NONE
    }
    
  3. Download Humber Certificate (For HumberSecure).cer from https://its.humber.ca/wireless/humbersecure/

  4. Reboot

V. Printed Circuit Board PCB and Soldering

  • The Breadboard view of the connection:

image (retrieved from http://www.pibits.net/code/raspberry-pi-and-tcs34725-color-sensor.php)

image

  • Soldering Process: Get started by reviewing the soldering videos. By using equipment in the Lab, it may take 1 hour. Be carefull with the PCB sides to be connected properly.

image

image

solder

48100858-f8f5e580-e1f2-11e8-9daf-02c232f5b149

Enclosure (Case for the whole hardware]

For this part, we need to work on CorelDraw. All the hardware dimensions should be measured carefully to fit the case. The default file for RPI case can be found on CENG317 folder. We need to modify this case and send the design files to Prototype Lab (prototypelab@humber.ca) to get the case. This case can be laser cut just in 5 minitues but you need to wait in line for other people.

My design file in the same directory with the name Pi2CaseX6.cdr.

image

The Fritzing file is available here: https://github.com/six0four/StudentSenseHat/tree/master/electronics/StudentSenseHatV06.fzz

The complete product. We're better use a clear material for the case instead of the black one. The reason why I used this because the Prototype lab no longer had the clear material at that time.

image

image

VI. Power Up and Unit Testing

  • Power Up: Through Ethernet cable, and Remote Desktop Control, you can connect and check your I2C address.

a

ab

  • Output: The code used to detect

sudo i2cdetect -y 1

image

image

Everytime we put the object near the sensor, the RGB value wil changed.

  • The source code Code

VII. Production Testing and Tip

  • We need to make sure all the connection are correct:

TCS34725 RPi

SDA P3 GPIO 0 (SDA)

SCL P5 GPIO 1 (SCL)

3V3 P1 3V3

GND P9

Tip:

  • For the connection between RPI and Remote Desktop Control: We need to modify the network sharing first so the RPI will be recognized by the computer. IP Advanced Scanner can be used to scan your RPI IP address and make it easier.

  • For the case: We better need an printed paper first to fit the hardware platform before printing the real laser-cut case. It will save time.

  • For more information, go on the helful links:

http://bradsrpi.blogspot.com/2013/05/tcs34725-rgb-color-sensor-raspberry-pi.html

https://www.adafruit.com/product/1334

About

Colour sensor with RaspberryPi platform to detect fruits condition

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published