Archive for the ‘Electronics stuff’ Category

Fun with LED arrays

24 May 2020

I have been playing around with simple ways to make patterns on LED arrays.

Here’s one demonstration of how the same numeric pattern looks on a regular “square” array (cartesian coordinates) and on a circular or radial array (polar coordinates, you could say).

The circular array is quite suited to my work, because I am working with repetitive patterns and polar coordinates are usually used for things that repeat, like rotating planets or the sine wave that comes out of your wall socket.

Here we have a demonstration first of what x=y (cartesian) looks like on square and circular arrays. On the square array it’s just a diagonal line from the lower left corner to the upper right corner. On the circular array it’s a spiral.

When I flip the switch to take the x and y signals out of synchronization, where (in this case) x and y are different by about a ratio of 2 to 3, we get a slowly moving slanted line on the square array and a pulsing pattern – basically a set of spirals – on the circular array. So this condition looks more interesting. Many patterns are possible using this sort of system, and this is one thing I’m working on while stuck at home.

Circular arrays

Circular arrays that use base-2 numbers (8 or 16 for instance) are, as far as I can tell, non-existent as manufactured items. That means I have to make them myself. Here’s what my recently-constructed 8-by-8 array looks like in the back:

circular array rear view

Without going into laborious detail, you can see this took a bit of work.

I continue to look for pre-fab boards with circular patterns, but so far have only found ones used for clocks (12 points in the circle, or some multiple of 12). Digital ICs (old school CMOS) almost all use binary counting. As the standard IC has 16 pins, the most places you can pull out of one is 8. The binary number comes in as 3 bits (up to 8 places) or 4 bits (up to 16 places) and can be resolved to 8 places with one IC, or 16 with two, etc.

I may learn how to design my own boards for this purpose. We’ll see about that.

Tidbits

26 April 2020

…consisting of somewhat random notes.

The Arboretum

It was warm this weekend! And when it gets hot – which means I get hotter on my ride home – I usually stop at the arboretum (UC Sac State) along the way.

butterfly bush flowers

Here is the butterfly bush mentioned on the marker above. Exotic!

And an iris.

iris

Nearby were some calla lilies.

calla

This is quite a peaceful place. And popular as a way to take in a short walk.

There were a lot of people out Saturday. The regular bike racers, plus a ton of families with kids.

The weather, predicted to be partly cloudy, turned out mostly sunny, and I got burned.

eArt Projects

At home I have been working – almost feverishly – on putting together some systems that will allow me to continue to develop more electronic art.

I worked a lot on an oscillator made from an old IC known as “XR2206.” This IC is considered very outdated, yet it continues to have popularity among hobbyists and can still be obtained from electronics surplus stores. One wonders, though, why these parts are surplus. Could it be they were rejected by the original manufacturers due to being out-of-specification?

What I know about this IC is that it has been hard for me to work with in that it does not deliver the full functionality it was specified for. In theory, you can get a 2000:1 frequency range out of this part, but this is difficult to achieve because at higher current levels it begins to go unstable or stop oscillating.

Still it is a great way to get a sine wave for testing purposes with just the turn of one knob. And that’s all I needed it for.

XR2206 oscillator

This is an important part of my “analog” rack. This rack is for developing different ways to process sound and turn it into signals that can control light (LED) displays.

Below the oscillator is an open section where boards can be inserted for testing. That part isn’t finished yet.

analog rack

The whole thing looks like this right now.

The mounting rails with all the little screw holes in them are taken from the “eurorack” system. This system was developed as a metric standard that imitates the old U.S. standard 19-inch wide equipment racks. This rack size has continued to be popular for computer equipment and for professional audio equipment. The eurorack has become the default standard for modern modular equipment, especially analog (old-school) synthesizers. The “new breed” of “analog” synths can be computer-aided, which helps to overcome some of their old problems with tuning stability, amount of space required, and similar issues.

I note that vinyl as a recording medium is also back in vogue. Some people really think it sounds better.

I use these racks for projects that need to be modular – built in functional sections. They are a great substitute for older rack equipment which tends to be way too deep for this sort of application. Lots of professional synth modules are less than 1 inch deep behind the panel! My racks are about 4 inches deep. That was not quite deep enough, however, for the power supply module I found (at a very good price) so I had to make a hole in its panel so it could stick out 1/2 an inch in the front. That meant putting a thick plastic cover over it so it would be electrically safe.

