You are on page 1of 29

instructables

How to Make a Lightning Cloud

by molecule13

I really wanted to make a little cloud that would light This is the first of three steps. The second part of this
up as though it was filled with lightning. After googling project will be adding bluetooth control, so I can
a bit, I stumbled upon "The Cloud" by Richard Clarks trigger weather patterns in the cloud via my phone.
on. It's a beautifully executed concept and I wanted to The third part will be automatically triggering weather
see if I could make one too. There are lotsofexamples patterns according to the day's weather report. I want
of "cloud lamps." What I like about mine is I built the an easy-to-use, "glanceable," aesthetically appealing
shape of the cloud completely from scratch, so I weather indicator for my apartment. Plus I've heard
wasn't left with a mostly round cloud (a common cloud computing is the hot new thing.... :)
problem). I'm also really proud of the lightning
animation I created. Stay tuned for those future Instructables!

https://www.youtube.com/watch?v=XxMMNcU-hWE

How to Make a Lightning Cloud: Page 1


Step 1: Gather Materials

1. Cardboard know if it was the right thickness. If you go to a fabric


store, they'll let you cut a smaller amount. It should be
2. Cotton balls about $6.99 per yard. I used about 2 square feet.

3. Polyester batting, 3/4" thick. It's easiest to pick out 4. Boning (like the kind used for corsets). I used a
batting by going to a fabric store in person to find the yard and could have found use for more.
right kind. You want batting that's about an inch thick.
Something like this, but I'd need to see it in person to 5. Needle and thread

6. Hot glue gun with the little battery backpack soldered on)

7. Adafruit Neopixel LEDs. I used these "Breadboard 11. Sewing pins


friendly" ones. You can also buy them in packs of 4.
12. (Optional) a "large" capacitor. I follow the best pra
8. Wire ctices recommended by Adafruit and used a 1000uf,
6.3V capacitor.
9. Soldering iron

