d-diot Mood Lamp

The brain of the d-diot Mood Lamp is the popular NodeMCU Lolin V3 board which integrates an ESP8266 IC, so in few words… Wifi connectivity!

The NodeMCU drives an array of WS2812B LED in form of ring (small lamp) or strip (XL lamp); a capacitive touch button, a buzzer and an appropriate circuit are integrated in the dedicated pcb.

A 3d printable case to host all the components has been designed in a modular way: the base of the lamp is the same for both small and XL lamp, so you can reuse it and design your own top parts (led strip support and lamp shade).

The firmware for the NodeMCU board is generated with ESPHome and this results in a super easy integration in Home Assistant. A lot of RGB effects are supported, see here for more details.

The capacitive touch button in the front of the lamp allows you to use the lamp like a normal (non smart) device. With a long press of the button the brightness can be increased or decreased.

Visit the topic forum if you need to know more about this device.

ESP8266-LolinV3-Lamp board

The d-diot mood lamp is built with the d-diot ESP8266-LolinV3-Lamp pcb. Both version of the board can be used, read the dedicated wiki page to know more.

Pcb version 1.0

Pcb version 2.0

The schematic and the entire Kicad project are available for download in the dedicated d-diot github repository. In the repository you can find the gerber files of the PCB, so you can easily get 10 boards with about 5€ using an online PCB manufacturer like JLCPCB or PCB way. Click the button below to download the complete set (zip) of gerber files necessary for the manufacturing.

Download Gerber ESP8266-LolinV3-Lamp v.1.0

Download Gerber ESP8266-LolinV3-Lamp v.2.0

NodeMCU LolinV3

The brain of Mood Lamp is the well known NodeMCU Lolin V3 board, which is based on the ESP8266 IC. The board is available in generic e-commerce platforms for 2 - 3 euros.

WS2812B Led ring (small lamp)

A 24 WS2812B (Neopixel) led ring like the one in the picture below is used in the small lamp. Of course you can use a led ring with a different number of led, but remember to change the firmware configuration file.

This kind of led rings can be found in generic e-commerce platforms for around 2-3€ (example here).

WS2812B Led strip (XL lamp)

In the XL lamp a WS2812B (Neopixel) led strip is used; the tower is designed to host a 1 meter long strip and in my case I have used a strip with 60 led / meter. Of course you can use a strip with the length an led density that you prefer, but remember to change the number of led in the firmware and make sure that your power supply can deliver enough current (60 mA / led).

A WS2812B (Neopixel) led strip can be easily found in generic e-commerce platforms and the price depends on the length and led density (example here).

Power supply

To power the Mood Lamp there are 2 options:

Option 1: external power supply (5V) and power jack (panel mount)

In this case you need a AC/DC 5V power adapter and a panel mount female power jack. Both components can be found in generic e-commerce store (example here and here).

The advantage of this option is that you can choose the size and the max current of the power supply on the basis of the number of LED in your lamp; this is the way to go for the XL lamp.

Option 2: internal AC/DC 5V adapter

In the market you can find some small AC / DC 5V adapters like this one. The base of the d-diot Mood Lamp has a support for them, so in this case you can connect your lamp directly to the wall plug.

Unfortunately this small modules have a limited max current rate (in general 1A) so they are useful only if the number of LEDs to power is limited, like in the small lamp

Power switch

The base of the d-diot Mood Lamp has a hole to host a power switch to completely cut off the power. The switch can be used with both options of power supply (see above).

Any switch compatible with the dimensions reported in the picture above can be used without any modification at the base of the lamp. For example I have used one of this.

Buzzer

This simple component is available on the market in generic e-commerce platforms.

It produces a very annoying sound, adjustable in frequency in the firmware, every time you turn the lamp on or off through the capacitive touch button.

TTP223 Capacitive touch button

This button is available on the market for few cents.

Respect to a mechanical button, it does not generate spurious open/close transitions when pressed and simplify the design of the external case.

Light dependent resistor (photoresistor)

This simple component (GL5537) is available on the market in generic e-commerce platforms or in electronics parts stores for few cents.

With the appropriate circuit, like the one present in the esp8266-lolinv3-lamp board, this component can provide the light level of the ambient.

