# Bedazzler

## Overview

# DIY non-lethal weaponry
![](https://cdn-learn.adafruit.com/assets/assets/000/007/375/medium800/projects_26996819_640.jpg?1396850609)

Our first open source Homeland Security non-lethal weapon project - The "THE BEDAZZLER: A Do-it-yourself Handheld LED-Incapacitator".

After attending a conference where the $1 million "sea-sick flashlight" (named "THE DAZZLER") was demonstrated by the US Dept. of Homeland Security, we decided to create our own version.[For under $250, you can build your own dazzler](http://learn.adafruit.com/bedazzler/design) and [we've released the source code, schematics and PCB files](http://learn.adafruit.com/bedazzler/download) to make it easy. A great Arduino project for people who _really_ like blinking LEDs. We also added in a mode selection so you can put it into some pretty color-swirl modes, great for raves and parties!

http://www.youtube.com/watch?v=qE-I2VMGOJA

Yes this project does indeed cause: <u>Nausea, dizziness, headache, flashblindness, eye pain and (occasional?) vomiting! So don't use it on your friends or pets</u>

**Please note: This is not a kit, nor for sale...so don't ask us.** All documentation is on the [design](http://learn.adafruit.com/bedazzler/design) and [download](http://learn.adafruit.com/bedazzler/download) pages

[Mad props to Scott Johnston for LED assistance](http://www.scottosphere.com/). Sk0t r0x!

  
# Bedazzler

## Design

## Introduction

This project isn't a kit (and won't ever be) so the instructions are more laissez-faire, with many opportunities for the maker to change elements or modify the design. Take it more as a guideline (and use common sense) than a rigorous step-by-step!

## Parts list

To make this project you'll need:

- 36 or 37 1+ Watt LEDs. there are 2 Watt LEDs that are now easily available. For color versatility you can use 12 each of red green and blue. Or you can go with 18 each of green/blue for more effective dazzling. These range around $3 each. Look on eBay or other closeouts to get slightly-older LEDs for less. We used some older [Cree XLamp XR-E 7090](http://www.cree.com/Products/xlamp7090_xre.asp)
- You'll also need lenses/optics for each LED. Go with narrow-beam lenses, about 20mm diameter. 6 or 5 degree will be most effective. ([Like this, but make sure you get ones that match your LED](http://www.digikey.com/product-detail/en/FA10653_LC1-RS/711-1047-ND/1971701?cur=USD))
- Balancing resistors, one for each LED. I used 1.0 ohm 1210's
- For red LEDs (and maybe green/blue depending on your power supply) you may need a choke resistor 0.5 ohm at 5W may be OK. The internal resistance of the battery and Rds of the FET will make a difference, so do math and measurements!
- [6" diameter LED plate, see the downloads page for layout](http://learn.adafruit.com/bedazzler/download). This holes the LEDs and lenses. In theory a aluminum core LED is helpful but we found that for quick blasting, FR4 with copper fill worked just fine.
- 16 or 18 gauge wire for connecting things up
- 6 N Channel logic level power MOSFETs. We used [FDP6030BLs](http://mouser.com/ProductDetail/Fairchild-Semiconductor/FDP6030BL/?qs=sGAEpiMZZMveMCOqFR6qCKWVpUaydojUBNnItU5lv%252bY%3d). Nearly anything that can sink 2A is just fine.
- [Arduino](http://www.arduino.cc/) or other microcontroller. [The AVR atmegax8](http://mouser.com/ProductDetail/Atmel/ATMEGA168P-20PU/?qs=sGAEpiMZZMvu0Nwh4cA1wS4DtiyEwEQuGtI4V%2fIS6oc%3d)series such as found in the arduino is handy because it has 6 hardware PWMs. We used a [DC boarduino](http://www.adafruit.com/index.php?main_page=index&cPath=19) and attached an FTDI cable to upload the firmware
- Battery capable of sourcing 4A at 4V+. 3 D cells or a lead acid is a good choice. We used a 4A 6V SLA that came with the lantern
- Heatsink. A spare AMD processor heatsink and fan worked nicely and was free!
- [9V battery + holder with switch for the arduino,](http://www.adafruit.com/index.php?main_page=product_info&cPath=18&products_id=67) seperate supplies prevent noise issues when driving such large loads
- Enclosure. We repurposed[a cheap yet enormous flashlight from Sears](http://www.dorcy.com/products.aspx?p=411088). It was pricey at $40 but had the benefit of including a lead acid battery (which would have run almost $20 with shipping) and a basic lead acid charger.
- Power supply for testing, [a ATX power supply is a good way to generate 5A+ at 5V](http://www.instructables.com/id/ATX--%3E-Lab-Bench-Power-Supply-Conversion/)

## Make your own

You'll want to start by getting an LED plate fabbed at your favorite PCB manufacturer and acquiring all the materials necessary.

![](https://cdn-learn.adafruit.com/assets/assets/000/007/293/medium800/projects_layout.gif?1448057700)

Start by soldering in one color of LEDs (in the photo there are a few LEDs soldered in from other strings. Go with green to start.![](https://cdn-learn.adafruit.com/assets/assets/000/007/294/medium800/projects_cree1.jpg?1396849476)

You'll want a nice powerful soldering iron, use leaded solder since its hard enough to solder to the copper plane!![](https://cdn-learn.adafruit.com/assets/assets/000/007/295/medium800/projects_cree2.jpg?1396849486)

Use 1 ohm (or so) 1210's for the balancing resistors.![](https://cdn-learn.adafruit.com/assets/assets/000/007/296/medium800/projects_cree3.jpg?1396849501)

For testing you'll want a benchtop supply, or use an ATX power supply with a jumper between the green power line and ground.![](https://cdn-learn.adafruit.com/assets/assets/000/007/297/medium800/projects_psup.jpg?1396849510)

Test the LEDs to make sure you put them in the right place. Each 'string' is 6 LEDs.![](https://cdn-learn.adafruit.com/assets/assets/000/007/298/medium800/projects_test.jpg?1396849522)

Solder in all the green LEDs.![](https://cdn-learn.adafruit.com/assets/assets/000/007/299/medium800/projects_solderled.jpg?1396849533)

![](https://cdn-learn.adafruit.com/assets/assets/000/007/300/medium800/projects_allgreens.jpg?1396849547)

Once you have a single color in place, you'll want to build the controller. I used a boarduino (Arduino clone) but any microcontroller is fine. Wire up the power FETs so that the gates are connected to the hardware PWM outputs, and the sources to ground.![](https://cdn-learn.adafruit.com/assets/assets/000/007/301/medium800/projects_arduinopowered.jpg?1396849567)

![](https://cdn-learn.adafruit.com/assets/assets/000/007/302/medium800/projects_arddiagram.gif?1448057693)

To make traces on perfboard high-current-capacity you can use a 20 gauge wire as a backing and solder on top to make a path.![](https://cdn-learn.adafruit.com/assets/assets/000/007/303/medium800/projects_layingtraces.jpg?1396849601)

Which you can sort of see here![](https://cdn-learn.adafruit.com/assets/assets/000/007/304/medium800/projects_backtraces.jpg?1396849615)

You don't have to wire up all the FETs now, start with one. We used 5.08mm (0.2") terminal blocks to make wiring easy.![](https://cdn-learn.adafruit.com/assets/assets/000/007/305/medium800/projects_fets.jpg?1396849628)

Do lots of testing and be careful to connect power up properly since there are no protection diodes.![](https://cdn-learn.adafruit.com/assets/assets/000/007/306/medium800/projects_testbench_t.jpg?1396849639)

You can load some PWM testing firmware onto the microcontroller to check the LEDs as you work.![](https://cdn-learn.adafruit.com/assets/assets/000/007/307/medium800/projects_bluegreentest.jpg?1396849653)

Complete soldering in all the LEDs![](https://cdn-learn.adafruit.com/assets/assets/000/007/308/medium800/projects_allleds.jpg?1396849668)

A final test PWMing through all the LEDs. It heats up fast so keep the max power low and/or don't run it more than half a minute.![](https://cdn-learn.adafruit.com/assets/assets/000/007/309/medium800/projects_allledtest.jpg?1396849679)

Since we were too cheap to get a proper metal PCB, we'll be attaching a heatsink to the outside. While far from ideal, a spare AMD processor heatsink worked just fine. Remove the fan, take off the metal clip and then reattach the fan. Check the fan to see if it will run off of 9V. Ours did OK.![](https://cdn-learn.adafruit.com/assets/assets/000/007/310/medium800/projects_heatsink.jpg?1396849693)

If you have thermal paste, spread some on the heatink. If you didn't tent the vias, use kapton tappe or similar to prevent them from shorting to the heatsink.![](https://cdn-learn.adafruit.com/assets/assets/000/007/311/medium800/projects_heatsinkattach.jpg?1396849706)

Next up is the enclosure. We found the [Dorcy 41-1088](http://www.dorcy.com/products.aspx?p=411088) lantern at Sears for about $40. It's very close to the right size so we went with it.

![](https://cdn-learn.adafruit.com/assets/assets/000/007/312/medium800/projects_41_1088_1.jpg?1396849716)

It looks like this.![](https://cdn-learn.adafruit.com/assets/assets/000/007/313/medium800/projects_dorcy.jpg?1396849728)

![](https://cdn-learn.adafruit.com/assets/assets/000/007/314/medium800/projects_dorcyfront.jpg?1396849744)

Open up the bottom to reveal a 6V, 4A sealed lead acid battery. This battery works pretty well. There's enough internal resistance that when the LEDs are on, the voltage out drops to 4V which is rather convenient.

![](https://cdn-learn.adafruit.com/assets/assets/000/007/315/medium800/projects_sla_t.jpg?1396849754)

It comes with a charger but putting it on a 7V benchtop supply will charge it much faster (about 4 hours instead of 20).![](https://cdn-learn.adafruit.com/assets/assets/000/007/316/medium800/projects_slacharge.jpg?1396849764)

Test the circuit with the heatsink and fan activated.![](https://cdn-learn.adafruit.com/assets/assets/000/007/317/medium800/projects_psuptest.jpg?1396849778)

Then try it with the battery as the power supply.![](https://cdn-learn.adafruit.com/assets/assets/000/007/318/medium800/projects_slatest.jpg?1396849793)

Check the temperature of the LEDs, we didn't get above 58 degrees C which is pretty good.

![](https://cdn-learn.adafruit.com/assets/assets/000/007/319/medium800/projects_temptest.jpg?1396849804)

Open up the rest of the lantern and remove the reflector and halogen bulb.![](https://cdn-learn.adafruit.com/assets/assets/000/007/320/medium800/projects_dorcysplit.jpg?1396849818)

Reassemble the body.![](https://cdn-learn.adafruit.com/assets/assets/000/007/321/medium800/projects_wireup.jpg?1396849829)

![](https://cdn-learn.adafruit.com/assets/assets/000/007/322/medium800/projects_wireup2.jpg?1396849849)

Extend the power lines and wire them to the main control PCB.![](https://cdn-learn.adafruit.com/assets/assets/000/007/323/medium800/projects_connect.jpg?1396849865)

The PCB is cut down and tucked into the slot behind where the reflector went.![](https://cdn-learn.adafruit.com/assets/assets/000/007/324/medium800/projects_pcbplace.jpg?1396849878)

The plate sits in front, sadly it's just slightly too small to go into the enclosure. However, this way there is more space for the heat sink.![](https://cdn-learn.adafruit.com/assets/assets/000/007/325/medium800/projects_platealign.jpg?1396849892)

Lenses are snapped onto the LEDs. I used superglue to tack them down. This is a major mistake so don't do what I did because then the fume damage the lenses and they need to be cleaned. There's probably a better glue to use. Perhaps epoxy?![](https://cdn-learn.adafruit.com/assets/assets/000/007/326/medium800/projects_lenses.jpg?1396849904)

A 9V battery is wired up to the arduino. All the lenses are put on.![](https://cdn-learn.adafruit.com/assets/assets/000/007/327/medium800/projects_alllens.jpg?1396849918)

We cut out a simple lens protector from acrylic on our laser cutter.

![](https://cdn-learn.adafruit.com/assets/assets/000/007/328/medium800/projects_protector.jpg?1396849930)

Showing the fit before we finish.![](https://cdn-learn.adafruit.com/assets/assets/000/007/329/medium800/projects_9v.jpg?1396849943)

With some gaff or packing tape to attach the lens protector, we're done!![](https://cdn-learn.adafruit.com/assets/assets/000/007/330/medium800/projects_complete.jpg?1396849955)

![](https://cdn-learn.adafruit.com/assets/assets/000/007/331/medium800/projects_complete2.jpg?1396849968)

# Bedazzler

## Download

## Hardware files
This is all public domain, so enjoy!
- [Schematic for LED plate in PNG format](http://learn.adafruit.com/system/assets/assets/000/010/203/original/bedazzleschem_v1.png "Link: http://learn.adafruit.com/system/assets/assets/000/010/203/original/bedazzleschem\_v1.png")
- [Schematic](http://learn.adafruit.com/system/assets/assets/000/010/204/original/bedazzler_v1.sch) and [layout](http://learn.adafruit.com/system/assets/assets/000/010/205/original/bedazzler_v1.brd) for LED plate in EagleCAD format

The LEDs originally used are CREE Xlamp 7090 but any 1+ Watt LEDs work OK. The balancing resistors are about 1 ohm, but can be adjusted. Use 2 sets of 6 LEDs for full tri-color (more versatile). Or 3 sets of 6 LEDs for green/blue only (more effective).

The arduino (or compatible) is hooked up to the LEDs via logic-level N-channel FETs. The diagram shows 2 groups of 3 colors but can be easily changed for 2 colors. If red LEDs are used, a 0.5 ohm, 5W led should be placed in series with the wire to the LED plate.

  
![](https://cdn-learn.adafruit.com/assets/assets/000/007/332/medium800/projects_arddiagram.gif?1448057686)

## Code
```
// Bedazzler! A good multiple LED PWM project, by Limor Fried
// Public domain 2009

#include &lt;util/delay.h&gt;
int value;
int redpin1 = 5, redpin2 = 6;                           
int greenpin1 = 3, greenpin2 = 11;                           
int bluepin1 = 9, bluepin2 = 10;                           

int ledmax;

#define GLITTER 0
#define SWIRL 1
#define DAZZLE 2

volatile int mode = DAZZLE;

// we use a button on pin 2 (interrupt pin) to detect mode changes
void modechange(void)
{
  // debounce it
  if (digitalRead(2) == LOW) {
   _delay_ms(10);
   if (digitalRead(2) != LOW)
        return;
   Serial.println("button");
   mode++;
   if (mode &gt; 2)
     mode = 0;
  Serial.print("new mode! ");
  Serial.println(mode, DEC);
  
  }
}

void setup() 
{ 
  pinMode(2, INPUT);
  digitalWrite(2, HIGH);   // pullup on mode button
  attachInterrupt(0, modechange, CHANGE);
  
  Serial.begin(9600);
  
  randomSeed(analogRead(0));


  // nothing for setup 
    analogWrite(redpin1, 0);
    analogWrite(redpin2, 0);
    analogWrite(greenpin1, 0);
    analogWrite(greenpin2, 0);
    analogWrite(bluepin1, 0);
    analogWrite(bluepin2, 0);
    
    ledmax = 250; // change this value to adjust the maximum brightness
}

void loop() 
{ 
  switch(mode) {
    case SWIRL:
      //Serial.println("swirl");
      ckswirl(ledmax, 10);
      break;
    case GLITTER:
      //Serial.println("glimmer");
      glimmertest(ledmax, ledmax/10, 30); 
      break;
    case DAZZLE:
      //Serial.println("dazzle");
      bedazzle(ledmax, 10, 7, 11); 
      break;
  }
   
}

void bedazzle(int ledmax, int pulselensec, int freqmin, int freqmax) {
  long pulses;
  
  
  analogWrite(redpin1, 0);
  analogWrite(redpin2, 0);
  analogWrite(greenpin1, 0);
  analogWrite(greenpin2, 0);
  analogWrite(bluepin1, 0);
  analogWrite(bluepin2, 0);
  
  // note we dont use red LEDs in this
  int freq = random(freqmin, freqmax+1);
  int pulsedelay = 1000/freq;
  pulsedelay /= 2;
  
  pulses = pulselensec;
  pulses *= 1000;
  pulses /= 2*pulsedelay;

  /*
  Serial.print("pulsing at ");
  Serial.print(freq, DEC);
  Serial.print(" Hz (");
  Serial.print(pulsedelay, DEC);
  Serial.println(" ms on/off)");
  Serial.print(pulses);
  Serial.println(" pulses");
*/

  while (pulses--) {
    analogWrite(greenpin1, ledmax);
    analogWrite(greenpin2, ledmax);
    analogWrite(bluepin1, ledmax);
    analogWrite(bluepin2, ledmax);
    _delay_ms(pulsedelay);
    analogWrite(greenpin1, 0);
    analogWrite(greenpin2, 0);
    analogWrite(bluepin1, 0);
    analogWrite(bluepin2, 0);
    _delay_ms(pulsedelay); 
   if (mode != DAZZLE) return; 
  }
  
}


void ckswirl(int ledmax, uint8_t z) {
  int r, g, b;
  

  // fade from red to orange to yellow to green
  for (g=0; g&lt;255; g++) { // turn red down
    analogWrite(redpin1, ledmax-g); 
    analogWrite(redpin2, ledmax-g);
    analogWrite(greenpin1, g);           // sets the value (range from 0 to 255) 
    analogWrite(greenpin2, g);           // sets the value (range from 0 to 255) 
    delay(z);
    
    if (mode != SWIRL) return;
  }
  // fade from green to blue
  for (b=0; b&lt;255; b++) { // turn red down
    analogWrite(bluepin1, b); 
    analogWrite(bluepin2, b);
    analogWrite(greenpin1, ledmax-b);           // sets the value (range from 0 to 255) 
    analogWrite(greenpin2,  ledmax-b);           // sets the value (range from 0 to 255) 
    delay(z);

    if (mode != SWIRL) return;
  }
  // from blue to red
  for (r=0; r&lt;255; r++) { // turn red down
    analogWrite(redpin1, r); 
    analogWrite(redpin2, r);
    analogWrite(bluepin1, ledmax-r);           // sets the value (range from 0 to 255) 
    analogWrite(bluepin2,  ledmax-r);           // sets the value (range from 0 to 255) 
    delay(z);

    if (mode != SWIRL) return;
  }
}

void glimmertest(int maxvalue, int incr, int z) {
  
   for(value = 0 ; value &lt;= maxvalue; value+=incr) 
  { 
    analogWrite(greenpin1, value);           // sets the value (range from 0 to 255) 
    analogWrite(greenpin2,  maxvalue-value);           // sets the value (range from 0 to 255) 
    analogWrite(bluepin1, value); 
    analogWrite(bluepin2,  maxvalue-value);           // sets the value (range from 0 to 255) 
    analogWrite(redpin1, value); 
    analogWrite(redpin2, maxvalue-value);           // sets the value (range from 0 to 255) 
    delay(z);                            // waits for 30 milli seconds to see the dimming effect 

    if (mode != GLITTER) return;
  } 
  for(value =  maxvalue; value &gt;=0; value-=incr)   // fade out (from max to min) 
  { 
    analogWrite(greenpin1, value); 
    analogWrite(greenpin2 , maxvalue-value);           // sets the value (range from 0 to 255) 
    analogWrite(bluepin1, value); 
    analogWrite(bluepin2,  maxvalue-value);           // sets the value (range from 0 to 255) 
    analogWrite(redpin1, value); 
    analogWrite(redpin2,  maxvalue-value);           // sets the value (range from 0 to 255) 
    delay(z); 

    if (mode != GLITTER) return;
  }  
}

```


## Featured Products

### N-channel power MOSFET

[N-channel power MOSFET](https://www.adafruit.com/product/355)
When you need to switch a lot of power, N-channel MOSFETs are best for the job. These FETs can switch over 60A and 30V and are TO-220 packages so they fit nicely into any breadboard or perfboard. Heat sinking is easy with TO-220's, but because of the very low Rds(on) of down to 0.009 ohms...

In Stock
[Buy Now](https://www.adafruit.com/product/355)
[Related Guides to the Product](https://learn.adafruit.com/products/355/guides)
### 1 Watt Cool White LED - Heatsink Mounted

[1 Watt Cool White LED - Heatsink Mounted](https://www.adafruit.com/product/518)
Make a 1 Watt flashlight or a headlamp with this ultra-bright LED. The LED is very bright, with 90 Lumens in a 140 degree lambertian pattern. Compared to most LEDs, you would say this is 30,000 millicandela. Either way, its incredibly bright! The output is a 'cool' 6000K pure white,...

In Stock
[Buy Now](https://www.adafruit.com/product/518)
[Related Guides to the Product](https://learn.adafruit.com/products/518/guides)
### DC Boarduino (Arduino compatible) Kit (w/ATmega328)

[DC Boarduino (Arduino compatible) Kit (w/ATmega328)](https://www.adafruit.com/product/72)
If you've ever struggled to use a solderless breadboard with an Arduino, you understand how frustrating it can be!

This clone acts just like an Arduino, and works with the latest Arduino software. For many projects it can even be preferable! The kit includes all parts necessary, the...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/72)
[Related Guides to the Product](https://learn.adafruit.com/products/72/guides)
### 9V battery holder with switch &  5.5mm/2.1mm plug

[9V battery holder with switch &  5.5mm/2.1mm plug](https://www.adafruit.com/product/67)
This is a 9V battery pack with on/off switch and a pre-attached 5.5mm/2.1mm center-positive barrel plug. Use this to battery-power your Arduino (or other electronic projects) - it's ready to go out of the box!

Battery & screw not included.

![]()

In Stock
[Buy Now](https://www.adafruit.com/product/67)
[Related Guides to the Product](https://learn.adafruit.com/products/67/guides)

## Related Guides

- [Adafruit LED Sequins](https://learn.adafruit.com/adafruit-led-sequins.md)
- [Fiber Optic Pixie Skirt](https://learn.adafruit.com/fiber-optic-pixie-princess-skirt.md)
- [Pokemon Potion USB Battery Pack](https://learn.adafruit.com/pokemon-potion-usb-battery-pack.md)
- [Overwatch Prop Gun: Lucio's Blaster Pt. 2](https://learn.adafruit.com/overwatch-lucio-gun-pt-2.md)
- [3D Printed Custom Keycaps](https://learn.adafruit.com/3dprinted-custom-keycaps.md)
- [STEAM-Punk Goggles](https://learn.adafruit.com/steam-punk-goggles.md)
- [Bluetooth TV Zapper](https://learn.adafruit.com/bluetooth-tv-zapper.md)
- [Glowing LED Chair](https://learn.adafruit.com/glowing-led-chair.md)
- [Festive Feather Holiday Lights](https://learn.adafruit.com/festive-feather-holiday-lights.md)
- [LCARS-inspired Circuit Board Panel](https://learn.adafruit.com/lcars-inspired-circuit-board-panel.md)
- [Arduino GPS Clock](https://learn.adafruit.com/arduino-clock.md)
- [NeoPixel Ring Lamp](https://learn.adafruit.com/neopixel-ring-lamp.md)
- [Deluxe 4x4 NeoPixel Keypad](https://learn.adafruit.com/deluxe-4x4-neopixel-neokey-keypad.md)
- [Guardian Robot with LEDs](https://learn.adafruit.com/guardian-robot-with-leds.md)
- [Magical Mistletoe](https://learn.adafruit.com/magical-mistletoe.md)
