← Home
Maker's Halloween LED sign · ESP8266 retrofit

Make the Halloween sign turn itself on at sunset

Swap the two AA batteries for a D1 Mini Wi-Fi board and one transistor. The sign then lights up at local sunset every evening and switches off at midnight. Sunset moves with the season, and daylight saving time is handled for you.

Time about 2 hoursSkill basic solderingCost parts you already own + a USB charger
System overview: USB charger powers the D1 Mini, which drives a transistor that switches the sign's LEDs 3.3 V from the D1 Mini replaces the AAs shared ground (G) USB charger 5 V, 1 A D1 Mini Wi-Fi + clock Transistor Q1 electronic switch Sign battery box switch ON → 10 LEDs USB GPIO5 LED −
How it works. The D1 Mini runs off a phone charger, gets the time from the internet and calculates today's sunset. At sunset it turns on the transistor, which completes the LED circuit. At midnight it turns the transistor off.

A · Gather everything

Everything except the charger, a cable and the tools comes from your two Amazon orders.

Parts

Tools

1a

Find the right pins in the D1 Mini bag

Each D1 Mini came with a few small black plastic strips. These are header pins. Soldered to the D1 Mini, they let it plug into the breadboard.

Use these: pin headers short end black plastic long end 8 pins per strip · you need 2 strips longer strip? snap it between pins 8 and 9 Set these aside socket strips holes on top, short legs
Pick out two strips that have metal pins sticking out of both sides of the black plastic, one side shorter than the other. Strips with holes on top are sockets for stacking boards; you don't need them.
  • You need two strips of 8 pins, one for each long edge of the D1 Mini.
  • If a strip is longer than 8 pins, count 8 and snap it between pins 8 and 9 with pliers.
  • The D1 Mini has 8 holes along each long edge. That's where these pins go.
1b

Learn how the breadboard is wired inside

Lay the breadboard flat in front of you, long side left to right, and turn it so column 1 is on your left. Each hole has a name: a letter for the row (a–j) and a number for the column, like a5. Both are printed along the edges.

abcdefghij15101520…a5–e5: one connected stripf5–j5: a separate stripcenter gap: nothing crosses itpower rails: not used herepower rails: not used here
Only the left end of the breadboard is drawn; yours is longer. Inside, the 5 holes in each short column strip are joined by a metal clip, so anything plugged into a5, b5, c5, d5 or e5 is connected. The f–j half is a separate strip. The two long red and blue rails along the edges aren't used in this project.

This is the one idea that makes the rest work: two things are connected when they're plugged into the same numbered column, on the same side of the center gap.

Hole names in brackets. The drawings show row a at the top (the edge farthest from you). Some breadboards are printed the other way, with j at the top. If yours is, put everything in exactly the same physical spot as the drawing and use the hole name in brackets, like a5 (j5).
1c

Solder the pins to the D1 Mini, using the breadboard as a jig

You'll solder the pins while they sit in the breadboard. That keeps them straight, and it leaves the D1 Mini in exactly the spot the rest of this guide uses.

breadboard holds the pins straight while you solder ESP-12F soldering iron solder every pin from the top: a small shiny cone, not a ball D1 Mini, writing + silver can facing UP black plastic UNDER board long pin ends go DOWN into rows b and i, columns 5–12
Side view. The black plastic sits on the breadboard, the D1 Mini rests on the plastic, and you solder the short pin tips sticking up through the board.
  1. Push the long ends of one strip into holes b5 through b12 (8 holes in a row). Push until the black plastic sits flat on the breadboard.
  2. Push the second strip into holes i5 through i12. There are 9 hole spaces between the two strips, counting the center gap, which matches the D1 Mini's width. (These two rows are the same whichever way your board is printed.)
  3. Hold the D1 Mini with the silver ESP-12F can and the printed pin names facing up and the USB socket pointing left, toward column 1.
  4. Lower it onto the strips so the short pin tips come up through all 16 holes along its edges. It rests on the black plastic.
  5. Check the corners: 3V3 should be top-left (far side, near the USB end) and 5V bottom-left. If not, lift it off and turn it around.
  6. Solder one corner pin, check the board sits flat, then solder the opposite corner. Then do the other 14. Touch the iron to the pin and the ring of copper around it for 2 seconds, feed in solder, then pull both away.
  7. Look at every joint: 16 shiny cones, and no solder bridging two neighboring pins.
  8. Leave it in the breadboard. It's now in its final position.
