I am trying to expand on the POV project in Simon Monk’s 15 DANGEROUSLY MAD PROJECTS.
I purchased a “24-Channel PWM Diver” for the task. Is there a tutorial and/or wiring diagram or schematic to wire for a RGB LED project or similar type of project?
I do not understand this sketch era.
What is clock, data, latch?
24-Channel PWM
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- flrnfg
- Posts: 20
- Joined: Sun Mar 18, 2012 3:19 pm
24-Channel PWM
- Attachments
-
- POV project in Simon Monk.jpg (198.71 KiB) Viewed 875 times
- adafruit_support_bill
- Posts: 88087
- Joined: Sat Feb 07, 2009 10:11 am
Re: 24-Channel PWM
The tutorial is still in development. The pins are connected as follows:
data (DIN) -> Pin 4
clock (CLK) -> Pin 5
latch (LAT) -> pin 6
GND -> GND
V+ -> 5v
An RGB LED can be soldered in place as shown below. The common anode (longest pin) can go into any of the 3 V+ holes.
data (DIN) -> Pin 4
clock (CLK) -> Pin 5
latch (LAT) -> pin 6
GND -> GND
V+ -> 5v
An RGB LED can be soldered in place as shown below. The common anode (longest pin) can go into any of the 3 V+ holes.
- Attachments
-
- 2013_09_08_IMG_2154-1024.jpg (64.52 KiB) Viewed 871 times
-
- 2013_09_08_IMG_2164-1024.jpg (67.75 KiB) Viewed 871 times
- flrnfg
- Posts: 20
- Joined: Sun Mar 18, 2012 3:19 pm
Re: 24-Channel PWM
Sorry about the double post. I did not realize the first post had posted.
I have three questions.
1. Can I use a separate power supply to the driver board?
2. Do I connect another driver board by jumpers to the opposite side of the first one to the second driver?
3. What would be the address for the second driver board.
Thank you for your time and help
I have three questions.
1. Can I use a separate power supply to the driver board?
2. Do I connect another driver board by jumpers to the opposite side of the first one to the second driver?
3. What would be the address for the second driver board.
Thank you for your time and help
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: 24-Channel PWM
YesFLRNFG wrote:1. Can I use a separate power supply to the driver board?
YesFLRNFG wrote:2. Do I connect another driver board by jumpers to the opposite side of the first one to the second driver?
You don't address the boards separately. The channel numbers are sequential. The first board in the daisy chain has channels 0 through 23, the second board has channels 24 through 47, etc.FLRNFG wrote:3. What would be the address for the second driver board.
- flrnfg
- Posts: 20
- Joined: Sun Mar 18, 2012 3:19 pm
Re: 24-Channel PWM
This is the example test code. Works great.
I know very little about code. I have purchased several books trying to teach myself.
I my readings, I cannot find “colorWipe or rainbowCycle”.
I get most of this code but I don’t understand how to set 0,1,2,3… to high or low.
Can someone show how to write something this basic?
I am just trying to learn the basics.
I know very little about code. I have purchased several books trying to teach myself.
I my readings, I cannot find “colorWipe or rainbowCycle”.
I get most of this code but I don’t understand how to set 0,1,2,3… to high or low.
Can someone show how to write something this basic?
I am just trying to learn the basics.
Code: Select all
#include "Adafruit_TLC5947.h"
// How many boards do you have chained?
#define NUM_TLC5974 1
#define data 4
#define clock 5
#define latch 6
#define oe -1 // set to -1 to not use the enable pin (its optional)
Adafruit_TLC5947 tlc = Adafruit_TLC5947(NUM_TLC5974, clock, data, latch);
void setup() {
Serial.begin(9600);
Serial.println("TLC5974 test");
tlc.begin();
if (oe >= 0) {
pinMode(oe, OUTPUT);
digitalWrite(oe, LOW);
}
}
void loop() {
colorWipe[/color](4095, 0, 0, 100); // "Red" (depending on your LED wiring)
delay(200);
colorWipe(0, 4095, 0, 100); // "Green" (depending on your LED wiring)
delay(200);
colorWipe(0, 0, 4095, 100); // "Blue" (depending on your LED wiring)
delay(200);
rainbowCycle(10);
}
// Fill the dots one after the other with a color
void colorWipe(uint16_t r, uint16_t g, uint16_t b, uint8_t wait) {
for(uint16_t i=0; i<8*NUM_TLC5974; i++) {
tlc.setLED(i, r, g, b);
tlc.write();
delay(wait);
}
}
// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
uint32_t i, j;
for(j=0; j<4096; j++) { // 1 cycle of all colors on wheel
for(i=0; i< 8*NUM_TLC5974; i++) {
Wheel(i, ((i * 4096 / (8*NUM_TLC5974)) + j) & 4095);
}
tlc.write();
delay(wait);
}
}
// Input a value 0 to 4095 to get a color value.
// The colours are a transition r - g - b - back to r.
void Wheel(uint8_t ledn, uint16_t WheelPos) {
if(WheelPos < 1365) {
tlc.setLED(ledn, 3*WheelPos, 4095 - 3*WheelPos, 0);
} else if(WheelPos < 2731) {
WheelPos -= 1365;
tlc.setLED(ledn, 4095 - 3*WheelPos, 0, 3*WheelPos);
} else {
WheelPos -= 2731;
tlc.setLED(ledn, 0, 3*WheelPos, 4095 - 3*WheelPos);
}
}
Last edited by adafruit_support_bill on Sun Nov 03, 2013 6:21 am, edited 1 time in total.
Reason: Please use the 'code' button when submitting code - click 'code' and paste your code between the tags.
Reason: Please use the 'code' button when submitting code - click 'code' and paste your code between the tags.
- adafruit_support_bill
- Posts: 88087
- Joined: Sat Feb 07, 2009 10:11 am
Re: 24-Channel PWM
colorWipe and rainbow Cycle are defined in the code you posted.I my readings, I cannot find “colorWipe or rainbowCycle”.
Here is colorWipe - it simply interates the array of pixels and sets eaach one to the specified color:
Code: Select all
// Fill the dots one after the other with a color
void colorWipe(uint16_t r, uint16_t g, uint16_t b, uint8_t wait) {
for(uint16_t i=0; i<8*NUM_TLC5974; i++) {
tlc.setLED(i, r, g, b);
tlc.write();
delay(wait);
}
}
Code: Select all
// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
uint32_t i, j;
for(j=0; j<4096; j++) { // 1 cycle of all colors on wheel
for(i=0; i< 8*NUM_TLC5974; i++) {
Wheel(i, ((i * 4096 / (8*NUM_TLC5974)) + j) & 4095);
}
tlc.write();
delay(wait);
}
}
Please be positive and constructive with your questions and comments.