Introduction: WiFi Led Fedora Hat (ESP8266 + WS2812b)

This is a cool good looking led Hat, You can change color and effects of the leds with your smart phone or a computer, also I tried made it as simple and cheap as possible. Also it have a rechargeable battery so you can take this along with you! This is a good gift too!. So Lets Start -----

Step 1: Things You Need

We need some components and some simple tools to make this-

1) NodeMcu Lolin v3 (ESP8266 12e) [The brain of the hat]

2) WS2812b [aka the NeoPixel] I used 8 pieces

3) 18650 li-ion battery [Main power source]

4) battery protection and charger module

5) 5V boost converter module

6) Any kind of spdt switch

7) Wires

8) pin headers [Connecting wires to node mcu]

9) Some black thread and black cloth

10) AND THE MAIN THING The Hat It self

Tools-

1) Soldering iron and solder

2) Pliers

3) Cutter

4) Needle

AND a computer to program the NodeMCU

Step 2: Schematic Diagram

As in the diagram ground and Vcc from Battery connects to the the tp4056 module [Note- In diagram you will see that it is a tp4056 module but in real I use a tp4056 module with overcharge, over discharge, and short circuit protraction] from the module vcc connect to the 5v booster via a switch and ground directly connects to booster moduel. From the booster output Vcc And Ground connect Both NodeMCU and the leds. D1 from NodeMCU connect to WS2812b's Din pin.

I recommend you to Build the prototype in bread board first.

Step 3: Software and Code

Now lets do the software part

In this project I used the McLighting project, Thanks to Toblum https://github.com/toblum/McLighting

Download McLighting from adove

Their is a detailed instruction here - https://github.com/toblum/McLighting/wiki/Software...

But I am trying explain in easy words -

  • First you need Arduino ID, download it from here - https://www.arduino.cc/en/Main/Software
  • Then you need to install ESP8266 board support for arduino, go to preferences dialog and enter the following URL as Additional Boards Manger URL http://arduino.esp8266.com/stable/package_esp8266...
  • Now go to tools - board and select NodeMCU 1.0, set CPU frequency to 80 MHz, and Flash size to 4M (1M SPIFFS), then select the right com port.
  • Now we need to add some libraries -Go to "Sketch" > "Include Library" > "Manage Libraries ..." and install the following libraries by searching for them and installing:
    1) WiFiManager by @tzapu
    2) WebSockets by @Links2004
    3)Adafruit NeoPixel by @adafruit
    4)Optional: PubSubClient by @knolleary

    Download this https://github.com/kitesurfer1404/WS2812FX library and load it in arduino IDE by Sketch > Include Library > Add .ZIP Library
  • Now we need to do some changes in sketch as our setup, open the MC Lighting Arduino sketch and go to definitions.h file and just change the number of leds and data pin, in my case I used 8 leds and pin D1 . Also you can change the WiFi name here
  • Now compile and upload the sketch to the to ESP8266 board
  • After that the esp will act as a open access point, connect to it and enter your WiFi credentials, The ESP will connect to that wifi
  • Find its IP by checking Arduino IDE debug output or just check your router or wifi hotspot for connected devices.
  • Go to http://YOUR_ESP8266_HOSTNAME_OR_IP/upload and upload index.htm from the McLighting\clients\web\build directory.
  • Finally Restart the board and go to the IP address and you will have the remote interface to control.

Step 4: Connect All Things Together

I used total 8 leds and connect them in chain with wires. The charger, boost converter and the switch are placed in top of battery for fit in small place. from boost converter output 2 wires goes to Vin and GND of node mcu and Another to goes to +5v and GND of the ws2812b first led of series. I added a small femal pin header in the end of signal wire and node mcu power wires to connect easily in node mcu.

I have placed the battery and the node mcu in the back side of the hat and sew them with hat, also I sew the leds with the hat so they stay in place.

Step 5: Finishing Touch

After you have checked every things is Working fine, take a small piece of a black cloth and sew it to cover the back part of the hat for hiding the battery and NodeMCU,

I also painted leds connecting wires with black.

In the controller their is 50+ cool led effects and you can also control the speed and brightness of the leds.

Now you have a cool led hat. HAVE FUN!!

If you have any problems ask in comments, dont forget to vote this projects.

Wireless Contest

Participated in the
Wireless Contest

LED Contest 2017

Participated in the
LED Contest 2017