10. Microcontroller (I used an Adafruit Pro Trinket

1
5 3
2 4

2 1 5
4
3

1. undefined 1. Neopixel LED


2. Boning 2. Male-male jumper wires
3. Cottonballs 3. Sewing pins
4. Batting 4. Pro Trinket microcontroller with LiIon battery backpack
5. Cardboard 5. Needle and thread

How to Make a Lightning Cloud: Page 2


Step 2: Build Cloud Structure

Using a piece of cardboard for the base, glue the how many lumps you want your cloud to have, and
boning to make the basic outline of your cloud. You the overall structure. You can augment later with
can make hoops with the boning - I found it was cotton balls, but this part will define the overall shape
easiest to sew the two ends of the boning together, of your cloud.
and then glue the hoop directly onto the cardboard. I
also tried leaving one piece of boning pointing out into Be sure to leave a little door in half of the cloud,
the air like ribs. Both methods worked fine. where you'll place the electronics. Make the part of
the batting that will become the door a little thicker
Rip your 3/4" batting in half, and hot glue it to the than you might otherwise. It's nice to have the extra
boning and the cardboard in tasteful, cloud-like folds. support.
At some points, it will be easier to gently sew the
batting to the boning to keep it in place. Keep in mind

How to Make a Lightning Cloud: Page 3


Step 3: Add Fluff Texture

Gently pull apart your cottonballs. I pulled apart about Drip hot glue directly onto the outside of the batting,
30 while my hot glue gun was heating up. The and gently pat your cottonballs into place. You don't
cottonballs themselves have a bit of a circular need to completely cover the batting. Since the
structure to them, and if you tear them apart carefully batting is white and a little fluffy, if some is showing
you'll preserve some of those whorls, which looks that's ok. I preferred to vary the amount of cottonballs
really cool later when the light shines through. You I was using so the cloud would be differing densities -
can also unroll cottonballs so they'll make longer, it's nice if the light can shine through more in some
stringier clouds if you want. places and less in others.

2
1

1. Unrolled cottonball
2. Unrolled cottonball
3. Pulled apart cottonball

How to Make a Lightning Cloud: Page 4


How to Make a Lightning Cloud: Page 5
Step 4: Add Electronics

First, you'll need to solder your LEDs into a long strand. I usually
take the easiest route of soldering male-male jumper cables directly to the Neopixels. The wires are flexible, the
connections are solid, and it's super fast and easy. No need to strip any wires! Test your connections as you go,
so you can quickly fix any issues. The basic circuit for this project is very simple. I'm building mine on a
breadboard for now, but for a more permanent project, you'll probably want to solder things together directly, or
maybe use a little proto board. With only 5 LEDs, you probably don't need a capacitor, but I always throw one in
anyway to be safe. The polarity of a capacitor matters. That means you need to plug it in correctly for it to work.
There are several ways to recognize the polarity of your capacitor.

Look at the legs


Most capacitors will have legs with different lengths. The short leg is the negative side.

Look for a stripe or an arrow.


Most capacitors will have a light stripe down one side. That's the negative side of the
capacitor

The negative side should be connected to GND. The other side attaches to PWR.

Connect power, ground, and signal from your microcontroller to your LED strand:

Arduino -------> Neopixel strand pin

#4 -------> Data Input pin

BAT+ --------> VIN

GND ---------> GND

As always, if you are new to soldering, I highly recommend Adafruit's Guide to Excellent Soldering.

How to Make a Lightning Cloud: Page 6


Step 5: Upload the Code

Getting accurate lightning animation was super match your setup:


important to me for this project. I played around with
lots of ideas before going with hand-picked data https://github.com/molecule/cloud-lightning/blob/v...
points and a simple moving average smoothing
algorithm. I'm pretty excited about how it turned out! You can also change these variables to make
lightning strikes more or less likely:
https://github.com/molecule/cloud-lightning/tree/v...
https://github.com/molecule/cloud-lightning/blob/v...
You might need to update these two variables to

https://www.youtube.com/watch?v=XxMMNcU-hWE

How to Make a Lightning Cloud: Page 7


https://www.youtube.com/watch?v=3mgXa3nZoHs

Step 6: Put Everything Together

You can try different placements of the LEDs inside I wanted to be able to access the microcontroller, so I
the cloud. I ended up adding some cardboard pieces just temporarily hold the door closed with a pin
on the inside, because I wanted some parts of the through several layers of batting.
cloud to be a bit darker than other parts. I also left the
animation playing for a while, and glued on a few
more cottonballs wherever it felt right.

1. Pin that's holding the door closed

https://www.youtube.com/watch?v=Vh3HVOzsb7M

How to Make a Lightning Cloud: Page 8


Thanks for the advice! The local MicroCenter had a trinket in stock so I didn't have to try to adapt it
to the gemma.

This is a great project that I was able to do in just a couple days (working nights)! I added an
adafruit powerboost and left a little flap of cotton so it can be recharged easily. The powerboost's
indicator light also gives it a low steady glow when the lightning isn't flashing.

Thanks for catching that! I just updated the instructions. I follow the best practices recommended
by Adafruit and used a 1000uf, 6.3V capacitor.
Hello,
First of al thanks for the awesome code! i am making a night lamp for a kid. I am using an encoder
with this. My ultimate goal is to make use of the encoder button to switch between programs and
use the encoder itself to change some things like color, intensity of the light or with this code the
frequency of the strikes! for one reason or another i am able to program the encoder on itself or
ether the neopixels. But together they do not seem to work... Maybe you can assist me in any
way? With this a picture of the project so far!
Kind Regards,
Yyov

I need help getting the program to load to my trinket Pro. I can load the "Blink" but when I try to
load Cloud-Lightning I'm getting an error. "exit status 1 Error compiling for board Pro Trinket
3V/12MHz (USB)
What am I doing wrong?
Hmm, well you're getting a compile error (I can tell because the message you helpfully provided
says "Error compiling for board"). That means that, as the compiler is trying to make the code into
machine-understandable language, something went wrong. To understand what, we need more
information! First, turn on the verbose messages for compiling in your IDE:
File->Preferences->Show verbose output during:. Tick boxes for compilation and upload.
Then try to compile again. You should get a LOT more information, and some of it will be useful :)
In particular, I'm guessing you're missing one of the libraries you need to install (or you didn't
restart the IDE after installing them). But we should be able to tell with more information.
Here is the full verbose compilation Thanks for the Help
Arduino: 1.8.3 (Windows 10), Board: "Pro Trinket
3V/12MHz (USB)"
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs
-logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware
C:\Users\John\AppData\Local\Arduino15\packages -tools C:\Program Files
(x86)\Arduino\tools-builder -tools C:\Program Files
How to Make a Lightning Cloud: Page 9
(x86)\Arduino\hardware\tools\avr -tools C:\Users\John\AppData\Local\Arduino15\packages
-built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries
C:\Users\John\Documents\Arduino\libraries -fqbn=adafruit:avr:protrinket3
-ide-version=10803 -build-path C:\Users\John\AppData\Local\Temp\arduino_build_269669
-warnings=none -build-cache
C:\Users\John\AppData\Local\Temp\arduino_cache_672861
-prefs=build.warn_data_percentage=75
-
prefs=runtime.tools.avrdude.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-
arduino9
-
prefs=runtime.tools.arduinoOTA.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.1
-prefs=runtime.tools.avr-
gcc.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-
atmel3.5.4-arduino2
-verbose C:\Users\John\Desktop\Lightning\cloud-lightning\cloud-lightning.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile
-logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware
C:\Users\John\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-
builder
-tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools
C:\Users\John\AppData\Local\Arduino15\packages -built-in-libraries C:\Program
Files (x86)\Arduino\libraries -libraries
C:\Users\John\Documents\Arduino\libraries -fqbn=adafruit:avr:protrinket3
-ide-version=10803 -build-path
C:\Users\John\AppData\Local\Temp\arduino_build_269669 -warnings=none
-build-cache C:\Users\John\AppData\Local\Temp\arduino_cache_672861
-prefs=build.warn_data_percentage=75 -
prefs=runtime.tools.avrdude.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-
arduino9
-
prefs=runtime.tools.arduinoOTA.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.1
-prefs=runtime.tools.avr-
gcc.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-
atmel3.5.4-arduino2
-verbose C:\Users\John\Desktop\Lightning\cloud-lightning\cloud-lightning.ino
Using board 'protrinket3' from platform in folder:
C:\Users\John\AppData\Local\Arduino15\packages\adafruit\hardware\avr\1.4.9
Using core 'arduino' from platform in folder:
C:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20
Detecting libraries used...
"C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-
arduino2/bin/avr-g++"
-c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections
-fdata-sections -fno-threadsafe-statics
-flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=12000000L -DARDUINO=10803
-DARDUINO_AVR_PROTRINKET3 -DARDUINO_ARCH_AVR
"-IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\cores\arduino"
"-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\variants\eightanaloginputs"
"C:\Users\John\AppData\Local\Temp\arduino_build_269669\sketch\cloud-lightning.ino.cpp"
-o "nul"

How to Make a Lightning Cloud: Page 10