I also have an analog meter in this rack, as I sometimes want to see the slower changes in a signal, and digital meters aren’t good for that.

digital rack

My digital rack is very similar, except it all works on 5 volts. Its purpose is to help me design digital pattern generators that will respond (usually) to one or more analog signals taken from the environment.

Here is another open section where boards may be inserted to try them out. That still needs more work.

Deliveries

I wanted a better webcam in case I had reason to use one over this period or later. So I ordered one and asked for it to be delivered by the second business day (Fedex). The driver, however, could not get into my building because the managers have not been unlocking the door when they’re in the office, like they usually do. For some reason he didn’t think to (or couldn’t) call me so I could let him in, so it’s the third business day and the camera remained undelivered.

I decided to go out to the Fedex facility and pick it up. It wasn’t hard, though it took about two hours by bus. Right now the bus drivers have to wear masks and all the passengers have to enter and exit via the back door (unless they are wheelchair types). Most people are taking it pretty well, but I think it’s crazy.

My electronics parts orders have been coming through pretty well, though. The USPS has no problem delivering the mail, and orders from California only take two days to get here, so that’s working for me.

Is the way out the way through?

This is an old saying used in Scientology, but actually broadly applicable. It means that if you have something hanging around that’s bothering you, it’s only there because you didn’t confront it well enough the first time you ran into it. The only way to get rid of it is to confront it more thoroughly.

While some doctors, including that Fauci dude, remain almost studiously ambivalent about this particular disease, the fact is that we wouldn’t be alive on Earth today if we didn’t have some natural way to build up immunity against all the pathogens floating around in the environment. And so, while it takes its toll on us to one degree or another, we will build up our immunity to this one, the next one, and a few more after that (I hope).

The doctors who do talk about immunity and the immune system as the way through this thing are oddly ignored by some of the others who want drugs or a vaccine to handle it. This has led some of them to wonder out loud if the medical establishment has some “agenda” it’s trying to push forward (to make more money and gain more control), and from all I’ve heard and read, this is quite possible.

What I know for sure is: This disease needs to run its course, and people need to get back to what they were doing to earn money and make things go right. You can’t put the world on hold forever without killing it. Is that what those doctors want?

Here’s another photo of flowers. They don’t seem to be aware that there’s anything wrong.

yellow flowers

My Latest Big Project

16 April 2020
open side of pattern generator and serializer

I have been working on my latest project for about a week straight now. It’s finally in a usable form.

This project has several purposes behind it. First, I needed a pattern generator to test LED arrays that would output very ordinary patterns, nothing fancy, just so I could tell if the display was working. Second, I needed the output to be serialized to simplify connection of the display to the signal source. Third, I wanted to use as many old boards as I could, rather than junk them.

This project incorporates about a dozen old boards that were taken out of “dead” projects and gathering dust on my bench. They all had to be re-worked for this project. It also incorporates some older pattern generation circuits as a way of preserving a technology I have not been using recently.

Here is another shot of the project:

new project showing front panel

Here we can see the front panel which has four main knobs, DIN connectors for the serial signal output, and some other controls.

Added Control Systems

This was an ambitious project for me basically because of the additional front panel controls that I would not put on equipment unless it was being used to test other equipment.

Besides the four voltage-controlled oscillators (VCOs) that have been fairly standard in my eArt projects, there is a pattern selector that is implemented by a rotating “click” knob that I got off an old mobile radio. This gives me about 64 different possible combinations using just one knob.

The other thing I wanted to implement was the ability to isolate just one section of a pattern and show only that on the display. For this I used an old 4-bit binary rotary switch that I had laying around (making 16 possible choices) and some comparison logic using the infamous “XOR” (exclusive OR) gate, also known as a binary adder. This gate, basically, has one output (“0”) if the two inputs match and another output (“1”) if the two inputs are different. AND the outputs together (after inverting them), and you see if two binary numbers match for as many bits as you need or want.

As a geeky aside, I made use of the fact that binary AND and OR are complementary functions. Thus, you can accomplish a binary AND on the outputs of the XOR gates without inverting them first (to make a match = “1” instead of “0”) using an OR gate, which then gives you a “0” output only when there is a match (when all inputs are “0”). Invert that, and you get a “1” for a match. In my case I needed the “0” to show a match!

I also wanted to choose between the “legacy” patterns that I built into this project and the “simple” patterns used for test purposes. For this I used a 4-bit selector IC. One can make a “tree” of these ICs and select from as many different inputs as one wants.

