Silicon ChipTCS230 Colour Sensor - January 2025 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: As expected, the 3G shutdown was messy
  4. Feature: Data Centres & Cloud Computing by Dr David Maddison
  5. Project: Digital Capacitance Meter by Stephen Denholm
  6. Project: Compact HiFi Headphone Amp by Nicholas Vinen
  7. Feature: Precision Electronics, Part 3 by Andrew Levido
  8. Project: Gesture-controlled USB lamp by Tim Blythman
  9. Project: BIG LED clock by Tim Blythman
  10. Subscriptions
  11. Project: 40A Current Probe by Andrew Levido
  12. PartShop
  13. Project: Battery-Powered Model Train by Les Kerr
  14. Feature: TCS230 Colour Sensor by Jim Rowe
  15. Feature: Extracting Data from Micros by Dr Hugo Holden
  16. Serviceman's Log: Relating a range of rambling repairs by Various
  17. Vintage Radio: Monarch “All-American Five” radio by Ian Batty
  18. Market Centre
  19. Advertising Index
  20. Outer Back Cover

This is only a preview of the January 2025 issue of Silicon Chip.

You can view 38 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "Digital Capacitance Meter":
  • Digital Capacitance Meter PCB [04111241] (AUD $5.00)
  • PIC16F1847-I/P programmed for the Digital Capacitance Meter [0411124A.HEX] (Programmed Microcontroller, AUD $15.00)
  • 1.3-inch blue OLED with 4-pin I²C interface (Component, AUD $15.00)
  • 1.3-inch white OLED with 4-pin I²C interface (Component, AUD $15.00)
  • Firmware for the Digital Capacitance Meter (Software, Free)
  • Digital Capacitance Meter PCB pattern (PDF download) [04111241] (Free)
  • Digital Capacitance Meter front panel and drilling diagrams (Panel Artwork, Free)
Items relevant to "Compact HiFi Headphone Amp":
  • Compact HiFi Headphone Amplifier PCB [01103241] (AUD $7.50)
  • Dual Horizontal PCB-mounting RCA sockets (white/red) [RCA-210] (Component, AUD $2.50)
  • Compact HiFi Headphone Amplifier kit (Component, AUD $70.00)
  • Compact HiFi Headphone Amplifier PCB pattern (PDF download) [01103241] (Free)
  • Compact HiFi Headphone Amplifier panel drilling diagram (Panel Artwork, Free)
Articles in this series:
  • Compact HiFi Headphone Amp (December 2024)
  • Compact HiFi Headphone Amp (December 2024)
  • Compact HiFi Headphone Amp (January 2025)
  • Compact HiFi Headphone Amp (January 2025)
Articles in this series:
  • Precision Electronics, Part 1 (November 2024)
  • Precision Electronics, Part 1 (November 2024)
  • Precision Electronics, Part 2 (December 2024)
  • Precision Electronics, Part 2 (December 2024)
  • Precision Electronics, Part 3 (January 2025)
  • Precision Electronics, part one (January 2025)
  • Precision Electronics, part one (January 2025)
  • Precision Electronics, Part 3 (January 2025)
  • Precision Electronics, part two (February 2025)
  • Precision Electronics, Part 4 (February 2025)
  • Precision Electronics, Part 4 (February 2025)
  • Precision Electronics, part two (February 2025)
  • Precision Electronics, part three (March 2025)
  • Precision Electronics, part three (March 2025)
  • Precision Electronics, Part 5 (March 2025)
  • Precision Electronics, Part 5 (March 2025)
  • Precision Electronics, Part 6 (April 2025)
  • Precision Electronics, Part 6 (April 2025)
  • Precision Electronics, part four (April 2025)
  • Precision Electronics, part four (April 2025)
  • Precision Electronics, part five (May 2025)
  • Precision Electronics, Part 7: ADCs (May 2025)
  • Precision Electronics, part five (May 2025)
  • Precision Electronics, Part 7: ADCs (May 2025)
  • Precision Electronics, part six (June 2025)
  • Precision Electronics, part six (June 2025)