"C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-
arduino2/bin/avr-g++"
-c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections
-fdata-sections -fno-threadsafe-statics
-flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=12000000L
-DARDUINO=10803 -DARDUINO_AVR_PROTRINKET3 -DARDUINO_ARCH_AVR "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\cores\arduino"
"-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\variants\eightanaloginputs"
"C:\Users\John\AppData\Local\Temp\arduino_build_269669\sketch\cloud-lightning.ino.cpp"
-o
"C:\Users\John\AppData\Local\Temp\arduino_build_269669\preproc\ctags_target_for_gcc_minus_e.cpp"
C:\Users\John\Desktop\Lightning\cloud-lightning\cloud-lightning.ino:31:31:
fatal error: Adafruit_NeoPixel.h: No such file or directory
#include
<Adafruit_NeoPixel.h>
^
compilation terminated.
exit status 1
Error compiling for board Pro Trinket 3V/12MHz (USB).
Excellent! This is everything we need to figure this out. Typically, for compile errors, you want to
look at the "first" error. Arduino helpfully puts that at the very end of the compile error, and I've
copied it here for convenience:
fatal error: Adafruit_NeoPixel.h: No such file or directory
That basically means that you haven't installed or successfully set up the Neopixel library! So
Arduino has no idea where that code is. The good news is, it's super easy to fix this. Head on over
to Adafruit's excellent (as always) tutorial on installing the Neopixel library and you should be able
to get past this error! Here's the link:
https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library-installation
Thanks but now I get this error:
Arduino: 1.8.3 (Windows 10), Board: "Pro Trinket 3V/12MHz (USB)"
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware
C:\Program Files (x86)\Arduino\hardware -hardware
C:\Users\John\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-
builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools
C:\Users\John\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files
(x86)\Arduino\libraries -libraries C:\Users\John\Documents\Arduino\libraries -
fqbn=adafruit:avr:protrinket3 -ide-version=10803 -build-path
C:\Users\John\AppData\Local\Temp\arduino_build_745192 -warnings=none -build-cache
C:\Users\John\AppData\Local\Temp\arduino_cache_742529 -
prefs=build.warn_data_percentage=75 -
prefs=runtime.tools.avrdude.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-
arduino9 -
prefs=runtime.tools.arduinoOTA.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.1
-prefs=runtime.tools.avr-
gcc.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-
atmel3.5.4-arduino2 -verbose C:\Program Files (x86)\Arduino\libraries\Cloud-Lightning\cloud-
lightning.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program

How to Make a Lightning Cloud: Page 11


Files (x86)\Arduino\hardware -hardware C:\Users\John\AppData\Local\Arduino15\packages -tools
C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files
(x86)\Arduino\hardware\tools\avr -tools C:\Users\John\AppData\Local\Arduino15\packages -built-
in-libraries C:\Program Files (x86)\Arduino\libraries -libraries
C:\Users\John\Documents\Arduino\libraries -fqbn=adafruit:avr:protrinket3 -ide-version=10803 -
build-path C:\Users\John\AppData\Local\Temp\arduino_build_745192 -warnings=none -build-
cache C:\Users\John\AppData\Local\Temp\arduino_cache_742529 -
prefs=build.warn_data_percentage=75 -
prefs=runtime.tools.avrdude.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-
arduino9 -
prefs=runtime.tools.arduinoOTA.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.1
-prefs=runtime.tools.avr-
gcc.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-
atmel3.5.4-arduino2 -verbose C:\Program Files (x86)\Arduino\libraries\Cloud-Lightning\cloud-
lightning.ino
Using board 'protrinket3' from platform in folder:
C:\Users\John\AppData\Local\Arduino15\packages\adafruit\hardware\avr\1.4.9
Using core 'arduino' from platform in folder:
C:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20
Detecting libraries used...
"C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-
arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -
fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -
DF_CPU=12000000L -DARDUINO=10803 -DARDUINO_AVR_PROTRINKET3 -
DARDUINO_ARCH_AVR "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\cores\arduino" "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\variants\eightanaloginputs"
"C:\Users\John\AppData\Local\Temp\arduino_build_745192\sketch\cloud-lightning.ino.cpp" -o
"nul"
"C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-
arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -
fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -
DF_CPU=12000000L -DARDUINO=10803 -DARDUINO_AVR_PROTRINKET3 -
DARDUINO_ARCH_AVR "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\cores\arduino" "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\variants\eightanaloginputs"
"-IC:\Users\John\Documents\Arduino\libraries\Adafruit_NeoPixel"
"C:\Users\John\AppData\Local\Temp\arduino_build_745192\sketch\cloud-lightning.ino.cpp" -o
"nul"
"C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-
arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -
fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -
DF_CPU=12000000L -DARDUINO=10803 -DARDUINO_AVR_PROTRINKET3 -
DARDUINO_ARCH_AVR "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\cores\arduino" "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\variants\eightanaloginputs"
"-IC:\Users\John\Documents\Arduino\libraries\Adafruit_NeoPixel"
"C:\Users\John\Documents\Arduino\libraries\Adafruit_NeoPixel\Adafruit_NeoPixel.cpp" -o "nul"
"C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-
arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -
fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -
DF_CPU=12000000L -DARDUINO=10803 -DARDUINO_AVR_PROTRINKET3 -
How to Make a Lightning Cloud: Page 12
DARDUINO_ARCH_AVR "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\cores\arduino" "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\variants\eightanaloginputs"
"-IC:\Users\John\Documents\Arduino\libraries\Adafruit_NeoPixel"
"C:\Users\John\Documents\Arduino\libraries\Adafruit_NeoPixel\esp8266.c" -o "nul"
Generating function prototypes...
"C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-
arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -
fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -
DF_CPU=12000000L -DARDUINO=10803 -DARDUINO_AVR_PROTRINKET3 -
DARDUINO_ARCH_AVR "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\cores\arduino" "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\variants\eightanaloginputs"
"-IC:\Users\John\Documents\Arduino\libraries\Adafruit_NeoPixel"
"C:\Users\John\AppData\Local\Temp\arduino_build_745192\sketch\cloud-lightning.ino.cpp" -o
"C:\Users\John\AppData\Local\Temp\arduino_build_745192\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -
f - --c++-kinds=svpf --fields=KSTtzns --line-directives
"C:\Users\John\AppData\Local\Temp\arduino_build_745192\preproc\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-
arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -
fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=12000000L -
DARDUINO=10803 -DARDUINO_AVR_PROTRINKET3 -DARDUINO_ARCH_AVR "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\cores\arduino" "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\variants\eightanaloginputs"
"-IC:\Users\John\Documents\Arduino\libraries\Adafruit_NeoPixel"
"C:\Users\John\AppData\Local\Temp\arduino_build_745192\sketch\cloud-lightning.ino.cpp" -o
"C:\Users\John\AppData\Local\Temp\arduino_build_745192\sketch\cloud-lightning.ino.cpp.o"
C:\Program Files (x86)\Arduino\libraries\Cloud-Lightning\cloud-lightning.ino: In function 'void
setup()':
cloud-lightning:85: error: 'simple_moving_average' was not declared in this scope
functionPtrs[0] = simple_moving_average;
^
cloud-lightning:86: error: 'random_moving_average' was not declared in this scope
functionPtrs[1] = random_moving_average;
^
C:\Program Files (x86)\Arduino\libraries\Cloud-Lightning\cloud-lightning.ino: At global scope:
cloud-lightning:127: error: expected unqualified-id before ')' token
})
^
Using library Adafruit_NeoPixel at version 1.1.2 in folder:
C:\Users\John\Documents\Arduino\libraries\Adafruit_NeoPixel
exit status 1
'simple_moving_average' was not declared in this scope
Invalid library found in C:\Program Files (x86)\Arduino\libraries\Cloud-Lightning: C:\Program Files
(x86)\Arduino\libraries\Cloud-Lightning