I don’t build these sort of control circuits that much, so I had to do a bit of head-scratching along the way.

My bench and a few closeups

The project on my work bench

I don’t photograph my bench that often because it looks so messy. But here we see my current setup with the project and one of my displays on it.

To the left is a small oscilloscope and you can see its two test leads hanging down from little hooks. In the center is one of my numerous parts cabinets. Behind the project is a work light and a soldering iron. Above the light is a digital meter I bought used (highly recommended for an electronics bench) and above that a rack chassis full of power supplies. The supply with the panel lit up is the one I use the most.

my bench power supply

It produces four different voltages, 5, 7.5, 9 and 12. I use 5 volts the most. The panel had room for two meters (eBay specials!) so I can monitor more than one output at a time if I need to. Here it shows my five volt connection switched on and drawing 38 milliamps. With CMOS logic, most of the circuitry draws close to zero power. Most of this current draw is from the oscillators.

The 12 volt meter shows 18 mA current draw. This is from the panel meters themselves. It was easier to power them from one of the four supplies, rather than adding another just for them.

pattern generator set up in demonstration area

Here we see the pattern generator installed in its case and running the same display. This is in the “demonstration” area of my room.

closeup of the panel

There is room for another panel section above the one I used. You can also see the binary rotary switch set to “A” which is ten in hexadecimal.

8 spirals display

Here is “8 spirals,” one of my more colorful displays. All the lights should be lit in this pattern, but you can see that there are two lights having problems.

Electronic Art – Three Circles

29 March 2020

I thought I’d try to show the latest revision of one of my art projects in video form. At first I tried an old webcam (LifeCam VX-3000) with bad results. Then I decided to use my digital camera. With the current memory card it can record up to 5 minutes of video in Quick Time format. I added a pan and zoom effect using Windows Movie Maker (available in Win 8, not 10).

Latest project updates

In this rare view of some of my gear (doesn’t it look atrocious?) we see a military-green piece of equipment in the middle serving as a signal source to the display module (upper left). The gray cable carries the signal, a serial signal needing only 3 wires plus ground, with a fifth wire providing power to the display. The pattern generator creates an 7-or-8-bit-wide pattern which is monitored on its own local display, then serialized in the top part and sent through the five-wire cable. The pattern generator can also encode the 3 signals into 2 signals and send them out using four wires plus ground. This allows for very long cables.

I want to make this the standard for how my displays work, and this is the first time I have all the parts in the chain up and running.

The display looks cooler than the halting, grainy video conveys. And that’s only one set pattern. The possible variations are infinite. Now that I have all the basic pieces in place, I will be converting more of my older displays to work with a serial cable, and finding better ways to take videos of them so you can see how they really look.

Here’s another video I took after building some more pattern-making equipment.

Goodbye Windows 7

16 January 2020

Two days ago Microsoft officially ended its free support for Windows 7.

This means that computers connected directly to the internet may become vulnerable to criminal attempts to cripple or steal them.

Because of this, I have switched to Windows 10 on the computer I use the most. It is not the only solution, but I want to play it safe on my most important machine.

Windows 7

Windows 7 was an operating system that remained popular from the day it was introduced in 2009. It operated in a similar way to earlier versions, but was a complete overhaul of the system, and was presented in a very aesthetic and appealing way.

The story of Windows 7 started much earlier, however. Initially, Windows was developed as a graphical “shell” operating over MS-DOS, an operating system that dates back more or less to the start of personal computing. Personal computers were designed as stand-alone machines for home use. But they became so popular so fast that they became widely used in the business world.

The problem with that was that the business world was a networked world, where users had to share work and files with co-workers at the company, even sometimes in other buildings or distant locations. This had been accomplished, usually, with large “mainframe” machines running a business-strength operating system such as Unix. Unix had user accounts, login screens, passwords, multi-tasking capabilities and similar features that were needed in the business world. DOS couldn’t do these things, but as DOS machines grew in popularity, add-ons were created that allowed DOS machines to be used in a business environment.

Operating systems started going graphical in the 1980s. These were big hits with consumers and businesses. Apple also had a graphical operating system, but by creating a system that would run on less expensive generic hardware (the “IBM PC”) Microsoft won a huge share of the graphical OS market.

