Quantcast
Channel: SparkFun Tutorials
Viewing all articles
Browse latest Browse all 1123

LED Cloud-Connected Cloud

$
0
0

LED Cloud-Connected Cloud a learn.sparkfun.com tutorial

Available online at: http://sfe.io/t478

Introduction

Make a rainbow colored cloud light that you can control from your phone. You can even have it change color based on the weather outside.

Rainbow colored LED Clouds

These are the clouds from episode 3 The Fellowship of the Things, which you can watch below if you haven’t already.

Required Materials:

To follow along with this tutorial, you’ll need the following materials.

Cloud Cloud required electronics materials


Other parts you will need:

Other Cloud Cloud materials

  • long hook-up wire for cloud power (I used stereo wire)
  • Paper lanterns (white)
  • Pillow filling (I used polyfil)
  • Lots of hot glue and a hot glue gun
  • Fishing wire
  • A wooden dowel for support
  • A power source; you will need something that can put out at least 5V and 4A, but for the best results you can get a pricier 6V 8A power source.

alt text

Optional part included: Thing dev board (in the wishlist, but only needed if you want to hook up to your phone and/or weather info)

Suggested Reading:

If any of these subjects sound unfamiliar, considering reading the following tutorials before continuing on.

Physical Cloud Making

We will begin by assembling the clouds.

Start with an open white paper lantern, and glue on pieces of polyfil in small sections until you have covered the whole lantern.

Gluing polyfil onto the paper lantern to make the clouds

Some tricks for making the cloud look cool when it is lit up is to swirl the polyfil before you glue it on or do other fun crazy shapes.

Twisting polyfil into fun shapes

When you have covered it fully (don’t worry about the top and bottom holes right now), you may want to take a flashlight, and check to see what the lantern looks like when lit up. Cover any bare spots you see.

Flashlight lighting up polyfil covered paper lantern

Flashlight lighting up polyfil covered paper lantern.

Repeat this process for as many lanterns as you would like. The more lanterns, the larger your clouds will be. Just keep in mind you’ll need a power supply that can handle all the LEDs in each lantern. Paper lanterns of different sizes can create a cloud that looks more realistic.

The 5m RGB LED strips fill about five lanterns, so if you want to make your cloud larger or have more than one cloud, you are going to want more RGB LED strips and power sources (you can use the same Pro Mini and ESP8266 Thing Dev Board to power multiple clouds and RGB LED strips).

5 polyfil covered paper lanterns

Once you have the all of your lanterns covered in polyfil, you can tie them together with the fishing wire. This was accomplished by picking a lantern that I wanted to be the highest point of the cloud and tying the tops of the other lanterns to the top of the one I chose. This will give you room for the cloud to look like it is “bobbing” and “shifting”, but if you want it to be more secure, you can tie the lanterns more tightly to each other and even tie the bottoms together as well.

Tieing paper lanterns together

All the paper lanterns tied together

Now that your lanterns are tied together, you can secure them to a wooden dowel so that the cloud is easier to transport and hang.

Lanterns tied together to a wooden dowel

At this point, set your cloud up near your workstation so that you can easily install the lights and see what the cloud looks like lit up. Take this opportunity to add or take away polyfil as you see fit.

Electronics Assembly Part 1

This section will cover building the Pro Mini Circuit. We will add the Internet-connected portion in Part 2.

Connect the components as follows:

Fritzing diagram of Pro Mini and LED strip layout

Please note that we are soldering all these components to a solderable breadboard. Feel free to build the circuit on a breadboard first to test everything out.

Click the image for a closer look.

ComponentBreadboard
Buttonj17 (To Pro Mini Pin 3)g15 (GND)
Resistora22 (Pro Mini Pin 6)Bottom - (LED Strip DIN)
Capacitora27 (Pro Mini GND Pin)Bottom + (LED VCC)
Jumper WireTop - (GND)i29 (Pro Mini GND Pin)
Jumper WireTop + i27 (Pro Mini VCC Pin)
Jumper Wireb25 (Pro Mini Pin 3)f15 (button)
Jumper Wiref13 (button)Top - (GND)
Wireb27 (Pro Mini GND Pin)Ground of barrel jack
WireBottom + (LED VCC)VCC of barrel jack
Wirec27 (Pro Mini/LED power GND Pin)Yellow wire on LED strip (LED GND)
WireBottom - (To Pro Mini Pin 6)Green wire on LED strip (DIN)
WireBottom + (LED power VCC)Red wire on LED strip (LED VCC)

* Pins not listed are not used.


Take a button, and cut off two legs that are diagonal to each other so that it doesn’t cause a short circuit.

Cutting legs off of a breadboard push button