How to Make a Lightning Cloud: Page 13


Invalid library found in C:\Program Files (x86)\Arduino\libraries\Cloud-Lightning: C:\Program Files
(x86)\Arduino\libraries\Cloud-Lightning
The three most important errors are shown at the bottom again, just like last time:
C:\Program Files (x86)\Arduino\libraries\Cloud-Lightning\cloud-lightning.ino: In function 'void
setup()':
cloud-lightning:85: error: 'simple_moving_average' was not declared in this scope
functionPtrs[0] = simple_moving_average;
^
cloud-lightning:86: error: 'random_moving_average' was not declared in this scope
functionPtrs[1] = random_moving_average;
^
C:\Program Files (x86)\Arduino\libraries\Cloud-Lightning\cloud-lightning.ino: At global scope:
cloud-lightning:127: error: expected unqualified-id before ')' token
})
Those look.....strange. I encourage you to download the code again from my github account: this
looks like a copy-and-paste problem.
You're also getting complaints from the IDE about your file structure. It looks like you have a folder
called "Cloud-Lightning" in the Arduino/libraries folder. I am assuming Cloud-Lightning refers to the
code for this project, in which case the "libraries" folder is not the right place for it! Move it up one
level so it's just in the "Arduino" folder.
OK I think that the code loaded. It's not turning on the LED. I only have one connected right now.
Two more questions:(for now) How do I know that it loaded correct and if I have the LED
connected to Batt, 0 and Pin 4 is that correct? When "verify code after upload" is turned on I do
see errors.
1. To know that it is uploaded correctly, you should see this message at the bottom of the print outs
of your Arduino IDE: https://www.dropbox.com/s/hs6hnvu6xhmmn0p/Screensh...
If you don't see that confirmation message, you might not have uploaded successfully! But
remember, I can't help you if you don't post the error messages you're getting...so if you want help,
be sure to always include all the information! Also tell me what kind of Arduino board you're using.
2. Check out Step 4 for how to wire everything up! What you have does not sound correct to me.
Here's log log. It looks like it didn't upload clean.
Arduino: 1.8.5 (Windows 10), Board: "Pro Trinket 3V/12MHz (USB)"
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware
C:\Program Files (x86)\Arduino\hardware -hardware
C:\Users\John\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-
builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools
C:\Users\John\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files
(x86)\Arduino\libraries -libraries C:\Users\John\Documents\Arduino\libraries -
fqbn=adafruit:avr:protrinket3 -ide-version=10805 -build-path
C:\Users\John\AppData\Local\Temp\arduino_build_376360 -warnings=none -build-cache
C:\Users\John\AppData\Local\Temp\arduino_cache_619687 -
prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-
gcc.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-
atmel3.5.4-arduino2 -
prefs=runtime.tools.arduinoOTA.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.1

How to Make a Lightning Cloud: Page 14


