008 - Brickcell Color TCS34725 | MakeCode Microbit

Introduction

The TCS34725 is a color sensor manufactured by a company called ams (formerly known as TAOS, Texas Advanced Optoelectronic Solutions). This sensor is designed to detect and measure the color of ambient light and objects. It can accurately determine the intensity of red, green, blue, and clear (unfiltered) light, allowing it to provide RGB color information.

The TCS34725 sensor is commonly used in various applications, including color sensing, color calibration, and ambient light adjustment. It is often used in electronics and robotics projects to enable devices to perceive and respond to colors in their environment.

Hardware Instruction

Let's explore how to connect the TCS34725 RGB color sensor to a micro:bit microcontroller and utilize MakeCode for programming.

  1. Connect the Pressure sensor GND pin to microbit GND pin.
  2. Connect the Pressure sensor VCC pin to microbit VCC pin.
  3. Connect the Pressure sensor serial data pin (SDA) to microbit pin 20.
  4. Connect the Pressure sensor serial clock pin (SCL) to microbit pin 19.

Software Instruction

Now, let's start into programming the micro:bit to utilize the TCS34725 rgb color sensor.

  1. Login to https://makecode.microbit.org/ using your Microsoft account.
  2. Create a new project by clicking the "New Project" button. You may name it anything you want, I suggest to name it with descriptive name such as "color-tcs34725-test".
  3. Click the "Extensions" block just under the "Math" block.
  4. Type https://github.com/gbantique/brickcell-color-tcs34725/ on the search bar.
  5. Select the "brickcell-color-tcs34725" from the search results. The "color tcs34725" block should appear under the "Brickcell" block.
  6. Copy the code provided below.
1basic.forever(function () {
2    serial.writeLine("R: " + Brickcell.getRed());
3    serial.writeLine("G: " + Brickcell.getGreen());
4    serial.writeLine("B: " + Brickcell.getBlue());
5    serial.writeLine("");
6    basic.pause(1000)
7})
  1. Open a Serial Monitor such as Termite terminal app https://www.compuphase.com/software_termite.htm/. Set the baud rate to 115200 bps.

Or you make a copy of my created project in your MakeCode workspace.

https://makecode.microbit.org/S09799-16651-64526-78642/

Expected Result

If you carefully follow the provided instruction above, you should be able to view the measured color values of red, green, and blue on the serial terminal every 1000 milliseconds.



Posts in this series



No comments yet!

GitHub-flavored Markdown & a sane subset of HTML is supported.