Items relevant to "Gesture-controlled USB lamp":
  • Firmware for JMP018 - Gesture Controlled USB Lamp (Software, Free)
Articles in this series:
  • Wired Infrared Remote Extender (May 2024)
  • Symbol USB Keyboard (May 2024)
  • Wired Infrared Remote Extender (May 2024)
  • Thermal Fan Controller (May 2024)
  • Symbol USB Keyboard (May 2024)
  • Thermal Fan Controller (May 2024)
  • Self Toggling Relay (June 2024)
  • Self Toggling Relay (June 2024)
  • Arduino Clap Light (June 2024)
  • Arduino Clap Light (June 2024)
  • Lava Lamp Display (July 2024)
  • Digital Compass (July 2024)
  • Digital Compass (July 2024)
  • Lava Lamp Display (July 2024)
  • JMP009 - Stroboscope and Tachometer (August 2024)
  • JMP007 - Ultrasonic Garage Door Notifier (August 2024)
  • JMP009 - Stroboscope and Tachometer (August 2024)
  • JMP007 - Ultrasonic Garage Door Notifier (August 2024)
  • IR Helper (September 2024)
  • IR Helper (September 2024)
  • No-IC Colour Shifter (September 2024)
  • No-IC Colour Shifter (September 2024)
  • JMP012 - WiFi Relay Remote Control (October 2024)
  • JMP012 - WiFi Relay Remote Control (October 2024)
  • JMP015 - Analog Servo Gauge (October 2024)
  • JMP015 - Analog Servo Gauge (October 2024)
  • JMP013 - Digital spirit level (November 2024)
  • JMP013 - Digital spirit level (November 2024)
  • JMP014 - Analog pace clock & stopwatch (November 2024)
  • JMP014 - Analog pace clock & stopwatch (November 2024)
  • WiFi weather logger (December 2024)
  • Automatic night light (December 2024)
  • WiFi weather logger (December 2024)
  • Automatic night light (December 2024)
  • BIG LED clock (January 2025)
  • Gesture-controlled USB lamp (January 2025)
  • Gesture-controlled USB lamp (January 2025)
  • BIG LED clock (January 2025)
  • Transistor tester (February 2025)
  • Wireless flashing LEDs (February 2025)
  • Transistor tester (February 2025)
  • Wireless flashing LEDs (February 2025)
  • Continuity Tester (March 2025)
  • RF Remote Receiver (March 2025)
  • Continuity Tester (March 2025)
  • RF Remote Receiver (March 2025)
  • Discrete 555 timer (April 2025)
  • Weather monitor (April 2025)
  • Discrete 555 timer (April 2025)
  • Weather monitor (April 2025)
Items relevant to "BIG LED clock":
  • Firmware for JMP019 - BIG LED Clock (Software, Free)
Articles in this series:
  • Wired Infrared Remote Extender (May 2024)
  • Symbol USB Keyboard (May 2024)
  • Wired Infrared Remote Extender (May 2024)
  • Thermal Fan Controller (May 2024)
  • Symbol USB Keyboard (May 2024)
  • Thermal Fan Controller (May 2024)
  • Self Toggling Relay (June 2024)
  • Self Toggling Relay (June 2024)
  • Arduino Clap Light (June 2024)
  • Arduino Clap Light (June 2024)
  • Lava Lamp Display (July 2024)
  • Digital Compass (July 2024)
  • Digital Compass (July 2024)
  • Lava Lamp Display (July 2024)
  • JMP009 - Stroboscope and Tachometer (August 2024)
  • JMP007 - Ultrasonic Garage Door Notifier (August 2024)
  • JMP009 - Stroboscope and Tachometer (August 2024)
  • JMP007 - Ultrasonic Garage Door Notifier (August 2024)
  • IR Helper (September 2024)
  • IR Helper (September 2024)
  • No-IC Colour Shifter (September 2024)
  • No-IC Colour Shifter (September 2024)
  • JMP012 - WiFi Relay Remote Control (October 2024)
  • JMP012 - WiFi Relay Remote Control (October 2024)
  • JMP015 - Analog Servo Gauge (October 2024)
  • JMP015 - Analog Servo Gauge (October 2024)
  • JMP013 - Digital spirit level (November 2024)
  • JMP013 - Digital spirit level (November 2024)
  • JMP014 - Analog pace clock & stopwatch (November 2024)
  • JMP014 - Analog pace clock & stopwatch (November 2024)
  • WiFi weather logger (December 2024)
  • Automatic night light (December 2024)
  • WiFi weather logger (December 2024)
  • Automatic night light (December 2024)
  • BIG LED clock (January 2025)
  • Gesture-controlled USB lamp (January 2025)
  • Gesture-controlled USB lamp (January 2025)
  • BIG LED clock (January 2025)
  • Transistor tester (February 2025)
  • Wireless flashing LEDs (February 2025)
  • Transistor tester (February 2025)
  • Wireless flashing LEDs (February 2025)
  • Continuity Tester (March 2025)
  • RF Remote Receiver (March 2025)
  • Continuity Tester (March 2025)
  • RF Remote Receiver (March 2025)
  • Discrete 555 timer (April 2025)
  • Weather monitor (April 2025)
  • Discrete 555 timer (April 2025)
  • Weather monitor (April 2025)