-
prefs=runtime.tools.avrdude.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-
arduino9 -verbose C:\Users\John\Desktop\cloud-lightning\cloud-lightning.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program
Files (x86)\Arduino\hardware -hardware C:\Users\John\AppData\Local\Arduino15\packages -tools
C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files
(x86)\Arduino\hardware\tools\avr -tools C:\Users\John\AppData\Local\Arduino15\packages -built-
in-libraries C:\Program Files (x86)\Arduino\libraries -libraries
C:\Users\John\Documents\Arduino\libraries -fqbn=adafruit:avr:protrinket3 -ide-version=10805 -
build-path C:\Users\John\AppData\Local\Temp\arduino_build_376360 -warnings=none -build-
cache C:\Users\John\AppData\Local\Temp\arduino_cache_619687 -
prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-
gcc.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-
atmel3.5.4-arduino2 -
prefs=runtime.tools.arduinoOTA.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.1
-
prefs=runtime.tools.avrdude.path=C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-
arduino9 -verbose C:\Users\John\Desktop\cloud-lightning\cloud-lightning.ino
Using board 'protrinket3' from platform in folder:
C:\Users\John\AppData\Local\Arduino15\packages\adafruit\hardware\avr\1.4.9
Using core 'arduino' from platform in folder:
C:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20
Detecting libraries used...
"C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-
arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -
fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -
DF_CPU=12000000L -DARDUINO=10805 -DARDUINO_AVR_PROTRINKET3 -
DARDUINO_ARCH_AVR "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\cores\arduino" "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\variants\eightanaloginputs"
"C:\Users\John\AppData\Local\Temp\arduino_build_376360\sketch\cloud-lightning.ino.cpp" -o
"nul"
"C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-
arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -
fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -
DF_CPU=12000000L -DARDUINO=10805 -DARDUINO_AVR_PROTRINKET3 -
DARDUINO_ARCH_AVR "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\cores\arduino" "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\variants\eightanaloginputs"
"-IC:\Users\John\Documents\Arduino\libraries\Adafruit_NeoPixel"
"C:\Users\John\AppData\Local\Temp\arduino_build_376360\sketch\cloud-lightning.ino.cpp" -o
"nul"
Using cached library dependencies for file:
C:\Users\John\Documents\Arduino\libraries\Adafruit_NeoPixel\Adafruit_NeoPixel.cpp
Using cached library dependencies for file:
C:\Users\John\Documents\Arduino\libraries\Adafruit_NeoPixel\esp8266.c
Generating function prototypes...
"C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-
arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -
fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -
DF_CPU=12000000L -DARDUINO=10805 -DARDUINO_AVR_PROTRINKET3 -
How to Make a Lightning Cloud: Page 15
DARDUINO_ARCH_AVR "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\cores\arduino" "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\variants\eightanaloginputs"
"-IC:\Users\John\Documents\Arduino\libraries\Adafruit_NeoPixel"
"C:\Users\John\AppData\Local\Temp\arduino_build_376360\sketch\cloud-lightning.ino.cpp" -o
"C:\Users\John\AppData\Local\Temp\arduino_build_376360\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -
f - --c++-kinds=svpf --fields=KSTtzns --line-directives
"C:\Users\John\AppData\Local\Temp\arduino_build_376360\preproc\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-
arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -
fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=12000000L -
DARDUINO=10805 -DARDUINO_AVR_PROTRINKET3 -DARDUINO_ARCH_AVR "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\cores\arduino" "-
IC:\Users\John\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20\variants\eightanaloginputs"
"-IC:\Users\John\Documents\Arduino\libraries\Adafruit_NeoPixel"
"C:\Users\John\AppData\Local\Temp\arduino_build_376360\sketch\cloud-lightning.ino.cpp" -o
"C:\Users\John\AppData\Local\Temp\arduino_build_376360\sketch\cloud-lightning.ino.cpp.o"
Compiling libraries...
Compiling library "Adafruit_NeoPixel"
Using previously compiled file:
C:\Users\John\AppData\Local\Temp\arduino_build_376360\libraries\Adafruit_NeoPixel\esp8266.c.o
Using previously compiled file:
C:\Users\John\AppData\Local\Temp\arduino_build_376360\libraries\Adafruit_NeoPixel\Adafruit_NeoPixel.cpp.o
Compiling core...
Using precompiled core
Linking everything together...
"C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-
arduino2/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o
"C:\Users\John\AppData\Local\Temp\arduino_build_376360/cloud-lightning.ino.elf"
"C:\Users\John\AppData\Local\Temp\arduino_build_376360\sketch\cloud-lightning.ino.cpp.o"
"C:\Users\John\AppData\Local\Temp\arduino_build_376360\libraries\Adafruit_NeoPixel\esp8266.c.o"
"C:\Users\John\AppData\Local\Temp\arduino_build_376360\libraries\Adafruit_NeoPixel\Adafruit_NeoPixel.cpp.o"
"C:\Users\John\AppData\Local\Temp\arduino_build_376360/..\arduino_cache_619687\core\core_adafruit_avr_protrinke
"-LC:\Users\John\AppData\Local\Temp\arduino_build_376360" -lm
"C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-
arduino2/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-
warnings --change-section-lma .eeprom=0
"C:\Users\John\AppData\Local\Temp\arduino_build_376360/cloud-lightning.ino.elf"
"C:\Users\John\AppData\Local\Temp\arduino_build_376360/cloud-lightning.ino.eep"
"C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-
arduino2/bin/avr-objcopy" -O ihex -R .eeprom
"C:\Users\John\AppData\Local\Temp\arduino_build_376360/cloud-lightning.ino.elf"
"C:\Users\John\AppData\Local\Temp\arduino_build_376360/cloud-lightning.ino.hex"
Using library Adafruit_NeoPixel at version 1.1.2 in folder:
C:\Users\John\Documents\Arduino\libraries\Adafruit_NeoPixel
Sketch uses 5200 bytes (18%) of program storage space. Maximum is 28672 bytes.
Global variables use 144 bytes of dynamic memory.
How to Make a Lightning Cloud: Page 16
C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-
arduino9/bin/avrdude -
CC:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-
arduino9/etc/avrdude.conf -v -patmega328p -cusbtiny -
Uflash:w:C:\Users\John\AppData\Local\Temp\arduino_build_376360/cloud-lightning.ino.hex:i
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is
"C:\Users\John\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-
arduino9/etc/avrdude.conf"
Using Port : usb
Using Programmer : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : USBtiny
How to Make a Lightning Cloud: Page 17
Description : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported
avrdude: Using SCK period of 10 usec
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: Using SCK period of 10 usec
avrdude: reading input file "C:\Users\John\AppData\Local\Temp\arduino_build_376360/cloud-
lightning.ino.hex"
avrdude: writing flash (5200 bytes):
Writing | #######
avrdude: error: usbtiny_send: (expected 128, got -116)
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 2 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 2 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command

