📜 ⬆️ ⬇️

Shadowplay LED Watch on the Arduino Uno Platform

Instead of intro




So, our team of three people was faced with the task: to assemble a small hardware project in a very short time, preferably on the Arduino platform. It is worth making a reservation that up to that moment we were familiar with circuitry, for the most part, in theory. And that means - neither the experience with a soldering iron (practically), nor, all the more, the experience with an Arduino.

Suddenly, we stumbled upon an article dedicated to the project Shadowplay Clock. This wall clock, designed by a team of Viennese designers, the time on which you can see by touching your finger to their center. The LEDs light up in such a way that the finger shadow in the center shows the time. It was decided to create the same (or very similar), but at home. The above article, as you can see, does not contain a detailed description of the project. From all this it followed that we ourselves had to figure out how this device worked, and bring it to life. What we actually do.

Materials


To create watches you need:
')

Let's get started


So, the algorithm of the device:

  1. When power is applied, the LEDs turn on in the specified combination. In the original Shadowplay, all the LEDs light up, but it seemed to us that it would be more interesting to launch some combination as a screensaver.
  2. When you press the button (yes, we also moved away from the original and inserted a small button in the center), the time is read from the RTC module.
  3. The read time is converted into a binary code (mask) and entered into registers.
  4. Depending on the mask, the required diode is lit.

Hardware


When we finally decided on the idea of ​​the project, first of all we tried to mentally sketch out approximate versions of schemes for its implementation. The main question was how to address 60 LEDs. As a matter of fact, the answer to this question determined the way of constructing practically the whole scheme.

The first option that came to mind was associated with the use of decoders. The scheme was a cascade of four decoders 4 - 16 and one decoder 2 - 4, both of which with decoding enable inputs. Such a cascade made it possible to provide addressing to 64 outputs, which was enough to connect 60 LEDs.

However, then the question arose about how with this scheme at the same time get to work (address) more than one LED (after all, we needed to provide the clock with at least the minute and hour hands). This is where the main drawback of this scheme manifested itself - the decoder cannot, by definition, address more than one output simultaneously.

This flaw forced us to abandon the idea of ​​a cascade of decoders. In addition, now we have another requirement for the future scheme - support for the simultaneous operation of a different number of LEDs.

To satisfy this requirement, we thought that it would be possible to allow each LED to store its state. Registers are well suited for this purpose, where each individual digit corresponds to the state of one of the LEDs. We decided to use registers for 8 bits, as they are more common and more practical. Accordingly, in our scheme, we need 8 such registers to provide support for 60 LEDs.

Then we thought about how to manage the state of LEDs with Arduino through registers. Each register for normal operation must receive all 8 bits entirely. Arduino Uno, of course, provides enough outputs for transmitting several bits at the same time, but this approach would not be rational. In addition, there are only 8 registers in the scheme, which means you need to address them somehow. For this purpose, we added a descrambler and two 8-bit shift registers connected by a cascade to the circuit. One shift register stores an 8-bit state mask that will be loaded into one of 8 regular registers, the number of which is stored in the second shift register. Accordingly, a descrambler is connected to the second shift register. For these purposes, a decoder is enough for 3 to 8.

To remove the inversion from the required number of outputs, we used two inverter circuits KR1533LN1. This, of course, somewhat complicated the scheme.

Another task was the operating voltage of the LEDs equal to 12 volts compared with 5 volts of logic chips. The proposed solution was to use an open drain inverter. Such a microcircuit plays the role of a key that closes (with logical 1) or opens (with logical 0) one of the contacts of the LED with the ground, thereby turning on or off the LED. The circuit assumes work from 12 volts, in accordance with the operating voltage of the LEDs, therefore, in order to get 5 volts for logic chips, a stabilizer KR142EN5A with two capacitors was added to the circuit.

Some inputs of certain microcircuits imply a constant value at the input, so they were brought to the ground or power supply. In this case, these are the following inputs:





The circuit is controlled by four inputs (E1, SH, ST, DS). The purpose and signal levels of each of them will be discussed in more detail below:

Input E1 is designed to enable the decoder. In our case, initially there are two control inputs E1, E0 on the decoder, and both of them are inverse. Output will be enough and one, so the second (E0) can be brought to the ground. The state of the decoder “by default” is operational until you have a high signal level at E1. In order to do the opposite, we connected this input to the inverter. Without this, the decoder may issue incorrect control signals to the registers, for example, at the time of updating the data in the shift register. As already mentioned, a 3 by 8 decoder can be used in the circuit, which can have one non-inverse control input, which will make it possible to easily solve all the problems described above without unnecessary wires and a soldering iron.

When applying a single signal level to E1, the decoder decodes the address of the register located in the corresponding shift register, and sends a signal to the desired output. After that, the decoder is turned off again by applying a low level signal to E1. Such a switching of the decoder generates a signal at the desired output, the front and the fall of which serve to register the clock pulse for snapping into itself the data stored on the bus.

The following three inputs are intended to control shift registers. It is worth starting with the simplest thing - DS data entry. This input, as the name implies, is intended for data transmission. Since the shift registers in the circuit are connected in cascade, DS is the corresponding output of one of them. The input of the second shift register is connected to the output of the last digit of the first register. The result is a single shift register for 16 bits, of which only 12 bits are used.

The SH input is the clock input. This input is supplied with a meander, which is responsible for loading and shifting data in each of the registers, respectively, this contact of the circuit is connected to the SHCP pins of both registers.

The last pin of the ST is the data latch on the register outputs. A pulse is fed to this input, but it is fed only when the data in the shift register are loaded finally and it is required to fix them at the output of the registers. Only after the application of this signal, the loaded data inside the register on the first row of triggers fall on the second row of triggers and become available on the bus. ST is a contact connected to the STcp pins of both registers.

It remains to explain the layout of the two outputs of the MR and OE shift registers. The first input (MR) is responsible for resetting data within the register. In this scheme, this possibility is not required, therefore, a high signal level is applied to this output through the load.

The second register input (OE) is responsible for disabling the second row of triggers inside the shift register from the bus, i.e., the enable input. This function is also not required, so the output starts on the ground.

Another contact not described above is designed to remove the level of the signal from the button in the center of the clock, the button's pattern is typical and represents the load and key, depending on the position of which a low or high signal is applied to the Arduino. Depending on the button state, the clock works either in the screen saver mode or in the time display mode.
Connecting to an Arduino has no features, except that the SH pin ideally connects to the SCK digital pin. The remaining outputs of the circuit can be connected to any of the available general-purpose digital inputs. In our case, the connection is as follows:

Source: https://habr.com/ru/post/394107/


All Articles