By the year 2000, DOS-based computing had reached as far as it needed to go. The basic concepts and features of Unix-like operating systems were reworked into products that would run on personal computers instead of mainframes. This was partially due to the pressure from Linux, an Open Source and freely distributed version of Unix that was designed to work on IBM PCs. Microsoft started with Windows NT (marketed as “New Technology” but originally named after a variety of other obscure technical developments) which became the lineage that Windows 7 is a part of. This lineage also includes, famously, Windows XP.

The Windows 7 family of operating systems kept the basic concept of “windows” developed so many years ago and added features that made the operating system a solid choice for business applications, particularly office work. The huge popularity of PCs with consumers has now died out, though many still see a notebook computer as essential. The average smart phone has much more computing power today than the PC of the mid-1990s had. This was mostly a matter of improvements in electronics technology. But for serious home users and in business, Windows 7 became immensely popular. At this late date, it is estimated that almost half of all computers in use worldwide still have Windows 7 on them. Over the course of its existence, Microsoft sold more than half a billion Windows 7 licenses.

Upgrading to Windows 10

On my machine, the upgrade to the newer Windows was very smooth. It took some time, but ran without incident, in the characteristically Microsoft style of using progress windows that tell you as little as possible about what is actually going on, using phrases such as “this may take a while.” My computer is not that old. It has two processor cores. It has USB 3.0. It has the newer UEFI form of BIOS. This latter point, in particular, I am sure helped with the upgrade.

UEFI

The Unified Extensible Firmware Interface allows for more modern electronics to be used on the computer’s main board (motherboard) and can even make the computer hardware appear like “smart” hardware on a network or similar communications system, allowing for certain kinds of remote access. Though to me this would seem to increase security risks, the industry seems to think it’s important.

When Microsoft mentions “modern” hardware, this is mostly what they are talking about. The older operating systems, as far as I know, cannot connect properly to the UEFI. So they found a way to essentially force everyone to upgrade their operating systems if they want to use modern hardware.

Alternatives to Windows

I have a version of Linux running on a small notebook that originally was running Windows 10. Certain features of Linux help it run better on machines with lower-end processors.

Beyond that, Microsoft and the Open Source community operate on significantly different philosophies of life. The Free Software movement takes this even a step further. But the basic difference is that companies like Microsoft have relatively restrictive licenses for their software products, keep most of their code a secret, and think of their end-users as “dumb” when it comes to computer systems. Open Source software on the other hand offers more lenient licenses (in some ways), requires that all source code be non-secret, and tends to think of end-users as “smart.” On top of that, the Free Software movement adds the assumption that if the source code is secret, then software companies can, and will, have things to hide about their software. The freedom of the computer user is compromised and bad control, including unwanted surveillance, can be foisted on users if they wish to use such “closed source” systems.

Though many of us see the dangers that a computer-dependent society could bring, the short-term benefits of using non-free software seem to be worth the risks. Global sanity, not revolution, is the answer to the constant problem of freedom on this planet.

Linux is not a bad alternative to Windows, though, and the newest versions from the big distributors like Ubuntu have UEFI compatibility. I ruled it out for my main machine because I had so many Windows applications I wanted to keep. But I would consider it for a new machine, or a portable. The best versions now operate very similar to Windows.

Companies with large numbers of Windows 7 machines can keep them protected if they put a good “firewall” or “proxy server” in between their internal computer network and the internet. The internet has become an extremely lawless place; internal company networks are usually much less so. I’m sure there are companies that will operate this way until their Windows 7 machines actually stop working and require replacement.

Harmonics

24 May 2019

One of my interests is creating projects that demonstrate physics concepts. This is particularly true for physics concepts that are mentioned by Mr. Hubbard in has writings or lectures. One such concept is harmonics.

harmonics-with-frequency-values

The above representation, obtained from an educational website, illustrates the basic idea here. “Hz” stands for Hertz, the chosen name for a unit of measure of frequency, previously known as Cycles Per Second.

These terms, as far as I know, are borrowed from the world of music, where they have been in use at least since the time of the Greeks, who liked to play around with the mathematics of vibrating strings.

One way of looking at harmonics is the idea that they can be derived by taking a string and dividing it into different numbers of parts that add up to the total length. That gives you a series of whole fractions for different string lengths (periods), and a series of whole number multiples for frequency (or tone). In audio, we usually refer to frequencies rather than wavelengths or periods.  In radio and light, you are more likely to see wavelengths referred to.

The harmonic series illustrated above contains two octaves. An octave is a frequency exactly two times another frequency. In music, octaves are given the same note letter, as they indeed sound like the “same” note.