abcdefghij15101520…ESP-12FD1 MiniUSB socket ←3V35VD8GD7D4D6D3D5D2D0D1A0RXRSTTXa5 → 3V3j6 → Gj10 → D1
Top view once soldered. The three pins you'll use are ringed: 3V3, G and D1. The D1 Mini covers rows b–i, so the only free holes in those columns are in row a (above) and row j (below). Each wire goes into a free hole in the same column as its pin.

B · Load the software

Do this before touching the sign. Everything here happens on your Mac with the D1 Mini plugged in by USB.

2

Install Tasmota on the D1 Mini

Tasmota is free firmware for ESP8266 boards. It has built-in timers that run at sunset, so you don't have to write any code.

  1. Plug the D1 Mini into your Mac with the micro-USB cable.
  2. In Chrome, open tasmota.github.io/install.
  3. Choose Tasmota (english) and click Connect. Pick the port that appears, usually named USB Serial or wchusbserial….
  4. Tick Erase device, then click Install. It takes about a minute.
  5. When it finishes, the installer offers Configure Wi-Fi. Choose your home network and type its password.
  6. Click Visit Device. A Tasmota page opens at an address like http://192.168.1.57. Bookmark it.
No port in the list? Your cable is probably charge-only. Try a different one; this is the most common snag. Wi-Fi won't connect? The ESP8266 only works on 2.4 GHz networks, not 5 GHz.
In your router's settings, reserve that IP address for the device so the bookmark keeps working.
3

Tell Tasmota which pin drives the lights

  1. On the device page, click Configuration → Module (newer versions call it Configure Module).
  2. Set Module type to Generic (18), click Save and wait for it to restart.
  3. Open Module again. Next to D1 GPIO5, choose Relay and number 1. Click Save.
  4. The main page now has a big Toggle button and shows ON/OFF. Nothing is wired to it yet, so nothing visible happens.

GPIO5 (labelled D1 on the board) is used because it stays off while the board starts up, so the sign won't flash on every reboot.

4

Set your location, clock and schedule

On the main page click Consoles → Console. Paste each line below into the box at the bottom and press Enter, one line at a time.

DeviceName Halloween Sign
The name shown on the device page.
Latitude 42.33
Your latitude. 42.33 is Detroit; replace it with your own (right-click your house in Google Maps to copy it).
Longitude -83.05
Your longitude. Keep the minus sign: west is negative.
Timezone 99
Use the daylight-saving rules from the next two lines.
TimeDst 0,2,3,1,2,-240
EDT starts the 2nd Sunday of March at 2 am (UTC−4).
TimeStd 0,1,11,1,2,-300
EST starts the 1st Sunday of November at 2 am (UTC−5).
Timer1 {"Enable":1,"Mode":2,"Time":"00:00","Window":0,"Days":"1111111","Repeat":1,"Output":1,"Action":1}
On at sunset, every day. Mode 2 means sunset, and Time is an offset: use "00:15" for 15 minutes after sunset.
Timer2 {"Enable":1,"Mode":0,"Time":"00:00","Window":0,"Days":"1111111","Repeat":1,"Output":1,"Action":0}
Off at midnight, every day. Change Time for a different off time, for example "22:30".
Timers 1
Turns on the timer system.
Status 7
Check: the reply should show the correct Local time and today's Sunset.
Approximate on-times for Detroit through the season; lights go off at midnight each night 3 pm5 pm 7 pm9 pm 11 pm1 am midnight: off Oct 1on 7:17 pm Oct 15on 6:54 pm Oct 31on 6:31 pm Nov 1on 5:30 pm · clocks fell back Nov 15on 5:13 pm
What the schedule will do, using approximate Detroit sunset times. The on time moves earlier every day. When daylight saving ends on Sunday, November 1, it jumps an hour earlier on the clock, and Tasmota handles that by itself.

C · Prepare the sign

You'll run the sign's own LED circuit from the D1 Mini's 3.3 V supply instead of batteries.

5

Open the sign and remove the batteries for good

  1. Unscrew the back panel: the brown MDF board that holds the battery box and LED string.
  2. Take out both AA batteries.
  3. Slide the sign's switch to ON and leave it there. It's in series with the LEDs, so from now on it works as a manual master switch.