Items relevant to "40A Current Probe":
  • 40A Current Probe PCB [9049-01] (AUD $5.00)
  • 5MHz 50A Current Probe PCB pattern (PDF download) [9049-01] (Free)
  • Panel artwork and drilling diagrams for the Current Probe (Free)
Items relevant to "Battery-Powered Model Train":
  • Battery Powered Model Train transmitter PCB [09110241] (AUD $2.50)
  • Battery Powered Model Train TH receiver PCB [09110242] (AUD $2.50)
  • Battery Powered Model Train SMD receiver PCB [09110243] (AUD $2.50)
  • Battery Powered Model Train charger PCB [09110244] (AUD $2.50)
  • PIC12F617-I/P programmed for the Battery-Powered Model Train transmitter [0911024T.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F1455-I/P programmed for the Battery-Powered Model Train TH receiver [0911024R.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F1455-I/SL programmed for the Battery-Powered Model Train SMD receiver [0911024R.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC12F617-I/P programmed for the Battery-Powered Model Train charger [0911024C.HEX] (Programmed Microcontroller, AUD $10.00)
  • Software for the Battery Powered Model Railway project (Free)
  • Battery Powered Model Train PCB patterns (PDF download) [09110241-4] (Free)
Items relevant to "TCS230 Colour Sensor":
  • Test sketch for the TCS230 Colour Sensor Module (Software, Free)
Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)

Purchase a printed copy of this issue for $13.00.

Using Electronic Modules with Jim Rowe TCS230-based Colour Sensor Module This interesting module can sense the colour components of any object or light source in front of it. It does this using an array of 64 tiny photodiodes, and it has four white LEDs that can illuminate a surface or object. It is compatible with almost any microcontroller, including Arduinos. T hose 64 photodiodes are split into four groups of 16: one group to detect red light, one for green, a third to detect blue, and the fourth to detect white light. As you can see from the photos, it is pretty tiny at just 33 × 33 × 30mm. That last depth dimension includes the four LEDs at the front and the two 5-pin headers at the rear. The array of 64 photodiodes it uses to detect colours are all extremely small, all inside a single SOIC-8 SMD device with a transparent top. It is mounted in the centre of the module’s PCB and surrounded by a small black plastic ‘shroud’. The SOIC-8 device concerned is the TCS230, made by US firm Texas Advanced Optoelectronic Solutions Inc (aka TAOS). They describe it as a “programmable colour light-to-­ frequency converter”. To give you a better idea of the size of those 64 photodiodes, the TAOS data sheet says that they are each only 120μm x 120μm (micrometres) in size and arranged on 144μm centres. So the total array of 8×8 photodiodes measures only about 1.3mm square. That’s pretty impressive, considering that 48 of the diodes have their own colour filter above them! Inside the TCS230 Fig.1 shows what is inside the TCS230 sensor chip. On the left, you can see the 8×8 array of photodiodes, with the 16 diodes for each colour arranged in four rows of four and the four ‘banks’ intertwined so they each get a ‘fair share’ of the light reaching the array. Note that the 16 photodiodes in each bank are all connected in parallel. The logic block shown to the right of the array allows you to select which colour bank you want using the control inputs S2 and S3 (pins 7 and 8). The logic levels used to do this are shown in the table at upper right; for example, with S2 and S3 both low, the red photodiode bank is selected, while if they are both high, that selects the green bank. The bank select block feeds the output from the selected photodiode bank into the current-to-frequency converter block to its right. It converts the current from the selected photodiode bank into a square wave with a frequency directly proportional to the current level. The current-to-frequency scaling is programmable using control inputs S0 and S1 (pins 1 and 2). These work as shown in the table at the lower right of Fig.1. If S0 and S1 are both high, the scaling is 100%, but if S1 is taken low while S0 remains high, the scaling drops to 20% and so on. If they are both taken low, the chip is powered down and there is no output. Fig.1: a block diagram of the TCS230 sensor chip. Inputs S2 & S3 can be driven low (“L”) or high (“H”) to select the a subset of the photodiodes (which selects what colour to detect), while S0 & S1 change the current-to-frequency scaling. 80 Silicon Chip Australia's electronics magazine siliconchip.com.au Fig.2: the spectral response curves for each of the photodiode colours from the TCS230. All of the curves have been normalised such that the ‘clear’ bank of photodiodes has an output frequency scaling of 100%. The ‘full-scale’ frequency with S0 and S1 both high is around 500600kHz, while if S0 is high but S1 is low, the full-scale frequency drops to 100-120kHz. If S0 is low while S1 is high, the full-scale frequency drops to 10-12kHz. The scaled-down frequency ranges allow the device to be used with lower-cost microcontrollers or applications where period measurement is more appropriate. It’s also possible to disable the output from the TCS230 device using the OE input (pin 3). If pulled high, this pin turns off the chip’s output at pin 6, while if it’s taken low (to ground), the chip works normally. Response curves The spectral response curves of the TCS230 are shown in Fig.2. All four curves are ‘normalised’ to a scaling where the response of the ‘clear’ bank of photodiodes is set to 1.0 (or 100%) at a wavelength of 680nm (nanometres). The clear bank (black plot) has a broad response curve covering the full range of wavelengths from 300nm to 1100nm, while the red bank (red plot) is similar but narrower, mainly covering the range from 570nm to 1100nm. The plots for the green bank (green plot) and blue bank (blue plot) are a bit different, consisting of ‘twin peaks’ above and below the 680nm wavelength of the clear and red bank peaks. Their peaks are also significantly lower than the clear and red bank peaks. Visible light is generally considered to cover wavelengths from 380nm to 700nm. Ultraviolet light is below 380nm, while infrared is above 700nm. As you can see, the sensor responds quite strongly to near-infrared light on all four banks. Therefore, for the best accuracy with visible light wavelengths, an infrared filter should be placed in front of it. That would also cut out the secondary blue peak entirely, and most of the secondary green peak, so they would only respond to the ‘wanted’ ranges of 380-570nm and 450-620nm, respectively. The shroud around the sensor on the module is threaded; one possible Fig.3: the TCS230 module is a simple design with few components. Transistor Q1 controls four white LEDs, which are used to illuminate the object being measured. siliconchip.com.au Australia's electronics magazine reason for that is to allow an IR filter (and/or a lens) to be screwed in. The full module circuit The full circuit of the TCS230-based colour sensing module is shown in Fig.3. As you can see, there’s not much in it apart from the TCS230 chip and the four white LEDs (LED1-LED4) that can be used to illuminate objects that do not produce light themselves. Connections to the module are via two 5-pin SIL headers, CON1 and CON2. Both headers provide pins for supply voltage Vcc (nominally +5V) and ground, making it easy to connect more than one module to a microcontroller. CON1 provides pins for connections to programming inputs S0 and S1, plus another pin to allow control of LEDs 1-4. On the other side, CON2 provides pins for controlling inputs S2 and S3, plus the frequency output from the TCS230. Programming inputs S0 and S1 are provided with 10kW pullup resistors to the Vcc line, so if no external connections are made to these pins, the TCS230 will operate at the 100% frequency scaling level by default. The S2 and S3 inputs (via CON2) have no pullup resistors because these inputs must always be driven to select a photo­diode bank. January 2025  81 Transistor Q1 controls the four white LEDs (LED1-4) connected between its collector and the Vcc line with series 330W resistors. The base of Q1 is connected to the LED input pin of CON1 and the Vcc line via another 330W resistor, so the transistor will power the LEDs by default, unless the LED pin of CON1 is pulled to ground. That gives you the option of leaving the LED pin unconnected for the LEDs to be permanently lit, connecting it permanently to a GND pin to disable them entirely, connecting a switch between the LED pin and GND to control them manually, or driving the LED pin from the digital output of a microcontroller, where a high level will switch them on and a low level will switch them off. The only other things to note about the module circuit are the 330W resistor in series with the OUT pin of CON2, presumably to protect the TCS230 from damage due to excessive load current, and the 10μF and 100nF bypass capacitors between the Vcc and ground lines to stabilise the supply voltage. Connecting it to an Arduino Fig.4 shows how easily the module can be connected to an Arduino Uno. It should be just as straightforward to connect it to any other versions of the Arduino, including the new Uno R4 Minima we reviewed recently, or to many other microcontrollers such as the Micromite or Maximite. All you need to do is connect the module’s Vcc and GND pins to the +5V and GND pins of the MCU (microcontroller unit), connect its S0-S3 programming inputs to four of the MCU’s digital outputs (IO4-IO7 here) and connect its OUT pin to one of the MCU’s digital inputs (IO8 here). Then, if you want to turn the LEDs on and off, you can connect a switch as shown. It will leave the module’s LED pin at ~0.6V when the switch is open (LEDs on) or pull it to GND when closed (LEDs off). What about software? Regarding the software needed to use the TCS230 module with an Arduino or any other MCU, Jaycar provides a listing of a simple sketch to put their XC3708 module through its paces with an Arduino Uno or similar. It is worth a try, but note that their sketch expects different connections between the module and the Arduino than those shown in Fig.4. It also does not drive the module’s S0, S1 or LED pins, so the sketch allows the TCS230 to run at 100% frequency scaling and assumes that you will have the LEDs permanently on/off or controlled manually with a switch. I found a couple of informative tutorials on the internet on using a TCS230 module with an Arduino, and both provided suitable sketches: • How To Mechatronics – https:// siliconchip.au/link/abre • Random Nerd Tutorials – http:// siliconchip.au/link/abrf The second of these sites provided the listing of a simple sketch to put the TCS230 module through its paces, written by a chap called Rui Santos. After checking that it expected the The TCS230 is primarily used to detect colours in the RGB spectrum, there’s also the similar TCS3200 which works over a wider range. module connections shown in Fig.4, I copied and pasted that into the Arduino IDE, verified and compiled the sketch and finally uploaded it to my Arduino Uno. I then held pieces of red, green, blue and white card in front of the module and checked the results in the IDE’s Serial Monitor window. I found the output a bit puzzling, so I decided to analyse what was going on in Mr Santos’s sketch. I found that in the sketch, he was using the Arduino language function pulseIn() to measure the frequency of the TCS230’s output. When I looked up that function, I discovered it actually measures the duration (length) of pulses in microseconds, not their frequency. After this discovery, I decided to adapt Mr Santos’s sketch so that it would produce the TCS230 output Fig.4: the wiring diagram for the TCS230 module to an Arduino Uno or similar. A switch can be connected to the circuit to allow the four LEDs on the module to be switched on or off. 82 Silicon Chip Australia's electronics magazine siliconchip.com.au A close-up of the TCS230 colour sensor. While not very apparent on this photo, if you look at the sensor with a microscope, you should be able to see the photodiode array. A better photo can be seen at: siliconchip.au/ link/abrg frequency rather than the pulse duration. And after a bit of trial and error, I came up with a sketch which did just that. A screen grab of the SerialMonitor window when this sketch was running is shown in Screen 1, with annotations indicating which card was in front of the TCS230 module when the measurements were taken. As you can see, the colour frequencies that match the card are generally higher than the others. With the green card, the blue values were almost as high as green, suggesting it was more of an aquamarine (blue-green) colour than a pure green. When any of the red, green or blue cards were sensed, the clear figure was roughly equal to the sum of the other three figures. Of course, this sketch is pretty basic. If you want to use the TCS230 module for some serious work – identifying specific colours, for example – you would need to improve on it considerably. But you should find this sketch a good place to start. My sketch is called “TCS230_coloursensormodule_checking_sketch.ino”, and you can download it from siliconchip.com. au/Shop/6/324 Where to buy it The TCS230-based colour sensing module shown in the photos is currently available from several suppliers, including Jaycar Electronics (Cat XC3708), for $19.95 plus delivery. A very similar module, the DFRobot SEN0101, is also available from suppliers such as DigiKey, Mouser, element14 and RS at prices ranging from $13.56 to $14.19. But note that the SEN0101 module lacks the cylindrical black plastic ‘shroud’ around the SC TCS230 sensing device. Output from our sketch adapted from the one by Rui Santos RED GREEN BLUE WHITE 15:33:39.996 -> Red = 1228 Green = 377 Blue = 484 Clear = 1945 15:33:40.371 -> 15:33:50.353 -> Red = 1213 Green = 377 Blue = 485 Clear = 1901 15:33:50.681 -> 15:34:00.710 -> Red = 447 Green = 729 Blue = 606 Clear = 1736 15:34:01.038 -> 15:34:11.020 -> Red = 447 Green = 729 Blue = 609 Clear = 1773 15:34:11.395 -> 15:34:21.377 -> Red = 437 Green = 1002 Blue = 1683 Clear = 3086 15:34:21.705 -> 15:34:31.687 -> Red = 436 Green = 1002 Blue = 1683 Clear = 3086 15:34:32.062 -> 15:34:42.044 -> Red = 2074 Green = 2192 Blue = 2762 Clear = 6944 15:34:42.372 -> 15:34:52.354 -> Red = 2074 Green = 2192 Blue = 2762 Clear = 6944 15:34:52.682 -> Screen 1: the sketch produces counts for each photodiode bank that are proportional to the frequency and thus light intensity. siliconchip.com.au Australia's electronics magazine Ideal Bridge Rectifiers Choose from six Ideal Diode Bridge Rectifier kits to build: siliconchip. com.au/Shop/?article=16043 28mm spade (SC6850, $30) Compatible with KBPC3504 10A continuous (20A peak), 72V Connectors: 6.3mm spade lugs, 18mm tall IC1 package: MSOP-12 (SMD) Mosfets: TK6R9P08QM,RQ (DPAK) 21mm square pin (SC6851, $30) Compatible with PB1004 10A continuous (20A peak), 72V Connectors: solder pins on a 14mm grid (can be bent to a 13mm grid) IC1 package: MSOP-12 Mosfets: TK6R9P08QM,RQ 5mm pitch SIL (SC6852, $30) Compatible with KBL604 10A continuous (20A peak), 72V Connectors: solder pins at 5mm pitch IC1 package: MSOP-12 Mosfets: TK6R9P08QM,RQ mini SOT-23 (SC6853, $25) Width of W02/W04 2A continuous, 40V Connectors: solder pins 5mm apart at either end IC1 package: MSOP-12 Mosfets: SI2318DS-GE3 (SOT-23) D2PAK standalone (SC6854, $35) 20A continuous, 72V Connectors: 5mm screw terminals at each end IC1 package: MSOP-12 Mosfets: IPB057N06NATMA1 (D2PAK) TO-220 standalone (SC6855, $45) 40A continuous, 72V Connectors: 6.3mm spade lugs, 18mm tall IC1 package: DIP-8 Mosfets: TK5R3E08QM,S1X (TO-220) See our article in the December 2023 issue for more details: siliconchip.au/Article/16043 January 2025  83