Traditional musical scales

Traditional music scales are based on whole fractions. It was possible to determine relationships between notes using fractions before we had electronic means to measure frequency. Thus, a traditional musical scale would be made up of a fundamental tone and then a series of chosen higher tones relating to the fundamental by whole fractions of a value between one and two. The most common notes used were sub-octaves of the harmonics of the fundamental tone. Thus: 3/2, 5/4 and 7/4, 9/8, 11/8, 13/8 and 15/8. Many other tones are possible, but it was found – or considered – that these sounded the most musical when played together. Modern tuning systems approximate these notes while creating a scale that makes transposition between keys (scales starting with different fundamentals) much easier.

My project

With my project, I just wanted to demonstrate what several harmonics of a fundamental sound like.

The biggest challenge in generating such tones electronically is to get a pure tone (sine wave). Sine is the name of the function that describes a pure tone. It is a term taken from trigonometry (the study of the properties of angles and circles).

I wanted six sine waves that were exact mathematical multiples of the fundamental. The only practical way to achieve this is starting with digital signals. Those signals can then be built into sine waves using various processes. I was a little nervous about how well this would work, and how easy or difficult it would be to create good sine waves. But it worked out OK. In this design, most of the sine waves are constructed from 16 voltage steps. For the fundamental tone, I made knobs to control the size of the voltage steps. For all the other tones, I used fixed resistors. The basic idea was taken from a magazine article from the 1980s that I had saved in my digital library.

This project works fairly well. The power supply was a little complicated, because I needed four different voltage rails: +10V, +5V, (ground = 0V), -5V and -10V. My fixed-resistor sine wave generators work quite well. The one using variable resistors is a little flaky, but does an acceptable job. I get seven harmonics from this equipment, including the fundamental, and I can mix them in different ratios to get richer sounds.

I built this into a cabinet that was already occupied by an old multimeter I purchased years ago. I decided there would be enough space for it without removing that old meter, so it remains a part of the project. I can even use it to measure the amplitude of the output signal!

harmonics-project-7

 

Dial Two

4 May 2019

This is my third project in the “dial” series. See Dial One here.

With this project I wanted to try out a few design options, and I concentrated on those.

Though it is still far from a thing of beauty, the more minimal enclosure, featuring primarily the dial itself, was one thing I wanted to try. There was plenty of room for the electronics, and a nice big dial, but putting the power supply in the box seemed not possible. This is not necessarily a big problem, as the system also requires a sensor, or signal source box, and this could supply the power.

dial_two-20190430-88-cropped

The dial itself is irritatingly green, but in a more finished version, that board could be painted black. For the “featured” photo I adjusted the color balance to fade the green down.

16 steps

The other feature I wanted to try was a 16-step dial.

For this design I abandoned the idea of scanning the dial, which meant inventing a significantly different way to get the dial pattern to move around. Each step on the dial is on or off depending on a latch which stores that value for one cycle of 16 steps. Each latch gets its data from a common signal line, but the time when the data is transferred is different for each latch. In that way, the signal – which carries the pattern – can be time-delayed relative to the scanning pulses, thus updating the position of the “pointer” for every 16-step cycle.

Lights and Colors

To keep things simple, I used one circle of white LEDs. But this does not seem very aesthetically pleasing. I need to find colors that will work better. There is also no fading built into this design; the lights are either full on or full off. More control over light intensity seems desirable here. My next design will address these issues.

dial_two-20190430-98-slightly-lightened

This photo was made under very low-light conditions, then brightened slightly with digital manipulation. But this only slowed down the camera enough to show three lights on at once. I am considering making videos of my projects. That would give you a better idea of how they look “live.”

Dial One

14 March 2019

“Dial One” is the first piece of electronic equipment I have made that I am officially considering a piece of art, and am offering for sale as such.

dial_one-darker-20190314

It was conceived while I was on the Purification Rundown and completed in this form just yesterday. Like most art concepts – and most electronic equipment – there are many possible ways to turn the concept into reality, and many possible “variations on the theme,” or parts of the design that could be made differently. This is the first working prototype of this concept – a dial. On the circular screen, a pattern of lights rotates as an input signal varies between zero and five volts.

Dial One has all the basic features I imagined for this type of piece. With 4 knobs, the user can vary the pattern of lights. There is a sliding control for testing the effect, and a connector for an external sensor which would provide some varying signal (such as sound level or distance of nearest object). The display can be made totally dark or rather bright.

