Christmas is coming and its that time of the year again when the electronics student or hobbyists thoughts turn to making a Christmas circuit for their home and especially one that flashes a few lights.
There are many circuits and kits on the market that can flash any number of lights periodically, randomly or sequentially but one very versatile IC that the hobbyist or student can use to produce a simple Christmas Lights Sequencer for use in a variety of different seasonal lighting displays is the CMOS 4017B Johnson Counter.
The 4017B is a fast switching 5-stage Johnson decade counter complete with ten fully decoded outputs (making a total of 10 individual light sources). These ten outputs switch sequentially one at a time on the arrival of each new positive-going edge of the clock pulse. Only one output is at logic “1” or “HIGH” at any one moment while all others are cleared at logic “0” or “LOW”, so it can produce a moving sequence or chaser effect, making the 4017 ideal as a sequential LED or lighting display for a Christmas lights project.
The 4017B is basically a circulating shift register in which its serial outputs are connected back to its serial inputs in order to produce a particular sequence. The 4017B Johnson counter can also be used in frequency division applications as well as decade counter or decimal decode display applications.
The 4017B is classified as counter because it exhibits a specified sequence of states upon the application of a clock signal or pulse. As the 4017B is used as a synchronous counter, the switching action of all the internal flip-flops are from the common clock signal as shown.
But before we can use the 4017B Johnson counter as part of our Christmas lights sequencer circuit, we need to produce a timing signal. There are many different ways of producing a timing or clock signal using dedicated IC’s such as the NE555 or discrete astable multivibrator circuits using transistors or crystal oscillators. The list is endless. But one very simple and effective way of producing a square wave timing signal with the minimum of components is by using a Schmitt trigger inverter.
The Schmitt Trigger, named after its inventor, is a voltage level sensitive two-state device in the form of an inverter or NOT-gate. The advantage of using a Schmitt trigger to produce a variable square wave timing signal is that it uses a special threshold circuit that produces hysteresis, that prevents erratic switching by “squaring up” the trigger voltage as it switches between states. This allows reliable switching to occur between “HIGH” and “LOW”, or logic “0” and logic “1” making it ideal as a square wave timing signals for our Christmas lights sequencer project.
Consider the Schmitt Inverter as shown. When the position of the potentiometer wiper is at the bottom of the diagram, the voltage input to the Schmitt inverter is low representing a logic level “0”, and below the lower input threshold level of the logic gate. As the Schmitt trigger is an inverter, the resulting output will therefore be high at a logic level “1”.
As the potentiometers wiper is moved towards the +5V, there becomes a point when the voltage at Vi is equal or higher than the higher threshold input or higher trip point ( VHTP ) causing the Schmitt inverter to change state. There is now a situation were the input is at logic level “1” and the output is at logic level “0”. Then the Schmitt trigger acts as an inverter or NOT Gate.
Likewise, if the position of the potentiometer wiper is at +5V and lowered towards 0V, there becomes a point when the voltage at Vi is equal or lower than the lower threshold input or lower trip point ( VLTP ) causing the Schmitt inverter to change state once again.
Then by changing the value of the voltage on the input of the Schmitt inverter between its upper and lower threshold trip points, we can cause the output to change state, and this is the basic idea behind the Schmitt astable oscillator circuit. By replacing the potentiometer with an RC (Resistor-Capacitor) circuit as shown we can charge and discharge the capacitor through the Schmitt inverter.
Assuming that the timing capacitor, CT is fully discharged and the input to the Schmitt trigger is at logic “0”, therefore its output is at logic “1”, the capacitor will start to charge up exponentially through the timing resistor, RT from right to left. The speed at which the capacitor charges will depend upon their RC time constant.
At some point, the voltage across the capacitors plates will reach the higher threshold value of the Schmitt trigger causing the output to switch from a logic “1” to a logic “0”. As the output from the Schmitt trigger is effectively at a 0v potential, the capacitor starts to discharge back through the timing resistor, RT from left to right at a speed determined by their RC timing constant.
When the voltage across the plates of the discharging capacitor reaches the lower threshold value of the Schmitt trigger, it causes it to change state and the whole process repeats.
Generally, the higher threshold point, VHTP typically occurs around the 65% (2/3rds) of the supply voltage while the lower threshold point occurs around 35% (1/3rd) of the supply voltage. Any Schmitt trigger inverter such as the 4106, 4584, 74LS14, 74LS19, etc can be used to generate a timing signal or even Schmitt NAND gates such as the 4093, 74LS132, etc.
However, using different logic families whether CMOS or TTL (74LSxx, 74HLSxx, 74HCTxx) will result in different upper and lower trip points resulting in differing operating frequencies and mark-to-space ratios of the output timing waveform. Generally the error in the oscillating frequency for different logic sub-families is not a problem especially at higher frequencies, but can be anywhere from 1.2RC to 1.5RC with the generalised formula for a Schmitt astable waveform generator given as:
Where: Beta ( β ) can be any fixed value between 1.2 and 1.5 depending upon the logic gate family used.
If we replace the fixed timing resistor, RT with a potentiometer, a variable frequency square wave timing signal can be produced for our Christmas lights sequencer circuit. Obviously we do not want the value of the timing resistance to be equal to zero when the potentiometer is turned fully in one direction as this would short out the Schmitt inverter. So to prevent this from happening a small value fixed resistance needs to be connected in series with the potentiometer to provide at least some timing resistance.
The components of the timing RC network used in a Christmas lights sequencer can be any values you have available to produce the oscillating frequency of your choice. The following Schmitt astable circuit would give an output frequency ranging from about 10Hz to 6kHz when the potentiometer is adjusted from minimum to maximum. An additional Schmitt trigger inverter IC1b is used as an inverting buffer to help clean up the timing waveform and improve the performance of the oscillator. As there are six inverters per 40106B IC, there are sufficient spare.
Ok, now we have a decade counter and an astable waveform oscillator circuit we now need some lights to make up our novelty Christmas lights sequencer circuit. These can be any type of lamps or lights you have available from LED’s to miniature filament lamps. If you so wished the output from the counter could also be used to drive Optocoupler which in turn could be used to switch Triacs or Thyristors for switching mains voltage lamps. For this simple Christmas lights sequencer tutorial we will use LED’s.
The 4017B decade counter has ten fully decoded outputs with each one capable of switching up to 20mA. Each of the decoded outputs is normally LOW (logic “0”) and switches HIGH (logic “1”) one at a time sequentially. The advantage here is that we can use each output to drive a single LED directly and better still as only one LED is illuminated at any one time, only one current limiting resistor is required for all 10 LED’s as shown.
The value of the 1kΩ series resistor can be modified to suit the voltage/current requirements of your chosen supply voltage. It is also possible to add more LED’s in series to the output but remember that generally each LED requires a minimum forward current of about 10mA at 2V to fully illuminate.
If you have another type of Christmas lights sequencer application where you need to drive more LED’s or more output power is needed, then the decoded output can be used to drive the base of a switching transistor or gate of a power MOSFET device as shown.
As well as switching just lamps and LED’s, the transistor, whether bipolar of MOSFET can be used to switch electromagnetic relay coils or the inputs of solid state relays to increase the flexibility of the Christmas lights sequencer circuit.
When connected as shown with the reset pin (pin 15) connected to 0 volts, the 4017B Johnson counter acts as a divide-by-ten counter with each output going HIGH on every tenth clock signal.
But as well as driving all ten LED’s, the 4017B Johnson counter can also be configured as a counter with “N” decoded outputs, in which “N” can be any number between 2 and 9.
By connecting the reset pin (pin 15) back to one of the outputs instead of directly to ground, the counter can be configured as a divide-by-2, divide-by-4 counter etc, to drive 2, 4, 8 or any number of LED’s sequentially between 2 and 10.
So for example we only want to flash four LED’s sequentially we would connect the reset pin to the fifth output (pin 10) and each LED would flash on the arrival of every fourth clock signal. Likewise, if we want to flash only six LED’s we would connect the reset pin to the seventh output (pin 5), and so on.
Putting it all together. The complete Christmas Lights Sequencer circuit is shown below with Schmitt astable oscillator, decade counter and LED’s. Using Schmitt triggers produces a very simple and cheap astable oscillator but any oscillator or 555 timer circuit will do. Different combinations of RC values can be used to provide a variable frequency square wave timing signal of your choice.
The object of this short tutorial was to show that a 4017 Johnson Decade Counter can be used to produce a novelty Christmas Lights Sequencer Circuit or any other type of sequencing LED “moving dot” display for that matter. It is also possible to create a number of different flashing light related effects not just for Christmas depending on how you physically arrange the LED’s (or lamps) and the number you use.
The circuits load switching capabilities can be expanded further by using bipolar transistors, darlingtons or MOSFETs to drive larger LED displays or mains lighting via relays, optocouplers and solid state relays, the choice is totally up to you. But one final and important safety point to consider is that extreme care must be taken if switching and working with mains voltages, don’t forget, mains voltages bite!!, so please take care.