2019年7月24日星期三

WiFi Controlled Desk Lamp

A WiFi controlled desk light, essential for every maker and a great way to get into coding.

Things used in this project

Hardware components

Espressif Wemos D1 mini ×1

2m WS2812B LED Strip IP30 (choose IP30, any other rating will not fit!) ×1

DFRobot Gravity: Analog Sound Sensor For Arduino ×1

SparkFun Logic Level Converter - Bi-Directional (optional, required if the LEDs 'glitch') ×1

3 pin wire ×1

12x M3 * 8mm bolts ×1

M3 Nuts ×1

Female Power Jack ×1


Software apps and online services

ESP8266 - FastLED - Desk Light


Hand tools and fabrication machines

3D Printer (generic)

Soldering iron (generic)

White PLA

Black PLA


Story

Summary

A WiFi controlled desk light, essential for every 3D printing enthusiast and a great way to get into coding.


                        30+ unique patterns and easy to control


Controlled via an easy to use web interface that runs on the ESP8266.

It features a webserver running on ESP8266 that allows for easy access to the different patterns, brightness and power control. Everything was designed in Fusion360.

The code was written in Visual Studio using the Visual Micro plugin.

                             Webinterface of the application running on the esp 8266


Step One: Get your parts

I've used ICEFILAMENTS white & black PLA to print my parts. I recommend printing with 100% infill. All parts should be printed in black, except for the diffuser that one should be white.

The electronics & screws can be seen in the picture below:

                             Links to all components can be found in the components list

                                                 WS2812B IP30 LED-Strip with at least 2m


Step Two: Add the LEDs to the core

Now that you have printed your parts, you can slide in the leds into the core.Start by sliding in the leds from the top, the arrow must point from the base to the top.Afterwards cut the strip using scissors so they do not stick out on the top or the bottom.

Next cut another strip with the same length and slide it into the next slot. Now the arrow must point from the top to the bottom.

Repeat this and swap the direction every slot until all slots are filled with the strip.

                                     make sure to wire up the leds in the correct order

Step Three: Solder the LED strip pieces together

Use some 3 pin wire to connect the pieces together. When all pieces are connected, then the arrow must point in the same direction when following the wiring order.

Finally solder the starting point of the strip to the Wemos D1 mini, the arrow must face away from the microcontroller.

If you are using the microphone sensor connect it to the 5V power and the AD Pin to the A0 pin of the Wemos D1 mini.

Step Four: Mount the core to the connector plate

Take 8x M3 * 8 bolts and nuts to attach the core to the connecting plate.

Make sure the cutouts for the pillars are on the bottom.

Step Five: Solder the LEDs to the Wemos D1 mini

Connect all components according to the wiring diagram. Add the logic level shifter if the LEDs 'glitch'.


                                         afterwards glue the power jack into the base

Step Six: Attach the core to the base

Position the pillars onto the holes of the connecting plate of the core. Take 4x M3 * 8 bolts to attach the plate to the pillars of the base.

Step Seven: Install the Software

The software runs on the ESP8266. The web app is stored in SPIFFS (on-board flash memory). I've forked jasoncoon's esp8266 fastled webserver and added some extra functionality, made a proper config area and created custom patterns for the lamp.

The software and detailed setup instructions can be found on GitHub.

For beginners I would recommend watching this setup tutorial below.


                                    mind the versions of the libraries used

Step Eight: Connect to the web interface

Type the IP address of the Wemos D1 mini into any web browser on any mobile device and have fun! The IP can be found by connecting with the serial monitor or by looking at your routers client list.

Troubleshooting

Issues while compiling

  • Compiling shows typedef bool error: You might have esp8266 2.5.x installed in combination with an old version of fastled, install esp8266 2.4.2 or upgrade FastLED to 3.2.9.
  • Compiling shows tons of errors: You might have FastLED 3.2.7 installed, install 3.2.6 or update to 3.2.9.
  • Sketch Data Upload does not work: Try to install Arduino IDE 1.8.7 or 1.8.8Don't install hourly or beta builds of the Arduino IDE.
  • The Arduino IDE doesn't show the other files and says that files weren't found: The Arduino IDE requires that the filename of the.ino file has the same name as the folder it is in, if the names do not match, then the.ino file will be moved into a new folder, to fix it move the file up to the other files and make sure the folder name is the same as the one of the file.
  • Secrets.h file not found: Create the Secrets.h file according to the instructions.

Issues while uploading

  • The Arduino doesn't boot when the LEDs are attached: The LEDs might be wired in the wrong direction, the arrow must point away from the ESP8266.
  • The Sketch-Data-Upload outputs "esptool.exe not found:" Check if you are using Arduino IDE version 1.8.7 or 1.8.8, newer version might throw this error.

Issues with the Webinterface

  • The website just shows "not found :/"Check if you have uploaded the Sketch-Data.
  • Check if the Sketch-Data-Upload was successful.
  • The website doesn't load Check if you have entered the correct IP address. You have to be in the same network as the device.
Issues with the LEDs

  • The LEDs flicker a lot You might have bad soldering spots.Try to use a logic level shifter to shift the supplied data signal to 5V.
  • Not all of my LEDs turn on Check if you have correct values for LINE_COUNT and LEDS_PER_LINE. Check the wiring for errors.
  • My LEDs just light up white You might have FastLED 3.2.8 installed, install 3.2.6 or update to 3.2.9.


FAQ

  • Can I connect to the ESP8266 from outside of my local network? Yes, you can do this by creating a port forwarding rule on your router
  • Can I use the NodeMCU for this project? Yes, but it is way harder to position it into the base of the lamp
  • Can I use other LED-Strip types for this project? Yes, any FastLED compatible LED-Strip can be usedJust change the LED_TYPE
         Some Strips require changes to the FastLED.addLeds(...) lineA list of all compatible LED-Strips can be found here.

  • What power supply should I choose? 100x WS2812 LEDs draw around 3A, I would recommend 5V 3A for 60LEDs/m.


Custom parts and enclosures

3D Files (STL)

Make sure you print the diffuser in white with 100% infill!       Click here to download


Schematics

Schematic without the Logic Level Shifter           Download


Schematic with the Logic Level Converter (used when the LEDs 'glitch')   Download

Code

ESP8266 FastLED desk light

The software runs on the ESP8266. The web app is stored in SPIFFS (on-board flash memory). I've forked jasoncoon's esp8266 fastled webserver and added some extra functionality, made a proper config area and created custom patterns for the lamp. The software and detailed setup instructions can be found on GitHub. For beginners I would recommend watching this setup tutorial.

NimmLor / esp8266-fastled-desk-light

No description — Read More

Latest commit to the master branch on 6-20-2019  Download as Zip


This article copied from hackster.io, Author:  Lorenz Nimmervoll

没有评论:

发表评论