TLC5940 driver for Analog Outputs

Introduction

The TLC5940 driver for Analog Outputs is used to modulate the pulse width on a channel on a PWM extender connected to the Builder Base. This driver cannot alter the frequency, it is pure PWM.


Driver Parameters

The TLC5940 driver for Analog Outputs has six parameters that have to be configured:

GSCLK

This is the PWM frequency driven by the Builder Base. This pin can be connected to any pin on the Builder Base if pin is not already in use for something else.

XLAT

This is the register clock line which shifts the serial data once transmitted into the output registers which eventually set the pins to the desired output state. This pin can be connected to any pin on the Builder Base if pin is not already in use for something else.

BLANK

This line resets the grayscale clock after counted up to 4095. This pin can be connected to any pin on the Builder Base if pin is not already in use for something else.

SIN

This is the data line which transmits the serial data bits from the client to the extender chip. This pin can be connected to any pin on the Builder Base if pin is not already in use for something else.

SCLK 

This is the serial clock line which keeps the transmission of the serial data bits in sync. This pin can be connected to any pin on the Builder Base if pin is not already in use for something else.

Channel

This is the channel on the TLC5940 modulating the pulse width; enter a number between 0-15 to select the channel you want to modulate. The Quantum System supports 8-bit (0-255) PWM.


Wiring

This is a pinout of the DIP version of the chip

More information regarding the chip can be found in its datasheet

 

Example

Channel 0 is connected to an LED directly through a current limiting resistor. This is not necessary as the the chip's sinking current is already limited by the resistor connecting IREF (Pin 20) with GND. The table of current limiting can be seen here

Another very important fact about this chip is that it can only sink and not source current! So The OUT channel would always be connected to the Cathode of an LED as shown in the example.

Breadboard

Schematic

Used Pins

Used Pins

Description

Used Pins

Description

 5V

The voltage level for the assembly

GND

The ground potential for the assembly

GP4 (can be any GP pin)

GSCLK - Grayscale clock line

GP2 (can be any GP pin)

XLAT - latch register line

GP3 (can be any GP pin)

BLANK - the reset for the grayscale counter

GP0 (can be any GP pin)

SIN - serial data line

GP1 (can be any GP pin)

SCLK - serial clock line


How to write an App

Navigate to the App Builder and create a new application. You can find the “Analog Out” code object under the “Hardware” Tab in the object drop down menu on the left, or you can also use the search bar.

 

 

Drag the “Analog Out” Object onto the canvas.

 

 Next, locate the “Slider Analog” object under the “Interface” tab and drag it onto the canvas.

 

 

Finally, connect the value port on the Analog Slider to the value port on the Analog Out object.

  


How to create a firmware

Navigate to the Firmware Builder and create a new Firmware file.

 

 

Click the “+Add Hardware” button which will open a modal window. Scroll down in the list to find the “Generic” section and select the “Analog Out” hardware option.

Give your device a name and click “Add Device”

 

 

 

Next, select the “TLC5940” driver under the driver dropdown menu.

Next, set the pin.

For this example we will select:

  • GSCLK : GP0

  • XLAT : GP1

  • BLANK : GP2

  • SIN : GP3

  • SCLK : GP4

  • Channel : 0

 

You may now save your firmware file and upload it to one of your Builder Bases

 

 

 


Supported Hardware

  • LEDs

  • Buzzer


Downloads

Apps

Firmware

Assets