-
Prior Art
12/10/2023 at 00:38 • 0 commentsI'm definitely not the first to have an idea like this! Here's a small sampling of other related work that came up during my research:
-
Can You Feel It Shifting In The Air Tonight
12/07/2023 at 02:40 • 0 commentsNice Bits!
A shift register is perhaps most commonly used to drive a seven-segment display:
It's the sort of display that you might find in a clock or in a DeLorean. Naturally, a seven-segment display does not actually have seven segments. Including the decimal point, it actually has eight. Which conveniently is exactly the number we need for a fully functional menorah! Of course, our shift register has a higher calling than blinking "12:00" on an some old VCR.
The 74HC595 shift register used to light the LEDs in this menorah is located here on the left side of the board:
How It Works
The shift register has (basically) two inputs, and eight outputs. The two inputs we care about are "data" and "clock." For every pulse from low to high on the clock pin, the shift register samples the data pin, and shifts this value into the first slot on the register. Each of the eight slots are tied to eight LEDs.
Unclear?
Basically, think Skee-Ball:
...wherein each of these balls represent a high or low bit filling up the register.
With every clock cycle, a ball is removed from the bottom, another is added to the top, and all the balls shift down. In this analogy, there are "on" balls and "off" balls, and these balls control our LEDs.
In our circuit, power is first applied by pushing the button and activating the MOSFET. This immediately turns on the shift register, which actually powers on into an unknown, random state. Or if you prefer analogy: the Skee-Ball machine is filled with random balls.
At this moment in time, when the power button has been depressed but not yet released, any of the 8 LEDs may be lit. As soon at the button is released, the chip clears its register and displays zero lit LEDs.
In other words, the Skee-Ball machine flushes out all the random balls and refills itself with "off balls."
From then on the data line is always high, meaning we'll be filling up our machine with "on" balls. Every time you cycle the clock by pushing the button, you are basically removing one "off" ball from the bottom of the Skee-Ball rack, and adding one "on" ball to the top.
As demonstrated by Lisa and Maggie in the above gif, every "on" ball in the shift register causes a new LED to light.
Once the register is full of "on" balls our menorah will be fully lit:
At this point, additional clicks of the button continue to feed new "on" balls into the top of the register and the old "on" balls continue getting removed from the bottom of the register. None of this is visually apparent as all the lights on the menorah are already lit.
To extinguish them, a long press of the button powers off the whole circuit. If you're playing by the rules, the candles should be put out thirty minutes after nightfall!
-
Latches on Circuits and Whiskers on Kittens
12/07/2023 at 02:01 • 0 commentsTurn on the Light
[Chorus]
Bend me, shape me, any way you want me
Long as you love me, it's all right
Bend me, shape me, any way you want me
You got the power to turn on the light-from the song "Bend Me Shape Me" by The Outsiders, 1966
The push-on/hold-off functionality of this circuit is provided by the magic of MOSFETS. A MOSFET is just a type of transistor, which we use to control the flow of electrons between the battery and the rest of the circuit.
Specifically, we use two MOSFETS to form a latch. In this configuration, the first MOSFET is activated by a switch, which momentarily turns on the circuit. This power activates the second MOSFET, which then performs the same function as the switch: holding the first MOSFET on. This means that one short push of a momentary contact button will hold the circuit on indefinitely. More about the specifics later.
I (slightly) modified a latch circuit published here by Mosaic Industries:
This circuit has one additional feature which is both a neat trick and also critical for our device to function: the button used for the main power switch can also be used to control other things once the circuit is on. This allows the use of a single button for both power and control.
I replaced the dual MOSFET used in the original circuit with the SIA517DJ, which i chose for a few reasons:
- It's available in a tiny 2mm x 2mm SC-70 footprint.
- It runs on voltages down to 1.5v
- My supplier had them in stock
It also has an on-resistance of a scant 0.17 ohms, so it wastes very little energy while doing its job. It also has a maximum reverse-leakage of just 1μA, meaning our battery will only drain a tiny bit while the menorah is off.
Won't you P my neighbor?
Let's take a closer look at the dual MOSFET latching mechanism. There are two types of MOSFETs, P-channel and N-channel. Both types have the same three connections to the circuit:
- Source
- Drain
- Gate
Basically, in either type the gate controls the flow of electrons between the source and drain.
The difference between N and P types?
A P-channel MOSFET turns on when its gate is low, while an N-channel MOSFET turns on when its gate is high. Our SIA517DJ dual MOSFET packages both types together, because they are often used together in a complementary fashion (see: CMOS).
In our circuit, we use the P-MOS as the main power control switch, while the N-MOS simply serves to hold the P-MOS gate low, keeping the circuit latched on. Here's how it works:
STEP 1:
In our circuit, as soon as power is applied, the gate of the P-MOS is brought high. This starts the P-MOS in the off-state, meaning no power flows to the rest of the circuit. However, this gate is also connected to ground through our switch:
Pressing the switch brings the gate low rapidly, and since a P-MOS turns on when its gate voltage is low, this instantly activates the P-MOS. Because our battery is connected at the source of the P-MOS, it will now flow through the P-MOS and into the rest of the circuit.
STEP 2:
As soon as that power starts to flow through the P-MOS, voltage at the N-MOS gate starts to rise. Here is the path it takes:
Since an N-MOS activates with positive voltage, it now allows current to begin flowing. The N-MOS source is actually connected to ground, and its drain is connected to the P-MOS gate. As a result, any charge on the P-MOS gate will drain away to ground. Now, the P-MOS will stay on permanently, even when the switch is released.
Now, the circuit will stay on, with the MOSFETs holding each other open, until the cycle is somehow broken. Which brings us to...
STEP 3
Our button is also connected to the N-MOS gate through a large resistor and a diode, which allows the gate to be drained slowly if the switch is held down. Holding the button discharges the capacitor through the resistor via the blue path:
This combination of a 10µF capacitor draining through a 300kΩ resistor takes 3-5 seconds to lower the voltage at the N-MOS gate, from a starting voltage of 3v to its off-voltage of approximately 1v, at which point the N-MOS will turn off. In turn, this disconnects the P-MOS gate from ground, allowing its voltage to rise past the P-MOS gate's threshold voltage of approximately 1v. Now, the P-MOS will stop conducting, and the circuit will be disconnected from the battery again, and remain in the off state.
It will stay that way until the button is pressed again, discharging the P-MOS gate to ground and starting the cycle over again.
-
Left or right? Where history and dyslexia meet!
12/06/2023 at 18:44 • 0 commentsDetermining the correct order and direction in which to light the candles is no easy task.
And the internet is no help.
When you begin this research you are met with many diagrams, but none of them are useful. In fact, the top results often contradict each other. As you can see in the screenshot below, the supposedly helpful arrows in these images are pointing every which way:
Some of these diagrams have so many arrows they look more like football plays than lighting instructions:
What I Know For Sure
- The candle in the middle is called the shamash. It is always lit first.
- Candles are added to the menorah day by day, and they are added from the right side to the left side.
- Candles are lit, using the shamash, from left to right.
This much we can agree on.
Where It Gets Harder
Ignoring the historical debates about lighting order, there remains considerable uncertainty about which side of the menorah appears lit on the first night. Take as evidence this ancient web image:
The internet is again no help. A search for "hanukkah first night" returns images showing the first candle being lit on both the left and right sides interchangeably:
One critical complicating factor is that menorahs are to be placed in a window, meaning left and right will appear reversed to viewers on the outside. The only place I found that adequately discusses this aspect is this youtube video, which includes this wonderful animation:
...and features as its top comment:
In the end, it's a matter of perception which depends on not only the vantage point of the viewer but also the behavior of the lamp lighter. Ask:
- Whose perspective matters? The lighter or the observer?
- Is the observer inside the house or outside?
- When the lighter puts the menorah in the window, do they turn it around to face the observer?
Whose Side Are You On?
The more research you do on this topic, the less clear the answer becomes. As you can see from this post at stackexchange, rabbis and scholars have long debated the topic:
Accuracy-smacuracy
Truthfully, the ideal lighting order isn't really even possible when using a single button as the only interface.
On day three, for example, the candles would be lit in this order (viewed from "inside"):
...but our pin (along with every other electric menorah I could find) lights in reverse of that- it starts on the outside and proceeds inward. To start in the middle and light outward, we would need a way to navigate to the third candle, which means we'd need a lot more brains in our circuit and probably at least one more button.
Browsing other electric menorahs for sale, I saw no lamps which lit in that manner. Every one simply lights from one side to the other, some from left to right and some right to left.
There appears to be no consensus.
Of course by being three dimensional, these other lamps have much more flexibility. If you don't like the side they start lighting from, you can simply turn it around.
Our pin is different: it cannot be turned around, therefore only one side can be presented. This makes the decision more complicated as unlike the other menorahs, ours has a canonical "front."
I did find other example of a single sided menorah, but they weren't helpful either. This one doesn't even have the right number of candles:
Another example of a single sided menorah is this virtual one - when you search on google for "menorah" you are presented with this interactive lighting animation:
Note the small arrow above the leftmost candle. The animation doesn't permit you to light in any order but left to right, and you must start on the far left. By showing a menorah fully loaded with candles, it assumes we are celebrating the 8th day, thereby avoiding any further questions about left versus right or front versus back, as the candles are symmetrical.
A Choice Must Be Made
-or-
It Is Possible I've Been Overthinking It.
This photo perfectly describes the inside/outside perspective shift:
From the perspective of the candle lighter, this is the rightmost candle. But from our perspective, it appears on the left.
I decided to think of the back side of the Shift Register Menorah as the "inside the house" or "candle lighter's perspective". It's the more private side, where the battery is, and it rests against your body.
The front of the Shift Register Menorah is the "public side" and seen as if it were observed through the window of your home by an outside viewer. Just like in the image above.
Therefore, on day three for example, as seen from the backside or "inside" perspective, the LEDs will light in this order:
...which has the candles being lit on the correct side but, strictly speaking, in the wrong order.
However!
The button which controls the lights is located on the front of the menorah. And if you have the button facing you while you press it, you will be seeing the LEDs light in the correct order of left to right! And from the front perspective, as when you are wearing the pin, observers will correctly get the "through the window" perspective of the three lights on the left being lit for the third day.
Compromise!
I think this choice is an acceptable balance of electrical simplicity and adherence to tradition. It may not be a perfect representation, but hopefully it gets close enough for a wearable item. If you're after more accuracy, other electric menorahs are much closer to the real thing!