Arduino Based Multi Color Light Painting Wand

5,633

76

4

Web entrepreneur and Electronics enthusiasts. Follow me on Instagram : @frankdonald05

Intro: Arduino Based Multi Color Light Painting Wand

Light painting is a technique used by Photographers, where a source of light is used to draw interesting patterns and Camera will put these together. As a result the Photo will contain the trails of light in it which will ultimately give a look of a painting using Light.

Photographers commonly use tools like torch lights, tube lights and other source of light to create Light paintings but these tools are seriously limited with narrow range of colors, hard handling and control. The light painting stick which I have made can easily overcome these limitations.

The main features of our light painting stick are:

  • WiFi Operated – This light painting stick can be controlled ( turned ON/OFF, Changing colors ) very easily using a simple browser within any WiFi enabled devices. Thereby these WiFi devices will act as a remote control and Photographers can play around with variety of colors while creating their master piece.
  • Standard colors – This stick is coded to emit standard colors like ( Red, Blue, Green, Gold, Rainbow, White ) using a simple button input.
  • Custom Colors – Apart from the standard colors this stick is quite capable of generating any color as per the wish of Photographer. It was added with a feature to input RGB code of any color as you wish like cyan,magenta, turquoise, olive, maroon etc. Look up for the “RGB color codes here” and use it to get your custom color.

