iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🦊

Simple Electronic Kokkuri-san

に公開

Kokkuri-san

Kokkuri-san is a well-known divination ritual. It is performed using the following steps:

Kokkuri-san Paper
Kokkuri-san Paper

  1. Prepare a piece of paper and a coin as shown in the figure above. Place the coin on the paper and rest your index finger on the coin.
  2. Call out, "Kokkuri-san, please come." At this point, the coin may move, which is attributed to Kokkuri-san.
  3. Ask Kokkuri-san several questions. Kokkuri-san will answer by moving the coin.
  4. Once you are finished with Kokkuri-san, you must release him. Call out, "Kokkuri-san, please return home."
  5. That is all.

Simplified Kokkuri-san through Electronics

Among the behaviors of Kokkuri-san mentioned above, we will build a version that can answer "yes" or "no" questions using electronics. This project will not use a microcontroller.

Overall Circuit Diagram

The overall circuit diagram is shown below. The IC used is a 74HC14 compatible part. The power supply is assumed to be 3V from two AA batteries.

Circuit diagram for the simplified Kokkuri-san
Circuit diagram for the simplified Kokkuri-san

Explanation of Each Part

IC 74HC14

The 74HC14 is a CMOS Schmitt-trigger inverter.

74HC14 Pin Connection Diagram
Pin connection diagram

What is an Inverter?

An inverter is a component that inverts logic. In other words, when a high level (3 V) is input, it outputs a low level (0 V), and when a low level is input, it outputs a high level.

What is a Schmitt Trigger?

A circuit with hysteresis characteristics in its input—where the threshold for switching from a high level to a low level differs from the threshold for switching from a low level to a high level—is called a Schmitt trigger.

Oscillation Circuit

The oscillation circuit is located around the bottom left of the circuit diagram.

Oscillation circuit diagram
Oscillation circuit

Explanation

You can verify the sequence of operations described here in the simulator.

  1. Assume that the voltage across C is currently 0 V. Since the inverter's input voltage is at a low level, the output becomes a high level. Consequently, C is gradually charged through R.

  2. As charging progresses and the inverter's input voltage exceeds the threshold, the output switches to a low level. Then, C is gradually discharged through R.

  3. As discharging progresses and the inverter's input voltage crosses the threshold, the output switches back to a high level. Thereafter, this operation is repeated.

Oscillation Frequency Guidelines

The approximate oscillation frequency f is f = \cfrac{1}{CR} \quad (V_{CC} = 5\,\text{V}). In practice, it is also influenced by the power supply voltage and the parasitic capacitance of the circuit. In this circuit, V_{CC} = 3\,\text{V}, so f will be smaller than 100\,\text{Hz}. In the prototype circuit, it was approximately 70 Hz.

Sample-and-Hold Circuit

The sample-and-hold circuit is located around the bottom center of the circuit diagram.

Sample-and-hold circuit diagram
Sample-and-hold circuit

Explanation

You can verify the sequence of operations described here in the simulator.

  1. When the switch is not pressed, the output of the first-stage inverter does not reach the next-stage inverter.

  2. When the switch is pressed, C is charged or discharged by the output of the first-stage inverter. The signal then reaches the next-stage inverter.

  3. When the switch is released, the input to the next-stage inverter becomes the voltage stored in C. For example, if the switch is released when C is charged (at high level), the input to the next stage will remain high.

  4. As long as the switch remains released, the input level of the next-stage inverter does not change, so the V_{out} level remains constant.

Caution

When connecting a large capacitor (>500 pF) to the output terminal of a CMOS IC, a large current may flow at the moment of signal switching, which can cause noise or damage the IC. To prevent this, a current-limiting resistor is connected (R in the diagram above).

Note that this R and C form a low-pass filter (LPF). If the signal is smoothed out here, the subsequent circuit will not function. In this circuit, R = 1.0\,\mathrm{k\Omega} and C = 1000\,\text{pF}, so the LPF cutoff frequency f_C is f_C = \cfrac{1}{2\pi CR} \approx 160\,\text{kHz} \gg 100\,\text{Hz}, which surely will not affect the operation.

LED Drive Circuit

The right side of the circuit diagram is the circuit that drives the LEDs.

Circuit diagram for the LED drive circuit
LED drive circuit

Explanation

When V_{in} is at a high level, the left LED lights up, and when it is at a low level, the right LED lights up.

Resistor Values

Resistor R limits the current flowing through the LED. A typical LED will shine brightly with even 5 mA of current. If we assume the forward voltage drop V_F of the LED is V_F = 1.8\,\text{V}, since R = 330\,\mathrm{\Omega} in this circuit, the current I_F flowing through the LED is I_F = \cfrac{V_{CC} - V_F}{R} \approx 3.6\,\text{mA}. It might be okay to let a bit more current flow, but since it is lighting up properly, we will consider it good.

Power Supply Circuit

The top center of the circuit diagram is the power supply circuit. The power source consists of two AA batteries connected in series.

About Capacitors

C_3 is what is known as a bypass capacitor (commonly called a decoupling capacitor); it removes noise from the power supply voltage and prevents IC malfunctions. This capacitor should be placed as close as possible to the power pin of the IC.

C_4 is a capacitor used to stabilize the power supply voltage.

Operation Check

When you release the switch, only one of the left or right LEDs will light up randomly. While the switch is being pressed, the LEDs blink at high speed.

Animation of operation check
Leaving the decision to Kokkuri-san

Conclusion

That's all.

There was not a single element of programming in this article. Since Zenn is an "information-sharing community for engineers," I thought it would be nice if there were a world where people specializing in the design and production of electronic circuits could share their expertise, or mechanics could share tips for using a lathe.


References

Discussion