Never put AA batteries back in while the D1 Mini is connected. They would push current backwards into the D1 Mini's 3.3 V supply. Put a strip of tape over the battery door as a reminder.
6

Find the box's + and − terminals

Look into the empty battery compartment. At one end, a metal strip joins a spring to a flat plate: that's the bridge between the two cells, so leave it alone. At the other end are a spring and a flat plate that aren't joined. Those are the two terminals you'll solder to.

Two-AA battery box: bridged contacts at the top, the two terminals at the bottom +− −+ (empty) bridge strip: leave alone − terminal blue lead → Q1 C + terminal red lead → 3V3
Top view of a typical 2 × AA box, with the cell outlines drawn only to show orientation. Yours may be mirrored. Follow the + / − marks molded into the plastic: the flat plate is + and the spring is −.
7

Solder a lead to each terminal

  1. Take a red and a blue male-to-male jumper wire and cut each one in half. Keep the half with the pin end; each lead is about 10 cm.
  2. Strip 5 mm from each cut end and twist the strands. Tin the ends: melt a little solder into them.
  3. Scrape the solder spot on each contact with a knife or sandpaper until it's shiny. Battery contacts are plated steel and won't take solder otherwise. Flux helps a lot.
  4. Solder red → the + flat plate and blue → the − spring. Solder to the back face of the contact, or to its tab if one pokes out behind the end wall, so the wire doesn't block the compartment.
  5. Work quickly, 2–3 seconds per joint, so the plastic doesn't melt. Route both leads out of the box toward where the D1 Mini will sit.
Solder won't stick? Wrap the bare wire tightly around the contact's tab and hold it with a blob of hot glue. 3.3 V at these currents is very forgiving.
8

Do a quick polarity test, with no transistor yet

Unplug USB. The leads from step 7 have a metal pin on the end: push it straight down into the hole until it stops, about 5 mm. A gentle tug shouldn't pull it out.

  1. Push the red lead's pin into a5 (j5). That's the free hole directly above the pin labelled 3V3, just outside the D1 Mini's edge.
  2. Push the blue lead's pin into j6 (a6). That's the free hole directly below the pin labelled G.
  3. Plug in USB. All 10 LEDs should light at normal brightness.
  4. Unplug USB and pull the blue lead out of j6 (a6). Leave the red lead in a5 (j5); that's where it stays.

If nothing lights, check the sign's switch is ON, then swap the two leads. A few seconds of reversed 3.3 V won't harm the LEDs. If they light only after swapping, you mixed up + and − in step 7. Re-solder them, or remember from now on that your "red" lead is the one that goes to 3V3.

D · Build and test on the breadboard

Prove the whole thing works before soldering anything permanent.

9

Identify the transistor and the resistor

The ELEGOO kit keeps transistors and resistors in labelled compartments. Read the printing on the transistor's flat face to be sure which one you have.

TO-92 transistor pinout: flat face toward you, legs down, Emitter Base Collector from left to right PN2222A or S8050 E B C flat face with theprinting toward you legs pointing down E → ground (G) B → 1 kΩ → D1 C → battery − EmitterBaseCollector
The PN2222A and S8050 are both E-B-C from left to right. A part printed 2N2222 from some brands is C-B-E, so if yours says that, flip it around.
1 kilo-ohm resistor colour bands in 5-band and 4-band styles Kit style, 5 bands brown · black · black · brown · brown 4 bands brown · black · red · gold 1 kΩ resistor (either direction is fine)
The kit's resistors are blue 5-band types and come in compartments labelled with their value. Look for 1KΩ.
10a

Plug in the transistor

Unplug USB before every change on the breadboard. Build in this order, one part per step, and compare with each picture before going on.

  1. Hold the transistor with its legs pointing down and its flat, printed face pointing away from you, toward the center gap and the far edge. You're now looking at its rounded back.
  2. Seen from this side, the legs are reversed from the step 9 picture. From your left they're C, B, E.
  3. Spread the legs slightly so they line up with three neighboring holes.
  4. Push the legs into g18 (d18), g19 (d19) and g20 (d20): left leg (C) in column 18, middle (B) in 19, right (E) in 20. Check the flat face still points away from you.
  5. Push down until about 5 mm of leg shows above the board.