This particular prototype is housed in a black aluminum enclosure originally made for a vacuum tube voltmeter. The display features white, red and orange LEDs. Power is supplied through a standard computer-type power cord inserted in the rear.

The circuitry is all hard-wired – no programmed elements. This was the original concept for this piece, so I kept it that way. In fact, I could not immediately think of an easy way to achieve this same effect using a micro-controller. I plan to return to this concept again before too long and explore some different ways to implement it.

Arduino Drives 7-segment LED Display

23 March 2018

7-segment LED display

A standard 4-digit display. I fiddled with the image to make it look lit up.

7-segment Displays

This type of LED (Light Emitting Diode) display has been around for a long time, and you can still find them in many devices. For most applications they have been replaced with LCDs which use less power and are more versatile. But if all you need to do is display numbers, and you have some old parts around that you want to use, then you might be interested in putting one of these things into a “modern” project, such as one using an Arduino (programmable microcontroller).

Pin Count

The simplest Arduino has only 20 pins that can be used for digital I/O (inputs/outputs). A 7-segment display requires 8 pins to drive the segments (if you want to use the decimal point) and a pin for every digit. For 4 digits, that’s 12 pins. For 8 digits, that’s 16 pins. That doesn’t leave many pins for other functions in your project. But, you might not need many other pins.

There are ways to reduce pin count. One way is to use ICs (integrated circuits) that will take a binary number at the input, say from 0 (B0000) to 9 (B1001) and output the appropriate pattern to the segments to display those numerals. You can also use a simpler encoder to run the digits; 3 (binary) lines in, 8 lines (or digits) out. That means you could operate an 8-digit display using only 7 Arduino pins.

Drive Current

An older LED, like you find in these displays, requires at least 5ma (milli-amps) of current to look reasonably bright. Most are rated for 20ma. These arrays are actually scanned (only one digit on at a time), so it helps to make them look brighter if you drive them with more current than the LEDs would need if they stayed on all the time. However, unless you can find a special IC to do your decoding, one specifically designed to drive LED arrays at those current levels, most ICs won’t be able to do the job. The average CMOS (complementary metal oxide semiconductor) IC that hobbyists use is only rated for about 2ma output current.

However, the Arduino itself is rated for about 20mA output. So the Arduino pins can run the LED segments unassisted. I use transistor arrays to run the digits. They take about 1ma in and can output up to 500ma or so. However, these drive transistors invert the input signal (in high, out low), so to drive the digits requires a signal of opposite polarity to what you would use if you weren’t using the transistors.

Existing Solutions

Most – but not all – of these factors are taken into account by an Arduino code add-on (called a library) named “SevSeg” (for “seven segments”). What it does not take into account is using encoder ICs to lower the pin count. My design uses an encoder to select the digits, but runs the segments directly from the Arduino. So, I could not use the library that had already been written for this purpose.

My Own Solution

I am writing this because I thought I could come up with something relatively simple that would do the job, but I wasn’t sure.

The basic cycle of action is fairly straightforward:

  1. Set up the 8 segment drivers to be high or low depending which segments you need on or off to display the desired numeral (or other pattern) for the first digit.
  2. Select that digit by outputting the binary number corresponding to that digit’s hardware position. (Say, B000, three low lines for binary zero, “digit zero.”)
  3. Keep that pattern on for a little while (a milli-second maybe), then switch to the pattern for the next digit.
  4. Repeat this process for each digit, until all have been lit, then repeat the entire cycle as long as you want the display to show something.

I used what is sometimes referred to as a “brute force” method to select the digits. For each digit, I just tell the Arduino which lines to make high and which lines to make low. It’s only 3 lines, so not that hard to do it that way. Those lines will stay that way until I tell the Arduino to change them, so it’s just three commands for each digit. Pretty easy.

I could have done the same for the segments, but I was hoping for a simpler solution. I found one by using a built-in Arduino function (built into the code writing system, not the microcontroller!). This function is one of several that treat a number as a string of binary bits. They are called the “bit functions.” The one I used is called “bitRead().” You give this function almost any number and it can tell you whether there is a “1” or a “0” in any of the places in its binary form. For example, the number 255 is binary “11111111.” All its places are ones. The number 254, one less, is B11111110. There’s a zero at the end instead of a one. So bitRead(254,0) would return zero, while bitRead(254,1) would return 1. As is customary in most of these programming languages, lists of things usually start with “item 0” instead of “item 1” as most of us would assume. So, if you want the first item in the list you have to ask for “0” and if you want the 8th item you ask for “7”. Seems weird but you get used to it after a while.

