The best tools to make your project dreams come true

Login or Signup

11/25/2019 | By Staff

How to Connect a TEMT6000 Light Sensor to DK IoT Studio

In this how-to article, we will learn how to include the TEMT6000 sensor into a Digi-Key IoT Studio project, how to connect it to our Adafruit Huzzah32, and then use it in a practical example with a Bluetooth app!


Using an Ambient Light Sensor with DK IoT Studio

Light sensors are used to detect the ambient light levels and have many potential applications. The most common application of a light sensor is for daytime/night-time detection, which can be used in automatic car lights. Another, less obvious, example of light sensor applications would be safety switches in sealed containers. An advanced electrical distribution circuit or power controller can be housed inside an opaque box that uses a light sensor to read the light level inside the box. If the box is opened, then light from outside will get into the box and this can be detected by the sensor. The resulting detection can be used to disable the main power feed to prevent electric shock.

The TEMT6000 sensor is an ambient light sensor that is very simple to connect and use. The sensor has three pins, with two for power (VDD and 0V) and a single signal pin that produces a voltage output proportional to the ambient light falling on the sensor. This how-to will use the TEMT6000 to produce an ambient light sensor app that uses a Bluetooth device to wirelessly stream the light level of the room.

The Hardware: Huzzah32 and TEMT6000

The hardware for this project is very simple and only requires three connections. The Huzzah32 is connected to a PC via a micro USB B cable for power, while the TEMT6000 sensor is connected to the Adafruit Huzzah32’s power pins, with the signal output being connected to A1. While a breadboard is not required to get this project working, it makes connecting the TEMT6000 and the Huzzah32 very easy (when used with wires).

The Software: Digi-Key IoT Studio

The software side of the project is where the complexity lies with this how-to, and the first step into creating our light sensor is to create a new project based on the Huzzah32 device, then adding the TEMT6000 sensor to our element library. To do this, click the Add Element button below the Element Toolbox and search for TEMT6000 in the window. Then, click the enable button and close the window (the TEMT6000 element should now appear at the bottom of your Element Toolbox, under imported).

How to Connect a TEMT6000 Light Sensor to DK IoT Studio

The TEMT6000 element can perform multiple actions, including the ability to read raw and lux. Raw reads will return light levels as an ADC read, whereas lux reads return the light level in lux. For the lux reading to function correctly, the correct pull-down resistor value needs to be known. The advantage of the TEMT6000 board is that it includes an onboard 10K resistor that is already chosen by default, so this number can be ignored!

Our project will consist of an interval element probing the TEMT6000 element once a second, and upon triggering a read, the TEMT6000 will send its lux value over Bluetooth. It is important that the trigger between the interval and the TEMT6000 is to read the ambient light as lux, and the trigger between the TEMT6000 and the Bluetooth is set for a read of the lux (as opposed to an interrupt or trigger).

How to Connect a TEMT6000 Light Sensor to DK IoT Studio

The app side of the project is an interval element connected to a Bluetooth element, which is then connected to a label element. The interval element triggers a read from the Bluetooth element, while the Bluetooth sends its read value to the label. The value sent to the label, however, is a piece of text appended to the value (“Light Level”) so that the label is more readable.

How to Connect a TEMT6000 Light Sensor to DK IoT Studio

The TEMT6000 is just one example of the many different sensors and functions offered by the DK IoT Studio, and we will continue to expand our knowledge base in future posts, so you can do even more with the IoT Studio!