Some things to note here is that I have put a 1000 microfarad capacitor between the LED power and ground. This is good practice, and helps distribute the current better, so that you don’t accidentally blow out your first LED. This should be done on any string of wires as a precautionary measure. I have also placed a 330Ω resistor between the DIN of the LEDs and the microcontroller. This is another good measure to protect the addressable LEDs.

The Pro Mini will need to be powered separately from the LEDs, and this can be done through the Mini USB port of an FTDI Basic. (If you don’t want it to run off your computer you can get this USB wall charger). You can also solder wires directly to the Pro Mini’s VIN pin.

Pro Mini with headers soldered on

Code Part 1

The following code allows you to run the lights off of the Pro Mini so that you can scroll through the different pre-programmed lighting sequences.

Codebender Examples: For these examples, we're hosting the code on codebender, which not only features code-sharing, but also allows anyone to upload and debug Arduino sketches from within a web browser. Plus, it works on lower-tech machines, like Chromebooks!

There are codebender plugins for Chrome, Chromium, and Firefox. Visit the codebender plugin page for help installing the codebender plugin.

If the codebender embeds don't work for you, we'll also provide a download link to the example code.

Plug in the Pro Mini, choose Pro Mini as your device, select the corresponding COM port, and then press the “Run on Arduino” button.

If the codebender embed doesn’t load for you, you can download the example code from our GitHub repository.

Once you have tested that your code works with your soldering job, you may want to take some hot glue and cover the wires leading to your barrel jack, just to make sure nothing shorts and to create a stronger connection.

alt text

Hot gluing power barrel jack for protection

Electronics Assembly Part 2

This section will cover adding a SparkFun thing to your project so that it can connect to the Internet.

You can keep all the soldering done in part 1, but just add a SparkFun Thing board to allow for use with your phone as well as to pull weather data.

Connect the components as follows:

Fritzing diagram of Pro Mini, SparkFun's ESP8266 Thing Dev Board and WS2812 LED Strip layout

Click the image for a closer look.

ComponentBreadboard
Resistora22 (Pro Mini Pin 6)Bottom - (LED Strip DIN)
Capacitora27 (Pro Mini GND Pin)Bottom + (LED VCC)
Jumper WireTop - (GND)i29 (Pro Mini GND Pin)
Jumper WireTop + (Board VCC)i27 (Pro Mini VCC Pin)
Jumper Wireb25 (Pro Mini Pin 3)f15 (button)
Jumper Wiref13 (button)Top - (GND)
Jumper Wirea20 (Pro Mini Pin 8)j7 (SparkFun Thing Pin TX)
Jumper Wirej10 (SparkFun Thing GND Pin)Top - (GND)
Jumper Wirea2 (SparkFun Thing VIN Pin)Top + (Board VCC)
Wireb27 (Pro Mini GND Pin)Ground of barrel jack
WireBottom + (LED VCC)VCC of barrel jack
Wirec27 (Pro Mini/LED power GND Pin)Yellow wire on LED strip (LED GND)
WireBottom - (To Pro Mini Pin 6)Green wire on LED strip (DIN)
WireBottom + (LED power VCC)Red wire on LED strip (LED VCC)

* Pins not listed are not used.


Again, same notes as part 1: adding a capacitor and resistor, and powering the Pro Mini and Thing from the wall (read part 1 for all the details).

One additional note, for ease of programming both the Pro Mini and the SparkFun Thing board, you may want to solder in female headers where the Thing board will sit and male headers to the Thing board, so that you can easily take it out to program both.

Cloud project with female headers for the SparkFun Thing board to go into

SparkFun ESP8266 Thing Dev Board

Finished layout of connected cloud cloud hardware project

Code Part 2

Since you have two boards with microcontrollers, you will have to program each one separately.

Pro Mini Code:

Remember, put “Arduino Pro or Pro Mini (5V 16 MHz) w/ ATmega328” as your device, select the COM port that it is plugged into your computer on, and hit the “Run on Arduino” button to program.

If the codebender embed doesn’t load for you, you can download the example code from our GitHub repository.

To hook up the Thing board to the Internet, we will be using the Blynk app. To get the code we need to program the Thing board with you will need to download the Blynk app onto your phone.

Once you have the app, create an account (if you don’t have one already), and go to “create new project”. There you can name your project, set your hardware to “ESP8266” and you can email or just copy that authentication token, which we will need to paste in the SparkFun Thing code.

In your project that you just created, you are going to want to put three LED light widgets, three button widgets, a ZERGBA widget, and an LCD widget.

To get these things onto your project board, touch the screen and the left side should show things that you can place. Drag them over to wherever you’d like. Once they are placed on your board, you can click on them to assign them pins. All of ours are going to be assigned to virtual pins in the table below. There is also a step by step photo setup to help you:

ModulePin
Weather ButtonV0
Weather Indicator LEDV1
RGB ButtonV2
RGB Indicator LEDV3
Disco ButtonV4
Disco Indicator LEDV5
ZERGBRAV8
LCD ScreenV9