How to Make a Lightning Cloud: Page 18


avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 2 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 3 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 2 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command

How to Make a Lightning Cloud: Page 19


#avrdude: 2 retries during SPI command
avrdude: 2 retries during SPI command
avrdude: 2 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 2 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 2 retries during SPI command
avrdude: 2 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 2 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 5 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 2 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 3 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command

How to Make a Lightning Cloud: Page 20


#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 2 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 2 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 3 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 2 retries during SPI command
#avrdude: 2 retries during SPI command
avrdude: 3 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 3 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 2 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 3 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command

How to Make a Lightning Cloud: Page 21


avrdude: 3 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 2 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command

How to Make a Lightning Cloud: Page 22


avrdude: 1 retries during SPI command
avrdude: 2 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 2 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
#avrdude: 2 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 2 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 2 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 2 retries during SPI command
#avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
# | 100% 126.80s
avrdude: 5200 bytes of flash written
avrdude: verifying flash memory against
C:\Users\John\AppData\Local\Temp\arduino_build_376360/cloud-lightning.ino.hex:
avrdude: load data flash data from input file
C:\Users\John\AppData\Local\Temp\arduino_build_376360/cloud-lightning.ino.hex:

How to Make a Lightning Cloud: Page 23


avrdude: input file C:\Users\John\AppData\Local\Temp\arduino_build_376360/cloud-
lightning.ino.hex contains 5200 bytes
avrdude: reading on-chip flash data:
Reading | ###########################################avrdude: 1 retries during read
####### | 100% 0.25s
the selected serial port
does not exist or your board is not connected
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0126
0x34 != 0xff
avrdude: verification error; content mismatch
avrdude done. Thank you.
Yep you're definitely getting an upload error. That can happen for a lot of reasons, and the folks
most equipped to help you are the creators of the Pro Trinket, Adafruit. You'll have to head over to
the Adafruit forums and ask about using the Pro Trinket on Windows. They should be able to help
you out! Post the same information over there (always provide all the information you can, to help
debug!) and they'll give you recommendations.
https://forums.adafruit.com/
So I used your code to put together a string of LEDs that I'm placing into a "lightning staff" for a
halloween costume for my son. I'm trying to get the flashes to happen in a lot faster succession
(think like something that's charged with electricity). I saw that you have in your code the variables
to change the frequency of the lights going, but I'm not sure which way to modify them. Could you
give me any pointers? Sorry... I'm not a coder at all...
Sure. The way this works is I set a "chance" variable to either 5 (high strike likelihood) or 10 (low
strike likelihood). The chance variable gets passed into the "random" function. We can see in the
arduino documentation[1] that when the "random" function takes one argument, that argument is
the "maximum" value. So it'll return a random number between 0 and that maximum value minus
one.

In other words random(chance) in English is: "a random number between zero and chance minus
one". So if chance is set to 10 it'll return a random number between 0 and 9, and if chance is set to
5 it'll return a random number between 0 and 5.

Let's look at the whole line[2] and interpret it into English:


if (random(chance) == 3)

if ( the random number between 0 and chance is equal to 3)

...then do the next thing. So, if you want to make it more likely all you have to do is make that
statement something that's more likely to happen. So if you want it to do a lightning strike 50% of
the time, you might change it to:
chance = 1
if (random(chance) == 0)

The only options for a random number between 0 and 1 are 0 and 1! So 50% of the time (on
average) you'll get a lightning strike.

The other thing you might want to change for a more "electricity" effect is the delay between strikes
(make the number here smaller): https://github.com/molecule/cloud-lightning/blob/v1.0/cloud-
How to Make a Lightning Cloud: Page 24
lightning/cloud-lightning.ino#L104

Or the delay between the flashes in the ligthningStrike itself (make the max number here smaller
too):
https://github.com/molecule/cloud-lightning/blob/v1.0/cloud-lightning/cloud-lightning.ino#L120

For this part, you'll really just have to mess around with the code until it looks like you want it to
look! I don't have any special knowledge that lets me design this: I just played around until I liked it.
I hope you'll share your changes with us when you're finished! I'd love to see a video of the
completed project. Good luck :)

[1] https://www.arduino.cc/en/Reference/Random
[2] https://github.com/molecule/cloud-
lightning/blob/c3af10c57ad2d1b4f775eebefa147384399d5827/cloud-lightning/cloud-
lightning.ino#L90
I juat want to say thank you for your instructable.except for the actual programming
part(installing/uninstalling drivers like crazy) everything went smoothly. Your code is amazing and
thank you for sharing. Only question i have is there a way to adjust colors of neopixels so they
flash different colors?

