Santa Signaller

Jingle led, jingle led, wifi all the way!



Created by: Bram den Ouden, 2020-12-10


Introduction

We’re all locked up inside and the days are getting shorter and colder. Even Santa isn’t immune to these unhappy times and with his big days coming up, he needs al the motivation he can get.

What motivates people most you ask? flahsing lights ofcourse!

We could just upload the blink sketch and be done with it but blinking at the same frequency over and over again will quickly become dull as well….

To compensate this dullness-over-time effect, here’s a project that will cheer Santa up even more as he gets closer to christmas!

Design

The santa signaller is a device which blinks a group of leds at a varying frequency. This frequency is dependent on the amount of time left until christmas.

To this end, three individual LED groups are driven using BC547 transistors controlled by a WEMOS D1 mini. The current time will be obtained usinig the Network Time Protocol.

The project consists of a hardware and software part. The hardware part will be discussed in the next three chapters, after which the firmware and setup process will be discussed.

Microprocessor

As the brains of this project, a WEMOS D1 mini module was chosen. This module contains an Espressif ESP8266 chip and is thus natively able to connect to 2.4GHz WiFi networks.

The santa signaller’s behaviour changes based on the current time. To allow this, the WiFi option can be used to obtain accurate time everywhere in the world using the network time protocol. The Network Time Protocol (NTP) is a network protocol for clock synchronisation. To obtain time using this protocol, a client makes a request to a NTP server. The server responds with a message containing a timestamp in seconds since epoch.

This epoch timestamp consists of a 64 bit integer with a value of the amount of seconds sinds the first of January 1900. Different systems use different Epoch dates so make sure you dont for example confuse the NTP epoch (1 jan 1900) with the unix epoch (1 january 1970). There are many publicly available NTP servers across the world so selecting one closeby should be possible. pool.ntp.org/zone/europe contains a list of available NTP servers.

Transistors

The microprocessor can source/sink up to 25mA per GPIO. To have nice and bright lights each led needs to be driven by just under 20mA. Connecting three leds to a single pin would rapidly destroy this pin. An altertive option would be connection each led to a single pin. This is very possible for small amounts of leds but for the 9 leds we aim to controll with this project, the esp8266 chip would not suffice.

There is ofcourse a solutions to this problem: use a mosfet or transistor!

Mosfets or transistors can be used to switch higher currents and voltages using little power. Since there were no mosfets with a sufficiently low gate-source voltage on hand, a transistor was used during this project. Conditions we must satisfy for this is transistor lie in the collector emitter voltage and collector current. A transistor that can easily operate when bein driven by the WEMOS D1 mini is the BC547 (datasheet below figure 1).

The BC547’s base-emitter voltage has a typical value of 700-900mV. We bias the transistor using a 1 kOhm resistor and a 3.3V source, this results in a base current of approximately 2.5mA.

Figure 1 shows the collector current vs collector-emitter voltage at different base currents. As seen from this figure, the bias of 2.5mA is much more than required. To improve power efficiency, this bias current could be decreased by increasing the resistor value.

Figure 1: Collector current vs base-emitter voltage at different base currents

All numbers and figures have been taken directly from the datasheet: sparkfun.com/datasheets/Components/BC546.pdf

Schematics

Figure 2: Single led group

Figure 3: connections to WEMOS D1 mini

Each group of three leds connected to a single transistor is called a led group. The santa signaller consists of three of those groups. There are of course no physical limitations on where on the protoboard these leds can be soldered. Something to keep in mind when choosing led is the frowward voltage. Since only red, green and yellow leds were used, the forward voltage approximates 2.2V for each led. Using the 56 Ohm resistors as shown in figure 2 would yield a drive current of 19mA.

To verify the forward voltage of your leds, drive it using a current controller at 20mA (or the specified limit of your led). The voltage across the led is its forward voltage.

The transistor of each led group, labeled in figure 2 with ‘GPIO’, is connected to a pin of the WEMOS module, as shown in figure 3.

Component list

Component Amount
Proto board 1
LED 5mm green 3
LED 5mm red 3
LED 5mm yellow 3
BC547 3
Resitor 56 Ohm 9
Resistor 1 kOhm 3
Header 1

Firmware

The firmware for this project requests the current time from an NTP server every few hours. This time is compared to the timestamp at 00:00 on the 25th of december 2020 obtained using epochconverter.com/.

If the current timestamp is lower than the 25th, the difference is calculated and used to set an interval between led groups turning on. If the current timestamp is between the 25th 00:00 and the 26th 23:59: party time!! If howerver the timestamp is larger than the 26th 23:59, a value of 31536000 seconds (525600 minutes) is added and the countdown until next year starts.

To setup your santa signaller follow these steps:

  • Clone the github repository from https://github.com/klushok-etv/SantaSignaller
  • Open a terminal or git bash in the cloned repository
  • Execute git submodule update --init to get the libraries
  • Compile and upload the santaSignaler.ino to you ESP module
  • All attached leds should light up, this indicates the wificonfig portal has been launched
  • connect to the wifi network Santas-little-helper-<UID_of_ESP>
  • visit 192.168.4.1 and enter the credentials from the network you’d like to connect to
  • click save and restart
  • The santa signaller will now restart, connect to your chosen NTP server and start flickering more enthousiasticly as christmass approaches!

Results & conclusion

By placing an uncalibrated multimeter inline with the 3.3V line to the santa signaller, a current draw of 45-50mA per led group was measured. This current draw means each led is driven by approximately 15-17 mA. Altough this is slightly less than calculated, they’re still very bright! It is possible to decrease the brightness by applying a PWM signal to the output pins. Each pin of the WEMOS D1 mini can be used as a PWM signal by making just minor changes in the code.

With the happy results fo figure 4, Santa’s motivation will surely be through the chimney!

Figure 4: Results!

More info and code: