About Here

This web blog is established for collecting useful information about building prototype with arduino or other applications. This page shuld help a designer with very basical technical cognition to build a working model or a prototyp for his design concept. We find prototyp or working model an excellent tool to test concept and understand it's usage in real condition (not only fantasy in mind). It's ofter very hard to realize every functions of a design concept. However it's our goal here to make this task easier.

What should be always keeped in mind is that we are not engineers and it's not our goal to design a perfect electron programme control. We are designers who are more willing to understand the users through prototype testing.

This web-site is still under construction and more information shall be collected. :)

Feb 1, 2014

USE TLC5940 on Arduino Leonardo

The TLC5490 library (http://playground.arduino.cc/learning/TLC5940 ) should be modified to be working with Arduino Leonardo. The Solution can be found here:
http://forum.arduino.cc/index.php?topic=110394.0
I went through all the process and this solution works fine. This post is my documentation.


step by step:
1. Backup the chip_includes.h file in the 'pinouts' folder in the TLC5940 library folder, since leonardo uses different definitions of pins. Then edit the chip_includes.h as follows:
=====================================
/* Copyright blablabla*/
#ifndef TLC_CHIP_INCLUDES_H
#define TLC_CHIP_INCLUDES_H

/** \file
    Includes the chip-specfic defaults and pin definitions. */

#include <avr/io.h>
#ifndef PB0
#define PB0     PORTB0
#define PB1     PORTB1
#define PB2     PORTB2
#define PB3     PORTB3
#define PB4     PORTB4
#define PB5     PORTB5
#define PB6     PORTB6
#define PB7     PORTB7
#endif
/* Chip Specific Pinouts */
#if defined (__AVR_ATmega32U4__)

/* Leonardo */
#include "Arduino_Leonardo.h"

#else
#error "Unknown Chip!"
#endif

#endif
=====================================


2. create a file named "Arduino_Leonardo.h" and modify the file as follows:
=====================================
#ifndef TLC_Teensy_xxU4_h
#define TLC_Teensy_xxU4_h

#if DATA_TRANSFER_MODE == TLC_BITBANG
#error "If you want bitbang mode, insert pin defs here"
#endif

// MOSI (Leo outter center ICSP pin) -> SIN (TLC pin 26)
#define TLC_MOSI_PIN   2
#define TLC_MOSI_PORT   PORTB
#define TLC_MOSI_DDR   DDRB

// SCK (Leo inner center ICSP pin) -> SCLK (TLC pin 25)
#define TLC_SCK_PIN   1
#define TLC_SCK_PORT   PORTB
#define TLC_SCK_DDR   DDRB

// SS (Leo RX LED)
#define TLC_SS_PIN   0
#define TLC_SS_DDR   DDRB

// OC1A (Leo pin 9) -> XLAT (TLC pin 24)
#define XLAT_PIN   5
#define XLAT_PORT   PORTB
#define XLAT_DDR   DDRB

// OC1B (Leo pin 10) -> BLANK (TLC pin 23)
#define BLANK_PIN   6
#define BLANK_PORT   PORTB
#define BLANK_DDR   DDRB

// OC3A (Leo pin 5) -> GSCLK (TLC pin 18)
#define GSCLK_PIN   6
#define GSCLK_PORT   PORTC
#define GSCLK_DDR   DDRC
#define TLC_TIMER3_GSCLK 1

#endif

=========================================


3. Connect to Arduino Leonardo as follows:
TLC5940  to Leonardo
pin 27 to Gnd
pin 26 to MOSI (see picture)
pin 25 to SCK (see picture)
pin 24 to pin 9
pin 23 to pin 10
pin 22 to Gnd
pin 21 to +5V
pin20 to Gnd with a 2k resistor
pin 19 to +5V
pin 18 to pin 5
see picture below:


4. Connect LEDs with the positive legs to +5V and negative legs to TLC outputs.

5. finished, upload sketch.

Reference:
http://forum.arduino.cc/index.php?topic=110394.0


No comments:

Post a Comment