abcdefghij15101520…ESP-12FD1 MiniUSB socket ←3V35VD8GD7D4D6D3D5D2D0D1A0RXRSTTXCBEC g18 · B g19 · E g20
The transistor is in the lower half, to the right of the D1 Mini. Its flat face points up in the picture, toward the center gap. Columns 18, 19 and 20 now belong to C, B and E. Facing it this way keeps the wires from crossing in the next steps.
10b

Plug in the 1 kΩ resistor

  1. Bend both resistor legs straight down at a right angle, about 3 mm from the body. It doesn't matter which end goes where.
  2. Push one leg into j10 (a10). That's the free hole directly below the D1 Mini's D1 pin (not D2, not D4).
  3. Push the other leg into j19 (a19), in column 19 like the transistor's middle (B) leg.
  4. The resistor lies along row j, just above the holes between its ends. That's fine: it only connects where its two legs go in.
abcdefghij15101520…ESP-12FD1 MiniUSB socket ←3V35VD8GD7D4D6D3D5D2D0D1A0RXRSTTXCBEj10 (D1)j19 (B)
D1 pin → resistor → transistor base. Column 19 joins j19 to the base leg in g19.
10c

Add the black ground jumper

  1. Take one black male-to-male jumper wire from the kit. It has a pin on both ends. Any color works, but black means ground.
  2. Push one end into j6 (a6), the free hole directly below the G pin.
  3. Push the other end into j20 (a20), in column 20 like the transistor's right (E) leg.
  4. Let the wire loop around the outside of the resistor. If it touches the resistor, that's fine: wires only connect at their ends.
abcdefghij15101520…ESP-12FD1 MiniUSB socket ←3V35VD8GD7D4D6D3D5D2D0D1A0RXRSTTXCBEj6 (G)j20 (E)
Ground pin → transistor emitter.
10d

Check the red lead from the sign

  1. The red battery lead should still be in a5 (j5) from step 8, the free hole directly above 3V3. If you took it out, put it back there.
  2. It goes into the main board area, not the long red rail along the edge.
abcdefghij15101520…ESP-12FD1 MiniUSB socket ←3V35VD8GD7D4D6D3D5D2D0D1A0RXRSTTXCBESign battery boxswitch ON · no batteries+−a5
3V3 → the battery box + terminal. This powers the LEDs in place of the AAs.
10e

Plug in the blue lead from the sign

  1. Push the blue battery lead's pin into f18 (e18). That's in column 18, like the transistor's left (C) leg, in the hole between the transistor and the center gap.
  2. Don't put it in column 6 (G) as you did for the test in step 8. It now goes through the transistor.
abcdefghij15101520…ESP-12FD1 MiniUSB socket ←3V35VD8GD7D4D6D3D5D2D0D1A0RXRSTTXCBESign battery boxswitch ON · no batteries+−f18 (C)
Battery box − terminal → transistor collector. The circuit is now complete.
10f

Check every connection before powering up

Go down this list and touch each part as you check it. It takes 30 seconds and catches most mistakes.

PartRow a at topRow j at topWhat it connects
Transistor (flat face away from you)g18 C · g19 B · g20 Ed18 C · d19 B · d20 EQ1 sits right of the D1 Mini
1 kΩ resistorj10 → j19a10 → a19D1 pin → base
Black jumperj6 → j20a6 → a20G pin → emitter
Red lead (sign +)a5j53V3 pin → battery box +
Blue lead (sign −)f18e18collector → battery box −
  • Nothing is plugged into the long rails along the edges.
  • The transistor's three legs aren't touching each other.
  • The sign's switch is ON and there are no batteries in it.

If your D1 Mini's printed pin names don't match the drawings, trust the pin names: each wire goes into the free hole in the same column as 3V3, G or D1.

11

Test it

  1. Plug in USB and wait about 10 seconds for the board to join Wi-Fi.
  2. Open the device page and click Toggle. The sign should light, and go dark when you click again.
  3. Or type Power1 1 and Power1 0 in the Console.
You can leave it running on the breadboard for one evening to watch it come on at sunset by itself before you make it permanent.

Not working? See Troubleshooting at the end.

E · Make it permanent

Replace the breadboard with soldered wires so everything fits inside the sign.

12

