OK, it’s a kind of awkward word. It combines a Greek root and a Latin root, which is probably not a terrible thing since there are plenty of other good words that do that. I like it more than the more consistent “amphotopian” which sounds like something optical, or “ambilocian” which sounds like some rich-person drug.
Utopian and dystopian are also awkward, when you think about it. Utopia was Thomas More’s “No Place” — it was too ideal to exist. The word gradually drifted from his idyllic perfect island in the Atlantic to become the generic perfect place. You’d think the opposite of No Place would be Some Place, but of course that misses the flavor somewhat. Thus the opposite “dystopia” came about. According to Etymonline.com, the word was first used in this sense as early as 1868 (but had an earlier medical definition of an out-of-place organ).
So what of a speculative place neither exemplary nor exactly infernal? A place where both good and bad happens? A place where people muddle through as best they can? A place like everywhere, really?
I’m going to go with “ambitopian.” Both places. Neither heaven nor hell, where people are imperfect, some base, some noble, all going about their business. A place with a balance, over time, where the pendulum swings but always returns to somewhere near a center. With any luck, there’s progress, but if there is, it’s probably gradual.
There are many components to the the Maccabeam™ Menorah project. In describing the build, I’ll address each component separately. This first posting will cover the simulation of candle-light.
The warm flicker of candlelight is a familiar sight, and unsurpringly there are a lot of examples and techniques you can find on the internet for simulating it. You could buy pre-made candle light LEDs from Evil Mad Scientist or JMFX, you could read Tim’s excellent analysis and implement something based upon it, or you could look up a myriad examples and how-tos at YouTube or Hackaday or elsewhere. Being perverse, I decided to implement my own approach.
My requirement is that my light source act as a binary source: either on or off. If I were to use LEDs, for example, I could actually change the current to change the brightness. But I’ll be using laser diodes which are either illuminated or not.
Since I’m using a Teensy microcontroller, I can use pulse width modulation (PWM) to control brightness. That’s a fancy way of saying turning the light on and off very rapidly, and simulating intensity. The higher the duty cycle (i.e., the larger percentage of the time the light is “on”), the brighter our eyes see illumination. This works on the property of the human eye known as “persistence of vision.” Our eyes and visual cortex integrate the incoming signal over time. It enables us to look at screens that rapidly flash changing images and see motion (i.e., movies) or a quickly moving point of illumination painting out a pattern and seeing an image (raster images, old tube-style TVs, etc).
So now the question is how to make the pattern of on and off that will look most like a candle flicker? Like many other people presented with this challenge, my first thought is to turn to a pseudo-random sequence generator. Specifically, my first thought is a linear shift-register sequence. Why? A couple of reasons, but the primary is that in the late sixties, my father worked at JPL and assisted Solomon Golomb, who wrote the definitive book on the subject. Thus, when I was in high school, my father helped me with an electronics project where we implemented one.
So, what’s this linear shift-register sequence? It starts with a shift register. This is a circuit with a series of cells or registers, each of which holds a bit with a value of either one or zero. Every time an external signal (like a clock pulse) comes, every value gets moved over to the neighboring cell. So a linear shift-register sequence adds circuity so that after each shift, it populates the input bit using some algorithmic function of its previous state. Depending on the function, it can create a long sequence that seems nearly random.
Consider the following 8-bit shift register:
At each tick of the clock, new value is computed by XOR-ing the values of bit numbers 3 and 7 (these are called the “taps”). The contents of each bit shifts to the position to its left, and the newly computed value populates bit number 0. In this case, the function is exclusive-or (XOR) which has the following truth table:
So imagine only bit number 0 is set and the others are empty. The sequence will go as follows (a space is added between bits 3 and 4 to enhance readability):
0000 0001 (0 xor 0 -> 0, so we'll inject a 0) 0000 0010 (0 xor 0 -> 0, so we'll inject a 0) 0000 0100 (0 xor 0 -> 0, so we'll inject a 0) 0000 1000 (0 xor 1 -> 1, so we'll inject a 1) 0001 0001 (0 xor 0 -> 0, so we'll inject a 0) 0010 0010 ... 0100 0100 1000 1000 0001 0000 0010 0000 0100 0000 1000 0000 0000 0001
This particular configuration is considered “non-maximal” because even though 8 bits can represent 256 combinations, this sequence will repeat after every 12 clock cycles. If you move where the tap is, you can get better sequences. However, it turns out there is no maximal single-tap sequence for an 8-bit register. With an 8-bit register, you can get up to 217 step sequences if you put the tap at bit number 2 or 4. If you add more taps, you can achieve the full 255 states (the fully zero state is omitted, since it will always stay zero).
For our simulation, we want more than 255 steps anyway, so we go up to a 16-bit shift register and use taps that will yield a 65,535 step sequence. Several pages on the web (I like Burton Rosenberg’s page, as well as the Wikipedia reference) will help you find the right taps for any reasonable register you wish to create.
This is implemented in hardware with a handful of chips, or in software with a few lines of code like:
// code is unforgivably formatted, as good C should be[?]
uint16_tsrs; // 16-bits for our shift register
srs = 1;
srs = (srs << 1) | (
((srs & 0x8000) == 0x8000) ^
((srs & 0x2000) == 0x2000)
((srs & 0x1000) == 0x1000)
((srs & 0x0400) == 0x0400)
So for the Maccabeam™, we’ll have a maximum of nine candles going at any one time. So if we have a stream of pseudo-random bits flying by in our 16-bit register, we could just pick nine arbitrary bits and route each one to our laser diode. The problem here is that the values keep shifting left, so there will be a visible pattern. So even if candle number 1 is driven by bit 5 and candle number 2 is driven by bit 8, candle 2 will always flicker three clock cycles after candle 1. Even if the order of the candles is different than the order of the bits, our brains are very good at detecting repeating patterns. It just won’t look very good.
So to break this visible pattern, we will drive each candle by OR-ing two bits together. The spacing between the two bits will be as close to unique as we can make it — of course, given that we only have 16 bits to play with, and nine candles, there will be some overlap.
So you can see that there are two sets of candles that will always be illuminated simultaneous: candle 2 and candle 8; and candle 5 and candle S (the shamos/shamas/shamash. Here’s Wikipedia’s explanation of menorah candles).
There’s a question of timing, too. How frequently does the shift register shift? What looks good may or may not be what’s most like actual candle light. My first stab uses a 40ms cycle time. Adjustments may be in order.
I’m not at the point where I’m ready to hook up the lasers (still practicing the proper intonation of the cry “fire ze laaaaasers!“), but below is some sample video of this approach being run into lowly LEDs.
I’m working on a circuit based on a 34685-MP chip bought at Marlin P Jones. The chip is supposed to be sensitive up to 7m away, but I’m not getting very reliable detection. My first thought was that, being next to a bunch of high-frequency stuff (a Teensy 3.2 with the audio shield), maybe it was interference.
I tried taking its output to the base of a transitor and lighting a LED to see if that was better. I got similar results.
I’m not sure what’s going on yet. If I do figure it out, I’ll post here.
Update: the Interwebs deliver! Following the recommendation I found in the comments on this article, I put the 34685-MP on a cable, and moved it away from the breadboard. Voilà! It now works as I had hoped!
Made another pie along the lines of the Starberry. This time, though, I used a three berry blend: raspberries, blueberries, and blackberries — including a few berries from the garden!
I also revisited the crust recipe. After scouring the internet and reading a few dozen recipes, I decided to go with this cream-cheese crust recipe from Natasha’s Kitchen. Instead of heavy cream, I used half & half. It’s still a very rich recipe, and easy to make (the dough was a little too wet when making the crusts, so next time I’ll use less half & half). The wetness led to some crimping failure, but nothing too severe.
I was pleased with the way the pie came out. It was easier than my previous attempt, and had excellent flavor.
This is a recipe that I’ve cobbled together from various sources. Over time, I’ve adjusted it until I’m very happy with the flavor, although I have a long way to go to be proficient at good crusts or making it look acceptably attractive. But I think it’s a mighty tasty pie.
Ingredients (one 9-10 inch pie):
The Crust 3/4 cup all purpose flour 1/4 cup whole wheat flour 1/3 cup shortening (e.g., Crisco) 1/2 teaspoon salt ~5 tablespoons ice water
Preparation: Mix the dry ingredients, and cut in the shortening. Mix until it’s all a crumbly mixture. One tablespoon at a time, mix in the cold water. Manipulate as little as possible, until you can ball up the dough. Shape into a flat disk, and refrigerate at least an hour. Roll out the dough, and slump into your pie dish. Pinch around the edges. Optionally save a scrap, roll it out, and cut decorations for the top of the pie. Refrigerate another 15 minutes, load with pie weights, bake 15 minutes at 400°F then another 15 minutes at 375°F. Remove and let cool.
The Filling 1/2 cup white baker’s sugar 1/4 cup all-purpose flour 1/2 teaspoon ground cinnamon 24-38 oz mixed berries (you can get a bag of frozen “O Organics Mixed Berries” at many supermarkets, which contains strawberries, blackberries, blueberries, and raspberries, or you can make your own fresh blend.) 1-2 tablespoons lemon juice 1/2 tablespoons butter 1 tablespoonccorn starch (especially if using frozen berries)
Preparation: Mix the dry ingredients, and blend with the wet ingredients. Mix thoroughly. If using frozen fruit, let it thaw enough that moisture comes off the berries and the mixture is wet. Pour into crust, add decorations (if any). Bake in pre-heated oven at 425ºF for 45 minutes, then 350ºF for another half hour or thereabouts. Place on cooling rack. Eat at room temperature.