Blynk app Photo Setup Walkthrough:

alt text

alt text

alt text

(remember to email yourself the Auth Tolken or you can come back to this page after you to get it.)

alt text

alt text

Swipe to the left to get the widget box menu, to pick new modules:

alt text

Once you have selected a module, it will appear on your project board. To attach it to a pin and change its setting, click on it:

alt text

Repeat those steps for all the modules attached to the pins you will need (as seen below):

alt text

alt text

alt text

alt text

alt text

alt text

alt text

After you have created all the LEDs, Buttons, the ZERGBA, and the LCD and assigned them to the correct virtual pins, you can arrange your modules to look like this:

alt text

And now your blynk project is ready!

SparkFun Thing Code:

To program the SparkFun ESP8266 Thing, we have to get a little more complex. Since it is a newer board, it is yet to be supported on Codebender, but they are working on it! We will update this tutorial once such an option is available.

Thus, to program this board you will need to have the Arduino IDE on your computer. You will need a special add on to be able to choose the ESP8266 board, and you can get the instructions for that in this tutorial. You will also need to download the github libraries for Blynk, Adafruit’s Neo-Pixel Libraries, and lastly add the github libraries for this project. If you have never worked with the Arduino IDE or need a refresher on how to install github libraries I would take a look at our tutorials on them:

Once you have done all of that, you can open the Thing code in the cloudcloud project, change the wifi and password to your network, add your Auth token from the Blynk app, and upload it to your SparkFun Thing to your computer. If you want weather for a city other than Niwot (which you probably do) you can change that in the code as well.

When uploading the code, remember to choose “SparkFun ESP8266 Thing” as your board under the Tools tab. Also check that you have the “Upload using: serial”, “CPU frequency: 80 MHz”, and “Upload speed: 115200” chosen under the Tools tab as well. Make sure you Thing board switch is ‘ON’. Then choose the COM port that your Thing board is hooked up to, and press the Upload button.

(*If you are having errors when you try to upload of undefined libraries, make sure that you have added the file states.h to your project. If after that you are still having issues, it might be the version of the Adruino IDE that you are running, we wrote this on version 1.6.5 and recommend running it on that version.)

Once that is finished uploading, unplug the Thing board from your computer, hook it back up to the circuit, power your Pro Mini (that is also powering the Thing board), and your LED strip. Make sure your Thing board switch is turned on, and wait 30-60 secs. Open up your Blynk app, and run the project you created by pressing play in the top right corner. You should be all hooked up and able to control your lights from the app.

Phew, that was a lot of stuff, but we got through it! Now you can power your lights and your Pro Mini (that is also powering the Thing board) and power up your Blynk app and control your clouds!

Installing the Lights in the Clouds

Now that we have the lights up and running, we can place them into the cloud and test out how it looks.

Evenly distribute the lights between all the paper lanterns and look at the light distribution, and adjust accordingly.

Putting WS2812 LED strip inside of paper lanterns

Putting WS2812 LED strip inside of paper lanterns

WS2812 LED Strip inside of paper lantern

After I felt good about the distribution, I tied the LED strip to the top of each paper lantern. Note that the LED strip isn’t very secured in the lantern. The reason for this is that I didn’t see a difference if I secured them or not. Since they will always be hanging in the same way, they aren’t going to shift very much, so just securing a part to the lantern seemed sufficient to me.

Tieing the WS2812 LED Strip to the paper lanterns

After the LED strip was in the cloud, I looked around and filled any bald spots on the lantern with more polyfil that I could now see due to the lights. I also covered any exposed LED strip with polyfil that I rolled to be more dense.

Cloud on with exposed strip

Filling bald spots on paper lanterns

Rolling polyfil

Gluing polyfil to exposed WS2812 LED strips

You can glue the polyfil on while the Cloud is lit to get a better idea of what it looks like.

After you have filled in all the uneven spots of the cloud with polyfil, you can install your cloud where you like and enjoy it’s colorful awesomeness!

Resorces and Going Further

Thanks for reading! Here are the links to all the resources used in this tutorial.

Github Libraries:

Codebender Libraries:

Interested in some more crafty electronics projects? Take a look at some of our other tutorials:

Origami Paper Circuits

A quick tutorial to get you started in the world of light up origami flowers.

LED Butterfly Pop Up Card

Craft an illuminated butterfly pop up card with copper tape, two LEDs, and a battery.

Light Up Pennant with E-Textiles

Show your school spirit, geek pride, or fandom with a light up pennant using the LilyTwinkle or LilyPad Arduino.
New!

Interactive Smart Mirror

Build a smart mirror that displays weather data using the Intel® Edison.

learn.sparkfun.com |CC BY-SA 3.0 | SparkFun Electronics | Niwot, Colorado


Viewing all articles
Browse latest Browse all 1123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>