You're very welcome! I'm sorry the drivers were a challenge, but nice job on getting it all worked
out! And yes: there is a way to adjust the colors of the neopixels :) Here's the relevant line of code:
https://github.com/molecule/cloud-lightning/blob/m...
strip.Color is one of several methods used to change the color of a certain pixel! It takes either two
argument (as in my code, linked above), or four arguments (as in the Adafruit tutorial, linked
below). They're really the same: they just take the same arguments in different forms. Let's look
first at the four argument version.
The first argument is "n", the pixel that you want to change. The next argument is the red value, the
third argument is the green value, and the last argument is the blue value. When you're building a
color, you'll decide how much of that color you want to be seen for each LED. So, if you wanted to
make purple, you might pass in even amounts of red and blue, and zero green:
strip.setPixelColor(pixel, strip.Color(50, 0, 50));
Whereas if you wanted to do turquoise, or any kind of teal/blue/green mixture, you would pass in
some amount of green and some amount of blue, and zero red:
strip.setPixelColor(pixel, strip.Color(0, 20, 50));
All mixtures will create a color, you just have to experiment until you find the right amount of
mixture for the colors you want. Right now in my code, every value passed in to strip.Color is the
same:
strip.setPixelColor(pixel, strip.Color(scaledWhite, scaledWhite, scaledWhite));
That means the LEDs will flash white. I hope that this little extra bit of information helps you!
To learn even more, I highly recommend Adafruit's learning system!
https://learn.adafruit.com/adafruit-neopixel-uberg...
My daughter loves her lightning cloud. Thank you for the code and directions!

How to Make a Lightning Cloud: Page 25


Thanks for sharing your cloud! So happy to see :)

Awesome lamp! I made it successfully as my first ever electronics project. I used a UNO and it all
went very smoothly. Your code was so user friendly and I didn't have one issue. However......when
my lamp is powered off computer usb it works brilliantly. I bought a mobile power bank to use as a
power source for the lamp rather than the battery pack, and it does power the lamp but for only a
few minutes before it seems to switch itself off!? I've checked over the power bank and can't see
why it's doing it. Any ideas? The power bank is - 2600mAh 5V DC 1.2A output. Sorry, real novice
here.........thanks!
Hi! Glad to hear you had a good time and the code was user friendly.

For the power issue...the fact that it's switching itself off sounds almost like a safety
mechanism...are you shorting the power somehow? You'd need to post some pictures or a wiring
diagram (or both) to get more help, though.
Thanks for responding. You'll see my photos so hopefully that will show what I have done!
Apologies for not really knowing how to do a wiring diagram (yet?)! I have since purchased a
power adaptor for the arduino and it has been running fine! I am running 4 LEDs from the board to
clarify. Without knowing for certain ( which I don't) my concern was exactly what you suggested,
that I was somehow shorting the board out. I checked all my connections and couldn't find a
problem and so tried the power adaptor and all seems fine. I do wonder if there can be an
intermittent supply drop from the usb external battery? I'm really just guessing though! And that
could have been enough to stop powering the unit? Anyway, take a look and let me know you're
thoughts! Many many thanks for your time and input!

Sorry this response is so late! I just now found out that Instructables doesn't seem to email you
about every comment, so I didn't realize a lot of these were here until just today.
Anyway, in your picture I can't see where the red, green, or yellow wires are going. I'm suspicious
that the green and yellow in particular are not hooked up correctly. I'm also very concerned that
you don't seem to have any wire connected to ground. Can you post a picture with the entire circuit
visible? (Or maybe by now you've moved on, which would be understandable :) ).
Wow! Thanks for replying after such a long time. I have moved on but only after I sorted the power
issues I was having and put the cloud into a mains adaptor! I think the power bank I had was faulty
which led me down a dark path for a while! Pardon the pun. I love my cloud though and all credit to
you for your amazing posts. It was very straight forward so thank you very much. I'm still a novice
but certainly a lot more confident in trying things out now!
Just something I've noticed:
Many USB power banks shut off if the draw is too low after a minute or two. Put a phone or
something else on the bank and see if it stays on.
I can almost guarentee that the cloud is drawing so little current that the power supply is switching
off because the load detector isn't tripping.
Have you made any headway on your goal of adding a speaker or "weather for the day"? This is
amazing on it's own, but I'm imagining a thunderstorm at night for an hour or two, then a "weather

How to Make a Lightning Cloud: Page 26


cloud" greeting me in the morning and changing throughout the day.

Hoping to order the parts on Adafruit today for a Christmas present.

Yes I have! I expect the final instructions for the "weather cloud" will be up by next weekend for
sure. One change is if you want to control the lightning cloud over WiFi, you'll want to use
something called the Particle Photon. It's a very easy to use board, and would replace both the Pro
Trinket and the Bluefruit modules. (Initially I was thinking I'd need the Bluetooth in place to talk to
the Arduino board, but with the Particle Photon everything is combined into one convenient place.
Even if you decide you don't want to hook up your lightning cloud to the Internet, you can control it
via the Photon just as easily. Here's where to order it one, and I'll post versions of the code that
work on the Photon soon:
https://store.particle.io/
I am also interested in the weather cloud idea and about to build a massive (70+ cubic feet)
lightning cloud. Since it's being installed in a dark hallway roof, it'd be nifty if I could perform effects
aside from lightning. Did you make any further progress toward this, or do you need any help?
Do you have the"Weather Cloud" instructions up yet? This is awesome!

Id love to try this out as well!!!... till then Ill be ironing out my issues with no lights flickering yet =/

Dumb Question: If you used an Arduino Uno to display the lightning effects in the video, how did
you transfer the code to the Pro Trinket?
In the video of the cloud, I was using a Pro Trinket!

Also, it's not a dumb question but I'm not sure I totally understand it well enough to give a good
answer. Here are some guesses about what you mean, and answers:

Do you mean why does the code work on both? Many different Arduino board are compatible,
meaning the same code will work on different boards. In some cases you need to change pins, or
remove functionality that isn't there, or shrink the size of the sketch for a smaller board, but for the
most part the same code will work everywhere. That's the case here: this code will work without
changes on both the Pro Trinket and the Uno.

Do you mean literally how do I transfer it? The code lives on the computer, so to put it onto a Pro
Trinket, I just plug the pro trinket into the computer and hit "upload".

Feel free to ask follow-ups if I didn't understand your question the first time!
Hi, have a problem and cant open die .ino from u...
By others have never a problem .u know what is it ?
Want use a Arduino Uno.
best regards
He have a Problem by launch4j ???

fun stuff

How to Make a Lightning Cloud: Page 27


Im going to watch this. Awesome decor with one caveat, how will you clean it or keep dust from
accumulating in it? I
I just built it, only using 3 leds so have to see if 5 makes a diff, really cool and thanks. Starting to
play with the code, I want to add a clap on/clap off for it so I can hang it without a switch. Just
starting to play with the code, now I need a new soldering iron and articulated clamp since this
introduced me to the Adafruit board. I want to experiment with adding some black spray paint to the
bottom to look like a rain cloud, maybe powdered paint and hairspray well will post up pics when
it's done.
Also added a switch

Love it! Fun idea with the black spray paint. Thanks for sharing your cloud!

Just ordered the necessary electronics for the project and i have high hopes for the outcome. I will
need some help with the coding as i have only built small electronics from kits such as radios and
the electronics of a guitar. I will be posting soon once i get my electronics and i would love some
help and feedback. The cloud looks great by the way. I can only hope to get close to that.
Will be happy to help! Look forward to seeing your finished product :)

Please post an 'ible with a photon board and sound!


I know I'm a little pain, but I want to make this for my daughter's birthday in early March! And not
being a programmer, I need step by step! :)
Haha it's not that I don't want to! It's that it turns out parsing the json is a much bigger mess than I
thought, and I may need to separate out certain parts of the code into another script, which is a
whole different topic I need some time to look into! Also as of right now it won't have sound,
because I don't have access to speakers.
I love this for a weather unit I am teaching. Do you have any suggestions as to how I can do the
necessary attaching but without soldering (they are elementary aged and I've never done it before
:))? Thank you!
Very cool project!