Microphone (optional)

The base of the d-diot lamp has 2 slot to host (left and right) one microphone like the one in the picture below. The board has a dedicated connector (J6) to connect it.

This component is available in generic e-commerce stores for around 1€ (example here)

In the firmware the microphone is disabled but is sufficient to uncomment the lines to activate them (see firmware). Please note that the NodeMCU has only 1 analog input, so you can not use the light sensor and the analog output of the mic at the same time. However the digital output of the mic has a dedicated pin, so it is usable at the same time with the photoresistor.

With a little bit of development on the firmware the microphone can be used to create vu-meter effect in the lamp or to implement a sort of clapper.

30 mm fan (optional - Lamp XL only)

The tower of the Mood Lamp XL has a space to host a 30 mm fan to keep the temperature inside the lamp low.

This components is available in generic e-commerce stores for around 1-2€. For example I have used one of this.

Please note that the fan is turned on only when the light is on.

Electronic components

See the wiki page of the ESP8266-LolinV3-Lamp board for more details.

Board v.1.0

The following components are required:

References Value Footprint Quantity
C1 1000uF Capacitor CP_Radial_D10.0mm_P5.00mm 1
C2 0.1uF Capacitor C_Disc_D6.0mm_W4.4mm_P5.00mm 1
R3 10K Resistor R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal 3
R4 100K Resistor R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal 1
R5 470R Resistor R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal 1
R6 200R Resistor R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal 1
R7 56K Resistor R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal 1
JP1 Jumper_3_Open Connector PinHeader_1x03_P2.54mm_Vertical 1
Q6 FDN337N Mosfet SSOT-3 2
Q4 FDN338P Mosfet SSOT-3 1
Q1 IRLB8721PBF Mosfet TO-220-3_Vertical 1
Q5 FQP27P06 Mosfet TO-220-3_Vertical 1
J4 LED Connector PinHeader_1x03_P2.54mm_Vertical 1
J5 BUTTON Connector PinHeader_1x03_P2.54mm_Vertical 1
J2 PWR Connector PinHeader_1x04_P2.54mm_Vertical 1
J6 MIC Connector (optional) PinHeader_1x04_P2.54mm_Vertical 1

Board v.2.0

The following components are required:

References Value Footprint Quantity
C1 1000uF Capacitor CP_Radial_D10.0mm_P5.00mm 1
C2 0.1uF Capacitor C_Disc_D6.0mm_W4.4mm_P5.00mm 1
R3 10K Resistor R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal 1
R4 100K Resistor R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal 1
R5 470R Resistor R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal 1
R6 200R Resistor R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal 1
R7 56K Resistor R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal 1
D1 1N4007 Diode (optional) D_DO-41_SOD81_P10.16mm_Horizontal 1
U2 SN74AHCT125DR IC SOIC127P600X175-14N 1
JP1 Jumper_3_Open Connector PinHeader_1x03_P2.54mm_Vertical 1
Q4 FDN338P Mosfet SSOT-3 1
Q6 FDN337N Mosfet SSOT-3 1
Q5 FQP27P06 Mosfet TO-220-3_Vertical 1
J8 FAN Connector (optional) PinHeader_1x02_P2.54mm_Vertical 1
J9 PWR-2 Connector (optional) PinHeader_1x02_P2.54mm_Vertical 1
J4 LED Connector PinHeader_1x03_P2.54mm_Vertical 1
J5 BUTTON Connector PinHeader_1x03_P2.54mm_Vertical 1
J2 PWR Connector PinHeader_1x04_P2.54mm_Vertical 1
J6 MIC Connector (optional) PinHeader_1x04_P2.54mm_Vertical 1

3d printable case

The 3d model files and the print instructions of the case are available in thingiverse.

If you don't have access to a 3d printer, you can consider an online 3d printing service.

Spare parts

To complete the build you need the following parts:

  • M2.5 self tapping screw
M2.5 self tapping screw

A cost estimation of the entire lamp is something between 10-15€, but it depends on which type of LED array, power supply, case and optional components you choose.

Well, this is the most time consuming part of the building, but once you have started the print job, you don't have too much to do except watching your 3d printer at work, so you can proceed with the other steps.

The model files are here.

Solder the components