Step 1: Materials Required

    I have listed the materials required to make this project. Also I have added the links where you can buy it from Amazon.com. Buying materials from below links will earn me some commissions and in turn will support me for future projects :)

    1. Arduino Uno - Buy here
    2. RGB WS2812 LED strip (25 LED’s) - Buy here
    3. Power bank (5v, 10000mAh) - Buy here
    4. ESP8266 module - Buy here
    5. Bidirectional logic converter module - Buy here
    6. Connecting Wires

    WS2812 RGB LED strip - This RGB LEDs are chained together and sold in units of 60/120 pcs. The most highlighting is that this RGB LED has a integrated chip in it which in turn makes the controlling part pretty easy. Detailed explanation on this is beyond this scope. Check out this link "WS2812 LED strip working" for more details.

    ESP8266 module: This is a teeny tiny WiFi developmental board widely used in IOT projects. Check out this link on "Getting started with ESP8266 module" if you haven't used ESP8266 before.

    Bidirectional Logic converter module: This module enables Arduino to communicate with ESP8266 modules by converting the signal from 5V level to 3.3v logic level.

    Step 2: Block Diagram

    This Light painting project is based on the concept of IOT where two networking devices connect with each other to form a network in turn establishing communication and control. Here Arduino will host a webpage and act as a server. This webpage was designed in a way to take LED control inputs ( Colors : Red, Blue, Green and ON/OFF) from the user . This hosted webpage can be accessed via WiFi enabled device that is connected with Arduino and control the RGB LED strip connected to it.

    To understand this project better I advice you to have a read on "Creating an Arduino webserver with ESP8266". This will provide you a basic conceptual understanding on how this project works. In a nutshell Arduino will perform the following activities in this project:

    1. Command ESP8266 to join our device WiFi hotspot.
    2. Create a server using the using the ESP board Host the webpage in the Arduino itself and wait for external clients ( Device browser) to make the request
    3. Once the client request is in, Arduino will send the webpage to client ( device browser) via ESP8266 module.
    4. Then it will infinitely scan for LED commands ( will be explained in web interface section ) from the client.
    5. Once the LED commands are received, Arduino will process that and activate the RGB LED strip connected to it.

    Step 3: Circuit Diagram

    The above circuit diagram shows how to connect Arduino with ESP8266 and RGB LED strip. As you can notice that TX and RX of Arduino which will go into the Logic converter where the signals will get shifted to 3.3v compatible to ESP8266. Pin 6 of Arduino which is a PWM pin feeds the time control pulse to control the color of RGB LED strip.

    There are two LED's which serve as indicators for this project. The LED D2 indicates whenever the project is turned ON. Whereas the LED D1 indicates when Arduino successfully created a webserver. This green LED will help the user to realize that server is ready to receive the request from client ( browser).

    Choice of powerbank is really important since the circuit can roughly draws maximum current of around 1700ma. I have used a 5.1/10000mah battery with current output of 2A at any instant.

    Step 4: Connecting Your ESP8266 to WiFi Hotspot

    ESP8266 module is capable of remembering the paired hotspots. This project works based on its auto connect capability to connect with previously connected hotspots. ESP8266 module can be controlled by using specific AT commands dedicated to it. Using Arduino we can pass on these commands and force ESP module to connect with our device Hotspot.

    In order to do this Upload the code "Bareminimum" to Arduino. Now connect the ESP8266 with Arduino as mentioned below using the logic shifter.

    Arduino RX -> Logic shifter -> ESP8266 RX

    Arduino TX -> Logic shifter -> ESP8266 TX

    Now open your serial monitor with baud rate of 57600 ( default baud rate of ESP8266 modules) and "Both NL & CR" selected. Type in the following commands.

    1. AT
    2. AT+RST
    3. AT+CWJAP="Your device SSID","Your password"

    Once you get the confirmation "WIFI CONNECTED" and "WIFI GOT IP" in your serial monitor. This step is done and your ESP module will connect automatically to my device next time its powered ON.

    Step 5: Web Interface and Its Code

    Web interface is of great importance since it will serve as the user interface through which commands go to Arduino via ESP8266. Our web interface is pretty simple and coded in plain HTML. The buttons in this interface passes a GET command with a URL parameter with every button press. Below is the list of buttons with respective URL parameters.

    1. 6 buttons for standard colors - “/Red” , “/Gre”, “Blu”, “/Whi”, “/Gol”, “Rai”
    2. Custom color input using RGB Values - “?R=255&G=255&B=255”
    3. Turn Off the Strip - “/Off”

    For some reasons I couldn't place the Web interface code here, you can get that code in this link.

    Step 6: Algorithm and Code

    Before setting up the hardware you to get the code uploaded into Arduino since it needs to be packed inside a container and can't be done anytime later. I have written the algorithm that will help you to understand the Arduino code since.

    Algorithm:

    1. Reset the ESP8266 module by sending “AT+RST\r\n” command.
    2. Check for the response from ESP8266 to see if the connection to our device hotspot is successful. Once connected start feeding the “Server creation” (refer below) command sequence to ESP8266.
    3. Monitor the response for each input commands.
    4. All these commands should return a response of “OK\r\n”, in case of incorrect response repeat the command with incorrect response or “ERROR”.
    5. Once all the server creation command sequence is in successfully, light up the Green LED in the pin 12 of Arduino. It will be indication for the user to provide the client request.
    6. Force Arduino to wait for the client request from any browser lies within the LAN or Network.
    7. Once client request is in, check for the connection ID and send the command “AT+CIPSEND….” by inserting the appropriate connection ID to it.
    8. ESP8266 responds with a ‘>’ sign indicating its readiness in receiving the characters. Upon receiving this send the webpage code we saw in earlier step to the client browser via ESP8266 module.
    9. Now webpage will be visible in the client browser of user, Arduino will then enter into a state of scanning indefinitely for “LED commands” from the client.
    10. The webpage was written in a way to provide unique URL parameter for each button press, so whenever a button is pressed ESP module will pass on a GET request with that unique URL parameter.
    11. Arduino should process this URL and provide control the RGB LED strip accordingly.

    Server Creation Commands:

    • AT
    • AT+CWMODE=3
    • AT+CIPSTA=192.168.43.253 ( For android device )
    • AT+CIPMUX=1
    • AT+CIPSERVER=1,80

    Code:

    In order for you to make this project work, you need to install this "Adafruit's Neopixel library", download and install them.

    You can get the Arduino code for this project in this link -> "Arduino operated light painting stick"

    Step 7: Preparing the Light Stick

    I have made a video on making this "Light painting wand", do have a look for more clarity.

    Start by soldering wires to the end of the LED strip. Continue with applying some hot glue over it to make the connection stronger. Find a piece of plastic strip over which you can stick your LED strip. I have used plastic packaging tube in which the IC's come from. I got plenty of this lying around in my house, so decided to make use of this and it suited perfectly.

    Cut out the packaging tube or anything you find usable to the required size. I have glued the LED strip over the packaging tube by using some strong adhesive. Hot glue might not be a good idea for this, since excess heat might damage the LED's and that's the last thing we want to happen. Then I have let it dry for about 20 minutes to allow it to set.

    Step 8: Choice of Container and Setting Up the Stick

    This is pretty important step since the powerbank, Arduino, indicator LED's and ESP8266 modules will go into this container. Select a container of appropriate size so that it can house all the above. I have chosen a cylindrical container so that it will be easy for me to hold while operating them.

    Since I have chosen a cylindrical one, I have marked the direction at which the LED strip is going to face with an arrow mark. I have marked the container to guide me while placing the contents inside the container. Put on a small hole in the cap of container with soldering gun. Make sure you have made a hole big enough to fit the light stick inside it.

    Once placing the stick inside the cap, seal it with the help of a glue gun and make sure the stick is stable and not moving.

    Step 9: Assembling Power Bank and Indicator LED's

    Power bank will be pretty heavy compared to other components in this project. Place the power bank to the left side of line drawn in the container. So it is important to make sure it won't move while in operation. For this purpose I have used a Velcro patch and wrapped it tightly around the power bank. Inside the container I have placed another pair of Velcro patch. I have sticked the power bank against the Velcro patch and it holds it pretty tightly and that's what I need.

    Place a switch just opposite to the line drawn. This switch is intended to turn ON/OFF the entire project. Below the switch. Place the two LED's ( Red and Green ) and solder them with a resistor each ( refer circuit diagram in step 3 ) for reference. The LED's and Switch should be straight opposite to the direction at which the lighting stick will go in. This is to avoid unwanted light interference from indicator LED's while light painting. Connect the stripped USB cable and few connectors to the button as shown in the last image. The connector cables are there to power the Arduino and ESP8266 modules.

    Step 10: Assembling Arduino and ESP8266 Modules Inside the Container

    Put together the Arduino board and ESP8266 plugin module which also holds the bidirectional logic level shifter. Wire it , Glue it and put it together. Once done put this inside the container, I did this with utmost care, since I should make sure that none of the wires are getting tangled. This is because I have chosen a container with less diameter. But on the bright side the container is very handy and easily fit into my palms.

    Connect the wires from light painting stick to power terminals and 6th pin of Arduino. Once done close the cap of container carefully.

    Step 11: Cover It Up

    Cover the container with a black tape or any other material. This is to prevent the light interference from disturbing the operation of light painting. This is because Arduino, ESP8266 and Power bank have LED's in them. Keeping them uncovered might interfere and spoil the Photos.

    I have used a black tape for this purpose. Although you can use any thing else of your choice for this purpose.Once done WiFi operated light painting stick is now ready to paint some cool hues.

    Step 12: Test It Out

    1. Turn on the switch and the Red LED should light up
    2. Wait for the Green LED to light up, this usually occurs within 5 to 10 seconds and it indicates that Arduino server is created.
    3. Once Green LED is ON, open the browser in your device and type in the IP address 192.168.43.253 launch the URL
    4. Webpage we have seen in step 5 should get displayed in your screen.
    5. Now interact with the web interface and control the LED strip
    6. And go and do some cool light painting.

    Step 13: Things to Remember & Few More Photos

    • This project is based on the capability of ESP8266 to auto connect with the WiFi hotspot once turned on. So the ESP8266 and your hotspot device must be paired at least once before using in this project.
    • The Arduino was programmed in such a way to handle only one client communication which means only one browser can request Arduino to control the LED’s
    • There is a wait time for creating server by the Arduino with ESP8266. The end of this wait time can be known by green LED.
    • Once the green LED lights up you are good to initiate the client request from your browser. You should supply the entire project with source of at least 2A in order to keep it run hassle free.
    • This project is tested successfully with Google chrome for desktop and Opera for smartphones.

    Hope you all like this Instructable, do try this and Let me know the outcome. I have been planning to design a PCB for this project and will publish it soon here. Further improvement ideas are much welcome.

    This project took a great deal of time to build and document to create an Instructable. Kindly vote for me in "LED Contest" , "Arduino Contest" and "Remote control contest" if you think it's worth it. Hope to see you with another instructable

    LED Contest 2017

    Runner Up in the
    LED Contest 2017

    Share

      Recommendations

      • Plastics Contest

        Plastics Contest
      • Electronics Tips & Tricks Challenge

        Electronics Tips & Tricks Challenge
      • Audio Contest 2018

        Audio Contest 2018

      4 Discussions

      0
      None
      arpruss

      9 months ago

      Nice project! Could one just use the ESP8266 (in a package that exposes more pins, ESP8266-12E) without the Arduino, and save a couple of dollars?

      1 reply
      0
      None
      frankdonaldarpruss

      Reply 9 months ago

      Hi Arpruss,

      I have tried that but GPIO's in ESP8266-01 can activate or deactivate things but cannot generate a precise timed signal to control the RGB strip. But it is possible with higher versions of ESP modules like ESP8266-12E. And that is going to be my version 2 of this project :)

      0
      None
      nialldevlin

      9 months ago

      In step 4, you say to connect the Arduino RX to ESP8266 RX, and also connect the TX pins. I think that since the RX stands for receive, and TX stands for transmitting, that the RX should be connected to the TX on the other board. I don't know if this is a typo or if I am wrong, but if I am wrong, don't leave me in the dark.

      1 reply
      0
      None
      frankdonaldnialldevlin

      Reply 9 months ago

      Yes you have to connect them as TX -> TX and RX -> RX while testing your ESP8266 with Arduino. You will do this by uploading Bareminimum code to your Arduino. This is because the Serial pins of Atmega328 in the Arduino will be inactive while using this code and Serial monitor of your PC can talk to your ESP8266 directly ( USB -> Atmega16u2 -> ESP8266. )

      But while having the " Light painting code"uploaded in your Arduino, Serial pins of arduino will speak with ESP8266 so you need to connect RX -> TX and TX-> RX . Hope this clears your doubt