Monday, June 26, 2017

Fourth of July Lights


With my grandchildren coming for the Fourth of July, I went looking for projects to do. This is one, thanks to John Wargo--original and Fourth of July Version.

I made slight modifications to the Fourth of July version, using a Trinket instead of the Pro Trinket, because I had some of the smaller ones inventory. I also decided to leave off the LiPo charging backpack,  used a pushbutton switch, and used perf board for tidiness.

I used John Wargo's code almost exactly. The only difference is that he used pins 9, 10, and 11 but the Trinket does not have those pins.  Only pins 0, 1, and 4 on the Trinket handle PWM, so I replaced the array provided in the code "int ledPins[] = { 9, 10, 11 };" with "int ledPins[] = { 0, 1, 4 };".

Fritzing Diagram of Circuit

Construction

Parts (references to Radio Shack are good as of writing--no guarantee how long they will last)
  • Adafruit Trinket 3V
  • pushbutton switch (example--any SPST switch will do)
  • Radio Shack Dual Proto Board (or any perf board)
  • Wire Light LED Strands (1 each red, white, and blue)
  • 47 Ohm Resistors (3)
  • JST-PH Breakout Board
  • 1 Quart Ball Mason Jar (any jar with a lid will do--this size works well)
  • Wire Light LED Strands: Red, White, and Blue (note that these are NOT what's shown in the Fritzing diagram--I used the closest image they had in the parts bin).
  • 47 Ohm Resistors (3, one for each LED strand): see Adafruit descriptions of the lights, above--no resistor is needed with coin cells, but " If you want to use a 4.5V power supply, use 20-220 ohms (or larger)"--so I chose 47 for the 3,3V Trinket (having noticed how much brighter the LEDs were off the Trinket vs. off the CR2032s with no current-limiting resistor).
  • Tinned copper bus wire  and hookup wire-- like this, for example--depending on distances and how much insulation you need
  • Gaffer Tape
  • 500 mAh LiPo battery
  • JST-RCY cable Note:  the battery I used (see link above) has a JST-RCY connector and the JST breakout board has a JST-PH connector, I needed this cable and the next to use it. If yours has a different connector, you may not need these at all,  or you may need something instead of the -RCY cable. The 100mAh version shown in the Fritzing diagram, and most (or all) of Adafruit's LiPos, have JST-PH connectors, making all this unnecessary. I could have just cut the -RCY connector off and spliced on the -PH cable, but that was too permanent for me...and now I have a useful -RCY to -PH adapter.
  • JST-PH 2-pin Cable
Tools
  • Drill (I used my drill press--you just need a way to drill holes)
  • Step Bit (I needed ~16mm for my switch--different switches will have different requirements)
  • Wire tools: strippers, flush cutters, etc.
  • Normal soldering equipment: iron, sucker, helping hands, etc.
Process

The bulk of the time was spent in design--mostly how to fit everything where I wanted.  The mason jar lid cramped my style. Even thought the Trinket is small, it took some maneuvering to get the perf board, theTrinket, and the JST breakout next to the whole I drilled.
  1. I laid out the space requirements on the inside of the lid, then cut the perf board to size and experimented with positioning until I was no unhappy
  2. I drilled the hole in the lid for the switch
  3. I made the RCY to PH JST cable to connect the battery: I just soldered the 2 together and heat shrinked
  4. The LED strands referenced above come with coin cell battery holders. I needed to cut the leads from the battery holders to use them, taking care to note which lead is positive (mine had white markings on the + lead, but I tested it to be sure and marked each with red and black Sharpies).
  5. Wire it up
  6. Test and correct as necessary.
  7. Solder.
    I used tinned copper bus wire to make a ground bus down one side of the perf board, fed by the negative pin on the JST-PH breakout.
    To that, I soldered the GND pin on the Trinket and the negative leads of all 3 LED strands.
    I soldered one resistor to each positive LED lead and heat shrinked it for insulation, then soldered the other leads of the resistors to the proper Trinket pins. 
  8. I used gaffer tape to secure the circuit to the lid and the battery to the jar

Video






No comments:

Post a Comment