Some components are THT, while some other are SMD, but generally with a package that is not so difficult to handle. The tools required for soldering the components of this board are the same of the d-diot board. See this to know what tools you need.

Use the interactive BOM tool to see where to place each component for the board v.1.0 and for the board v.2.0

This is how the board v.1.0 should looks with all the component soldered

Jumper configuration

See this.

Assembly and wiring

Main power

Option 1: External power supply
  • Solder 1 (black) to the negative pole of the power jack
  • Solder 1 (red wire) to the positive pole of the power jack and one red wire to one terminal of the power switch.
  • Insert the power power jack and the power jack in their holes in the lamp base
  • Solder the red wire coming from the positive pole of the power jack to the free pole of the power switch.
Option 2: Internal power supply
  • Connect the neutral wire (blu) from the power cord to the input of the AC / DC 5V 1A power supply
  • Solder the phase wire (brown) from the power cord to one terminal of the power switch.
  • Solder a brown wire to the free terminal of the power switch and connect the other end of the wire into to the other input PIN of the AC / DC 5V 1A power supply
  • Solder a red wire to the + output of the AC / DC 5V 1A power supply
  • Solder a black wire to the - output of the AC / DC 5V 1A power supply
  • Place the AC / DC 5V 1A power supply in its slots in the base and fix it with M 2.5 self tapping screws.

Board placement

  • Connect the negative wire (black) coming from the power source to the GND pin of J4 Connector of the board. A pcb screw terminal can be used (like in the picture), or solder directly the wire to the board.
  • Connect the positive wire (red) coming from the power source to the +5Vin pin of J4 Connector of the board. A pcb screw terminal can be used (like in the picture), or solder directly the wire to the board
  • Solder two wires to the legs of the photoresistor and place the photoresistor in the dedicated hole of the lamp base.
  • Solder the wires of the photoresistor to the board connector R8
  • Fix the board to the lamp base with two M2.5 screw

Install the capacitive touch switch

  • Connect 3 jumper wires to the capacitive touch switch
  • Insert the switch in the slot of lamp base
  • Connect the jumper wires of the switch to the J5 connector of the board

LED placement

Option 1: LED strip - Lamp XL
  • Fix the LED strip to the tower and use a bit of hot glue to secure it in position
  • Install the optional 30 mm fan into the dedicated slot located at the base of the tower.
  • If you are using the board V.1.0 connect the positive wire of the fan (red) to the positive wire of the led strip (red) and connect the negative wire of the fan (black) to the positive wire of the led strip (white). In the board v.2.0 this is not necessary because a dedicated fan connector is present
  • Connect the strip wires to the LED connector (J4) of the board. Check the correct correspondence of the PIN.
  • Fix the tower to the base with M 2.5 self tapping screws.
Option 2: LED ring - Small lamp
  • Solder 3 female jumper wire to VCC, GND, and IN pads of the led ring
  • Insert the led ring in the 3d printed support
  • Connect the jumper wires to the LED connector (J4) of the board. Check the correct correspondence of the PIN.
  • Fix the LED ring holder to the base with M 2.5 self tapping screws.

Lamp shade

Install the 3d printed lamp shade on top of the base.

The configuration file in yaml format, necessary to generate the firmware with ESPHome, are in the dedicated d-diot github repository.

ESPHome has a user-friendly web interface (dashboard) to manage all your firmwares and devices and it is integrated in the d-diot image.

The first time that you have to upload of the generated firmware to the board, connect the NodeMCU to a free USB port in you Raspberry Pi and in the dashboard (top right corner) select the appropriate USB port. For the next uploads you can use the over the air method without any connection.

In the provided configuration file in yaml format, make sure to set the right numbers of LED in the ligh section (num_leds: XX parameter) and in the fire effect function (static byte heat[XX]).

Change the SSID and password of the wifi network according to your needs.

  • Single button press: turn lamp on and off
  • Long button press: increase the brightness. To decrease the brightness release the button, press it again and hold within 2 seconds

If your plan is to control the lamp through vocal commands with an assistant like Amazon Alexa, read this guide!

  • sensors_and_actuators/esphome/mood_lamp.txt
  • Last modified: 2019/12/31 09:33
  • by franzunix