Solder the final circuit

You can use the same D1 Mini and solder wires onto its header pins, trimmed short. Or take a fresh one without headers, repeat steps 2–4 to set it up, and solder the wires straight into its holes, which ends up smaller.

Permanent wiring: D1 Mini pads wired to a transistor with a resistor soldered to its base, and leads to the battery box ESP D1 Mini 3V3D8D7D6 D5D0A0RST 5VGD4D3 D2D1RXTX Q1 bend E and C apart EC R1 1 kΩ, solderedto the middle (B) leg dashed boxes: tape or heat-shrink each bare joint battery box +−
3V3 → battery +G → emitterD1 → resistor → basecollector → battery −
  1. Prepare the transistor. Bend the outer legs (E and C) outward so they can't touch the middle leg or each other.
  2. Resistor to base. Twist one leg of the 1 kΩ resistor around the tip of the middle (B) leg. Solder, trim the excess and cover the joint with tape or heat-shrink.
  3. Ground. Solder a black wire about 8 cm long from the D1 Mini's G pad to the E leg.
  4. Signal. Solder a yellow wire from the D1 pad to the free end of the resistor.
  5. 3.3 V. Cut the pin off the red battery lead, strip it and solder it to the 3V3 pad.
  6. LED return. Cut the pin off the blue battery lead, strip it and solder it to the C leg.
  7. Insulate. Cover every bare joint, then wrap the transistor and resistor together in a few turns of tape. Nothing bare should be able to touch anything else.
  8. Re-test before mounting: plug in USB and click Toggle, as in step 11.
13

Mount it and bring the cable out

Inside the back panel: battery box, LED string, D1 Mini glued nearby, USB cable leaving through a notch battery box D1 Mini hot glue / foam tape Q1 + R1, taped ½ in. notch to charger
The inside of the back panel, roughly as in your photo. The D1 Mini sits next to the battery box, and the USB cable leaves through a notch in the bottom edge.
  1. Stick the D1 Mini to the MDF with hot glue or foam tape, close to the battery box. Keep the silver ESP-12F end clear of anything metal so Wi-Fi reception stays good.
  2. Tuck the taped transistor bundle beside it and dab it in place with hot glue.
  3. File a notch in the bottom edge of the panel, or drill a ½ in. hole. A micro-USB plug fits through ½ in.
  4. Thread the cable through and plug it in. Leave a little slack, then hot-glue or zip-tie the cable to the panel. The D1 Mini's USB socket is fragile, and a tug on the cable could rip it off.
  5. Screw the back panel on. Check the sign's switch is still ON.
14

Plug it in and confirm the schedule

  1. Plug the cable into the wall charger where the sign will live.
  2. Open the device page and click Toggle once to confirm the sign still works, then set it back to OFF.
  3. In the Console, run Status 7 once more. The Sunset value is when the sign will light tonight.
  4. Run Timers to confirm both timers are enabled.

That's it. The sign now lights at sunset and goes dark at midnight every day, with no batteries to replace.

Power cut in the evening? If the power blinks after sunset, the sign stays off until the next sunset. Click Toggle to turn it back on for the night.

Troubleshooting

What you seeLikely cause and fix
Chrome shows no serial portThe cable is charge-only. Use a different micro-USB cable.
Can't find the device after setupWi-Fi didn't connect (2.4 GHz only). The board then opens its own tasmota-xxxx network: join it, browse to 192.168.4.1 and enter your Wi-Fi details again.
Toggle does nothing; LEDs stay offCheck the sign's switch is ON. Check that the red and blue leads aren't swapped (redo step 8). Check that the transistor's flat face points away from you (legs C-B-E from your left), and that the resistor goes below D1, not D4 or D2.
LEDs always on, even when OFFCollector and emitter are swapped or touching, or the blue lead is plugged into a G column. Recheck the table in step 10f.
LEDs very dimThe resistor isn't 1 kΩ (a 100 kΩ looks similar: brown-black-black-orange). Or the blue lead is in the base column.
Turns on at the wrong timeRun Status 7. If the time is off by hours, re-enter Timezone 99 and the two Time… lines. If the sunset time is wrong, check the sign of Longitude: it should be negative.
Board restarts when the LEDs come onThe charger or cable is too weak. Use a charger rated 1 A or more and a shorter cable.