Im new to electronics and programming and all of this is super overwhelming but I'm hanging in
there.
I need your help though (sorry if this is super basic)
I've downloaded the arduino side and have configured the pro trinket 3v board option.
What programmer do I use?
Do I simply copy and past the code and hit upload?
When I click verify it gives me this error: "Documents/Arduino/Test1/Test1.ino:1:31: fatal error:
Adafruit_NeoPixel.h: No such file or directory
#include <Adafruit_NeoPixel.h>
^
compilation terminated.

How to Make a Lightning Cloud: Page 28


exit status 1
Error compiling."

Thanks for your help:)


Ah! I know exactly what that error is. You need to download an install the Adafruit Neopixel library
for your IDE to be able to compile the code. Here's a really good description of what to do:
https://learn.adafruit.com/adafruit-neopixel-uberg...
If you're using the Pro Trinket, you'll use the USBTiny programmer. Here's some helpful info about
using Pro Trinkets:
https://learn.adafruit.com/introducing-pro-trinket...
Yes - once you've installed the Neopixel library, you'll just copy and paste the code from my github
into the IDE and you should be able to upload it from there. Keep in mind that the Pro Trinket must
be put into "bootloader mode" but pressing the little "reset" button on the top of the board. (There's
a ton more information at the above link about Pro Trinkets, so I'd recommend checking that out).
By the way - welcome to the world of hobby electronics! This was a very well-asked question - you
gave me all of the information I needed to help you out, including the actual error message. Thank
you! (Asking good questions is a seriously valuable skill, so good work).
Thank you much! Answering a question well is a valuable skill as well:)
I was successfully able to upload the code and have the LED's flash!
I've run into a different problem now... The light flashing is red on the first LED and not very bright.
As soon as I add another LED in series like your diagram shows, the light on the first LED
becomes very faint and the second LED doesn't flash at all... Could this be a soldering problem?
All four of my LEDs do this. Also Im powering the trinket through USB connected to my computer.
Awesome! Glad to hear you got past that hurdle.
As for
the LED problem, that sounds like a power issue. It could be related to
soldering... but it could also be that the USB from your computer
doesn't provide enough current... What pin is the Neopixel PWR line
connected to on the Arduino? If you post a super clear picture it might
make it easier to debug.
Ok. I think I fried my previous neopixels, so I bought some new ones and changed out the tip on
my soldering iron. The soldering now is easy and spot on. However, I'm still having trouble with the
lights not coming on. The wiring is just as your diagram shows.

Hmm ok, well I'm not sure. It does look like you have the wires going the right places, but one
funky thing is that you have the headers to the Pro Trinket on "upside down". See the black plastic
part of the headers? That should be UNDERNEATH the Pro Trinket.
I'm wondering if they're not sticking all the way in to the breadboard,
which means you're not getting a connection to your LEDs. That would prevent things from lighting
up!

How to Make a Lightning Cloud: Page 29

You might also like