I. Introduction
II. Thing used in this Project
III. Project Schedule
IV. Setting Up
V. Printed Circuit Board PCB and Soldering
VII. Production Testing
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.
(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.
(drawn from lucidchard https://www.lucidchart.com/documents/edit/7af3db7f-a6f4-4ede-a7d2-054a490fb571/0)
- 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.
(retrieved from: https://www.adafruit.com/product/1334)
(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:
- Bill of Materials/Budgets: Total for hardware components. More detail Budget
The schedule for my whole project.
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
-
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).
-
Insert the SD Card into the Raspberry Pi. For first time usage, a HDMI cable, a wireless mouse and a separate screen is required.
-
Perform necessary update as instructed by the Pi steps by steps.
-
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
- Reboot the RPI
Connect to the Raspberry Pi through Wi-Fi will be easier. This is the instruction for connection the Raspberry Pi to the Humber Wifi:
-
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
-
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 }
-
Download Humber Certificate (For HumberSecure).cer from https://its.humber.ca/wireless/humbersecure/
-
Reboot
- The Breadboard view of the connection:
(retrieved from http://www.pibits.net/code/raspberry-pi-and-tcs34725-color-sensor.php)
- The design for PCB on Fritzing: FritzingGerberFiles
- 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.
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.
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.
- Power Up: Through Ethernet cable, and Remote Desktop Control, you can connect and check your I2C address.
- Output: The code used to detect
sudo i2cdetect -y 1
Everytime we put the object near the sensor, the RGB value wil changed.
- The source code Code
- 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
-
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