For the eight segments on an LED display (including the decimal point) there are 256 possible different patterns, each represented by a number from 0 to 255. So I just had to figure out which numbers would produce the correct patterns to display numerals 0 to 9 on the display, then put those numbers in a list, with their position in the list corresponding to the numeral they represented. Then to display that numeral, I would just have to use bitRead() on the number selected from the list, going through each of the 8 binary places, and matching up each place with the pin I used for that segment (another list) and I would have the entire pattern properly outputted.

For my hardware, I wasn’t using the decimal point, and the list I came up with was: {63,6,91,79,102,109,125,7,127,111} for numerals 0 to 9. The numeral 8 has all seven segments on, so would be 127 (B1111111) in almost any system using this idea. The other numbers could change if the wiring of pins to segments was different than the one I used.

Note on touch screen styluses

I’ve been playing around with my touch screen devices, an iPod Touch and an HP Stream tablet. They both have “capacitive” screens and therefore require a conductive rubber stylus if you don’t want to use your fingers. I found a nice ballpoint pen downtown that uses the “eraser” as a stylus tip, and two children’s styluses at Walmart. I like to use the styluses instead of fingers, and hope to locate a drawing program for my tablet before too long.

styluses for touch screens

Patterns caused by different frequencies

21 January 2018

interference pattern
The above photo (which I have colorized and cropped) from Wikimedia Commons illustrates how two similar wave patterns can interfere with each other.

I have been working with this basic phenomenon as a possible way to create interesting patterns in LED displays that could be configured to interact with the environment.

My simpler prototype uses 12 yellow LEDs in a circle. The illustrations below show them in rows. This made it much easier to draw the illustrations.

Two Signals

The basic idea is to compare two different signals in a way that is interesting.

This design uses voltage-controlled oscillators to create a pair of square waves.

Each wave is then applied to a circuit that turns it into a repeating pattern with twelve parts. The corresponding outputs are then compared, and an LED is turned on or off depending on the result of that comparison.

The comparison logic I used for my first prototype turns the LEDs on only when both outputs being compared are “on” (about +5 volts in this case). There are other types of logic possible. This particular one gives the lowest current usage from the power supply.

So there are 12 LEDs, and each LED can only be on for one-twelfth of the time it takes for the pattern to repeat. But they will all fully light during their time slot only if the two signals being compared are exactly the same.

Otherwise, the LEDs will turn on and off in a pattern based on how different the two signals are. Here I have illustrated a few possible patterns. The yellow strip is the “reference” frequency, and the light blue strip is the other frequency. The lime green bands depict which LEDs will turn on, and for how long, based on my chosen comparison logic.

If the two signals are close but not exactly the same, the circle of LEDs will dim and brighten as the signals slowly go in and out of alignment. This is similar to how two musical notes that are close to each other will “beat” (get louder and softer).

two similar frequencies

If the two signals are a lot different, but related mathematically, they will produce a pattern of light and dark in the display.

As it is almost impossible to adjust the two oscillators to exact frequency multiples, the actual result is a fast or slow rotation of the pattern, depending on how far off they are.

Oddly, a 3 times difference in frequency produces a 2-node pattern.

frequencies different by factor of three

And a 4 times difference in frequency produces a 3-node pattern.

frequencies different by factor of four

Here is an image of my prototype – doctored to remove most of the distracting details of wiring and so forth on the circuit boards – showing a 3-node pattern that is slowly rotating. Here, three LEDs are much brighter, and three others are just beginning to turn on as the pattern slowly rotates.

3 nodes in circle

Three node pattern with LEDs in a circle.

Other Designs

I also made a display that uses my “signature” pattern of 8 concentric circles, starting with one having only three LEDs in it, and ending with one that has ten LEDs. This is a more interesting display to watch, but the results are more difficult to interpret. It is also more difficult to make. So I will likely continue to work with simpler designs as I develop this idea.

Software

These designs don’t use any software; totally hard-wired, as they say. My experience with software that runs on controllers that I can afford is that it doesn’t run fast enough to provide a smooth display that doesn’t blink. So, though I plan to use controllers in some of these designs, I prefer designs where they are not needed and we are dealing totally with the real-time interactions of signals.