Vol. 01: Glowstick a Go-Go
Bunnie Huang prototypes two kinetic glowsticks: instead of creating a single arc of light, glowsticking dancers can now create their own two-dimensional fantasias.
By Bunnie Huang
Digital Edition
SUBSCRIBERS:Read this article now in your digital edition!
Get Make:
Subscribe to MAKE and get the best rate!
+ Downloads & Extras:
Bill of Materials
When I'm building these kind of prototypes, I almost never choose any part that I cannot find in stock at Digi-Key. There may be other better or cheaper inductors, but they were too hard to acquire for a project like this one.
| Qty | Digikey P/N | Description |
| 10 | 399-1100-1-ND | 0.1uF 0603 Capacitor |
| 2 | 311-1.0KGCT-ND | 1k 0603 resistor |
| 1 | X928CT-ND | 4 MHz ceramic resonator |
| 1 | 308-11771-1-ND | 22uH inductor, SMT |
| 3 | 311-47KGCT-ND | 47k 0603 resistor |
| 2 | 399-1556-1-ND | 47uF, 6.3V "C" tantalum capacitor |
| 1 | 311-80.6KHCT-ND | 82k 0603 resistor |
| 1 | 311-100KGCT-ND | 100k 0603 resistor |
| 1 | 311-200GCT-ND | 200 ohm 0603 resistor |
| 1 | 311-221KHCT-ND | 221k 0603 resistor |
| 2 | 311-240KHCT-ND | 240k 0603 resistor |
| 2 | 5230TRK-ND | Board-mount battery connector ends |
| 1 | H2131-ND | 6-pin programming header |
| 4 | 743C083181JCT-ND | 180 ohm resistor array (optional) |
| 16 | 160-1436-1-ND | Red LED, 0603 case |
| 8 | 67-1820-1-ND | RGB combo LED (optional) |
| 3 | MA3J70000LCT-ND | Schottky diode, SOT-23 package |
| 1 | MAX1676EUB-ND | Voltage regulator / MAX1676EUB |
| 4 | MM74HC595M-ND | 8-bit shift-register |
| 1 | PIC16LF876A-I/SS-ND | PIC microcontroller |
| 3 | P8045SCT-ND | Push-button switch |
Code Listings
Listing 1: code used to implement the FPGA on the first prototype
module top(hdc, led);
output hdc;
output [15:0] led;
reg [23:0] count;
wire clk, to_bufg;
wire [4:0] spriteCnt;
wire [3:0] frameCnt;
reg [15:0] ledinv;
OSC4 oscut (.F8M(), .F500K(), .F16K(to_bufg), .F490(), .F15() );
BUFG bufut (.I(to_bufg), .O(clk));
assign led[15] = !ledinv[15];
assign led[14] = !ledinv[14];
assign led[13] = !ledinv[13];
assign led[12] = !ledinv[12];
assign led[11] = !ledinv[11];
assign led[10] = !ledinv[10];
assign led[ 9] = !ledinv[ 9];
assign led[ 8] = !ledinv[ 8];
assign led[ 7] = !ledinv[ 7];
assign led[ 6] = !ledinv[ 6];
assign led[ 5] = !ledinv[ 5];
assign led[ 4] = !ledinv[ 4];
assign led[ 3] = !ledinv[ 3];
assign led[ 2] = !ledinv[ 2];
assign led[ 1] = !ledinv[ 1];
assign led[ 0] = !ledinv[ 0];
always @(posedge clk) begin
count <= count + 1;
end
assign spriteCnt[4:0] = count[9:5];
assign frameCnt[3:0] = count[19:16];
// 130 bpm = 2.167 bps = 0.4615 seconds per beat
// four bars = 34.67 seconds
// 19 64 about one minute
// 18 32 // 16 bars
// 17 16 // 8 bars
// 16 8 // about four bars <== set point at four bar points
// 15 4 // 2 bars
// 14 2 // about one bar
// 13 1 second
// 12 500 milliseconds
// 11 250
// 10 125
// 9 62.5
// 8 31.25 milliseconds
// 7 15
// 6 7.5 ms
always @(spriteCnt or frameCnt) begin
case( frameCnt )
4'b000: begin
casex( spriteCnt ) // smiley face
5'bx0000:
ledinv <= 16'b0000001111000000;
5'bx0001:
ledinv <= 16'b0000110000110000;
5'bx0010:
ledinv <= 16'b0001000000001000;
5'bx0011:
ledinv <= 16'b0011000000001100;
5'bx0100:
ledinv <= 16'b0110011001100110;
5'bx0101:
ledinv <= 16'b0100011001100010;
5'bx0110:
ledinv <= 16'b1100000000000011;
5'bx0111:
ledinv <= 16'b1000000000000001;
5'bx1000:
ledinv <= 16'b1000000000000001;
5'bx1001:
ledinv <= 16'b1100100000010011;
5'bx1010:
ledinv <= 16'b0100010000100010;
5'bx1011:
ledinv <= 16'b0110001111000110;
5'bx1100:
ledinv <= 16'b0011000000001100;
5'bx1101:
ledinv <= 16'b0001000000001000;
5'bx1110:
ledinv <= 16'b0000110000110000;
5'bx1111:
ledinv <= 16'b0000001111000000;
endcase // case( spriteCnt )
end // case: 4'b000
4'b001: begin
case( spriteCnt ) // rabbit
5'b00000:
5'b11111:
ledinv <= 16'b1100110000000011;
endcase // case( spriteCnt )
end
endcase // case( frameCnt )
end // always @ (spriteCnt or frameCnt)
assign hdc = 1'b1; // always high, so configuration status LED is off
endmodule
Listing 2: Snippet of C code of a PIC function call for displaying data using the second prototype's scheme.
#include <16F876A.h>
#device ICD=TRUE
#use delay(clock=4000000)
#fuses XT,NOWDT,NOPROTECT
#define SD_CLR_MSK 0x10
#define SD_CLK_MSK 0x08
#define SD_RCK_MSK 0x20
void display_green(unsigned long data) {
char i;
char db = 0;
port_c = SD_CLR_MSK;
// shift the bits in
for( i = 0; i < 16; i++ ) {
db = SD_CLR_MSK;
((data & 0x8000) == 0x8000) ? (db |= 1) : (db |= 0);
data <<= 1;
port_c = db;
db |= SD_CLK_MSK;
port_c = db;
db &= ~SD_CLK_MSK;
port_c = db;
}
// now make it show up
port_c = SD_RCK_MSK | SD_CLR_MSK;
port_c = SD_CLR_MSK;
}
» MAKE: NOISE — Discuss this article
You must be logged in to post a talkback.[ Display full threads] [ Newest First]
Showing messages 1 through 12 of 12.
- Figure 3
You must be logged in to reply.
Am I right in thinking that the graph in figure 3 has typos? The Bit 0 line seems incorrect. I could also be reading it wrong...Posted by chriscook8 on February 24, 2005 at 11:50:16 Pacific Time
- For those of us starting out...
You must be logged in to reply.
While the parts list and the code is good to have I would really like to attempt this sort of project but don't seem to get enough from the article. What resources and skills will I need to take this on?Posted by Deek on February 26, 2005 at 23:23:10 Pacific Time
- Why does bit 9 have 15 Hz toggle rate?
You must be logged in to reply.
On page 37: "Going back to the frequency divider property of a binary counter, we see that bit 9 on a counter clocked at 16kHz will have a toggle rate roughly equal to 15 times a second."
By my calculation, if bit 0 has a toggle rate of 16kHz, then bit 9 will have a toggle rate of 16kHz / (2^9) = 31.25 Hz. What am I missing? Thanks.Posted by deisner on March 26, 2005 at 17:40:40 Pacific Time
- Voltage versus current as the control
You must be logged in to reply.
I really like the power efficiency of this design which comes from chosing the LED Vf as the circuit voltage. However, since brightness is based on current and current is exponentially tied to voltage, I wonder about consistency between the LED's.
Specifically, if the Vf between a couple LED's differs by just a few tenths of volts, that will cause a change in the current of several mA. The eye sees brighness logarithmically, so perhaps the error is not so noticeable. Alternatively, I suppose judicious use of series resistors could balance things out a bit.
=Omni
Posted by omni on May 09, 2005 at 12:00:23 Pacific Time
- Cool simple algorithm to control LED brightness
You must be logged in to reply.
A while back, I read about very simple/efficient algorithm for controlling the brightness of LEDs called Bit Angle Modulation.
You can read more about it on page 8 of this PDF:
http://www.artisticlicence.com/app%20notes/appnote011.pdf
In short, It produces Less flicker, Very low CPU overhead compared with the common PWM method and it should save on battery life as well (fewer 74HC595 updates per second)
-Dan G.Posted by d.gendreau on May 16, 2005 at 13:19:14 Pacific Time
- The parts list for this is all SMD
You must be logged in to reply.
How is a hobbyist to build something like this when everything is surface mount? MAKE needs to have some better explainations on how to build SMD circuits, and not just give out a laundry list.Posted by dante_mw on June 01, 2005 at 10:45:42 Pacific Time
- bummer
You must be logged in to reply.
as someone with electronics experience, I can honestly say that this article is essentially useless to all but seasoned electronics folks unless it includes a schematic and wiring diagram. a skill-level rating would be also be useful for projects at this level so that the poor newbies out there don't spend hours beating their heads into a brick wall and end up hating your magazine for making them feel stupid.
:)Posted by juusan on July 17, 2005 at 13:43:13 Pacific Time
You must be logged in to reply.
perhaps an addendum to the article can be posted to include information to help the less experienced but equally enthusiastic?Posted by juusan on July 17, 2005 at 13:44:27 Pacific Time
You must be logged in to reply.
Is there any chance of a kit for this?
Or even ready made ones?
Without the schematic and circuit board, it's kinda hard to build.Posted by DavidMcC on July 26, 2005 at 06:05:41 Pacific Time
- Current Mirror LED Driver
You must be logged in to reply.
One of these two chips from TI might make the LED output easier to get consistent: TLC5922 or TLC5940. You can tweak the brightness of each LED independently via the serial interface.
Since the LEDs are controlled by a serial interface it might also be possible to use one of the 8 pin PIC parts so the overall design could be kept small.
I didn't look at the power budget implications but I doubt it would be much worse (and may be better) because you can remove a bunch of the LED voltage regulation parts.
Posted by mjm28 on July 27, 2005 at 13:28:44 Pacific Time
- New parts list
You must be logged in to reply.
Here's what I think is a new up to date list of parts. I am not an engineer. The total is $60. That includes $20.64 for 8 rgb leds. Red leds are also included.
3 P8045SCT-ND $3.33
1 PIC16LF876A-I/SS-ND $8.23
10 399-1100-1-ND $0.20
10 311-1.0KGRCT-ND $0.70
11 X928CT-ND $7.26
1 308-1509-1-ND $1.42
10 311-47KGRCT-ND $0.70
2 399-3756-1-ND $0.86
10 311-80.6KHRCT-ND $0.77
10 311-100KGRCT-ND $0.70
10 311-200GRCT-ND $0.70
10 311-221KHRCT-ND $0.77
10 311-240KHRCT-ND $0.77
1 BC2AAAW-ND $0.67
1 HR2014-ND $0.87
10 743C083181JPCT-ND $1.61
16 160-1436-1-ND $1.78
8 67-1820-1-ND $20.64
3 MA3J70000LCT-ND $1.62
1 MAX1676EUB+-ND $5.43
4 MM74HC595M-ND $2.00Posted by markl81 on July 30, 2007 at 16:44:43 Pacific Time
- Readers may also be interested in...
You must be logged in to reply.
http://usb.brando.com.hk/prod_detail.php?prod_id=00456Posted by enliteneer on March 18, 2008 at 11:49:02 Pacific Time
|
Showing messages 1 through 12 of 12. |
Join the conversation -- every MAKE article has an online page that includes a place for discussion. We've made these RSS and Atom feeds to help you watch the discussions: subscribe.










