Brain rhythms are represented as continuous analog signals using sinusoidal functions. The general mathematical representation of a continuous sinusoidal waveform is given by Equation (1).
where x(t) is the amplitude of the signal at time t, A denotes the peak amplitude, f is the frequency in Hertz (Hz), and
, represents the phase shift in radians. This continuous function captures the smooth oscillations of brain rhythms over time. To represent these continuous signals in a digital system, they must be discretized into a series of digital samples. This process involves sampling the continuous signal at regular intervals and quantizing the amplitude values to fit within a finite digital range. The digital representation of a signal is governed by the sampling theorem, specifically the Nyquist–Shannon sampling theorem, which states that
Fs ≥ 2⋅
fmax, where F
s is the sampling frequency and f
max is the highest frequency component in the signal. This theorem ensures that the signal can be accurately reconstructed from its samples without aliasing, which occurs when high-frequency components are misrepresented as lower frequencies. To discretize the analog signal, we sample it at intervals of
Ts, the sampling period, where T
s = 1/f
s.
Thus, the discrete-time signal
x[
n] can be expressed by Equation (2).
where
n is an integer index representing each discrete time step. Quantization is the process of mapping these continuous amplitude values to a finite set of discrete values, which is determined by the number of bits used in the digital representation. Therefore, with b bits of resolution, the amplitude is quantized into 2
b levels, and each sample is assigned one of these levels. In practical terms, if the continuous analog signal has a frequency component f of 50 Hz, and the chosen sampling frequency f
s is 1000 Hz, the sampling period T
s is 1/1000 s. For a signal with a period T = 1/f, the number of samples per period is given by Equation (3).
This ensures that each cycle of the continuous signal is accurately captured by the discrete samples. For digital chip design, representing brain rhythms as discrete pulses allows the implementation of digital systems that can process and analyze these signals in real time. The digital pulses approximate the analog waveform by converting continuous variations in amplitude and time into a series of discrete values, making it feasible to integrate these signals into digital hardware. The transition from analog to digital representation involves approximating the continuous waveform with a sequence of digital values, facilitating efficient processing and analysis in digital circuits. This approach is essential for implementing brain rhythm simulations on digital chips, enabling real-time applications in neurotechnology and cyber-physical systems.
2.1. Software Design and Implementation
This section of the paper presents a case study demonstrating the practical applications of a custom-designed chip capable of generating these rhythms using open-source tools. By leveraging the Google Skywater 130 nm technology, the study illustrates how such a chip can be used for real-time modulation of brain signals, offering a cost-effective approach to advancing research and therapeutic interventions in neurotechnology. The Alpha, Beta, and Gamma rhythms were first simulated in software by using Python on Thonny design suite (Windows 10, Python 3.10.11, Tk 8.6.13) running on intel
[email protected] GHz quad core.
Different brain rhythms, such as Alpha, Beta, and Gamma, represent various patterns of electrical activity in the brain, each associated with different cognitive and physiological states. Alpha rhythms, typically observed during relaxed wakefulness, range from 8 to 13 Hz and are crucial for calming the mind. Beta rhythms, ranging from 13 to 30 Hz, are associated with active thinking and focus, while Gamma rhythms, from 30 to 100 Hz, are linked to higher cognitive functions such as problem-solving and perception. The simulated waveforms are shown in
Figure 1.
Figure 1 illustrates digital step signals for three distinct brain rhythm frequencies: Alpha, Beta, and Gamma. The purpose of the simulation is to demonstrate the variations in these rhythms, including how they are sampled and represented digitally. The sampling frequency used was 1000 Hz. This rate is crucial for accurately capturing the characteristics of the signal. In practical terms, this means that each second of the signal is divided into 1000 discrete points. Retrospectively, for the Alpha rhythm, which has a period of 100 milliseconds, there are 1000 samples in one second, so each cycle of the Alpha rhythm is represented by 100 samples.
The top plot in
Figure 1 represents the Alpha rhythm at 10 Hz and shows that this rhythm completes one full cycle every 100 milliseconds. This slower oscillation is reflected in the plot as longer periods between transitions. The 1000 Hz sampling rate ensures that these transitions are captured with adequate detail, providing a clear depiction of the Alpha rhythm. The middle plot illustrates the Beta rhythm at 20 Hz. This rhythm has a shorter period of 50 milliseconds, meaning that each cycle occurs more frequently than the Alpha rhythm. The plot shows these more frequent transitions, with the Beta rhythm completing a full cycle every 50 milliseconds. The sampling rate of 1000 Hz is still sufficient to accurately represent these faster transitions. The bottom plot displays the Gamma rhythm at 40 Hz. This rhythm oscillates even more rapidly, with a period of just 25 milliseconds. The plot captures these rapid changes, highlighting the short time intervals between each transition. The high sampling frequency of 1000 Hz is essential here to ensure that the quick oscillations of the Gamma rhythm are accurately depicted. In all three subplots, the
x-axis represents time in seconds. The
x-axis is scaled consistently across all plots to allow direct comparison of the different rhythms.
The total duration shown in each plot is 10 s, which covers multiple cycles of each rhythm, offering a comprehensive view of how each rhythm behaves over time. The y-axis in each plot represents amplitude, showing the signal’s high and low states. The step function in the plots depicts these transitions, where each rhythm alternates between a high state and a low state. The plots include labels and titles to specify the type of rhythm and its frequency, with the x-axis labeled as “Time (s)” and the y-axis labeled as “Amplitude”. Overall, the figure demonstrates how different brain rhythms are represented digitally, highlighting the importance of a sufficient sampling frequency to capture the details of both slow and fast oscillations. The consistent sampling rate of 1000 Hz across all rhythms ensures that each rhythm is accurately captured, providing a clear and detailed visualization of their characteristics.
Similar to Alpha, Beta, and Gamma rhythms, Delta and Theta rhythms are crucial brainwave patterns with distinct physiological and cognitive roles. Delta rhythms, characterized by frequencies between 0.5 and 4 Hz, are predominantly associated with deep sleep and are believed to facilitate restorative processes and memory consolidation [
20]. The plot shown in
Figure 2 generates and visualizes two types of brain rhythms, Delta and Theta, over 10 s using a sampling frequency of 1000 Hz. To create the time axis, an array is generated that spans from 0 to 10 s in 1-millisecond intervals. This array provides a detailed time scale for the
x-axis, allowing each sample point to be accurately plotted. For signal generation, the Delta rhythm has a frequency of 2 Hz, which translates into a pulse occurring every 500 samples, while the Theta rhythm has a frequency of 5 Hz, resulting in a pulse every 200 samples. These specific frequencies determine the spacing and duration of each pulse in the signals. In the top subplot, the Delta rhythm is depicted with green step plots, showing periodic pulses every 500 samples. This creates a pattern reflecting the rhythm’s lower frequency. The bottom subplot displays the Theta rhythm in red step plots, with pulses occurring every 200 samples, illustrating the higher frequency of this rhythm.
Unlike regular brain rhythms reported in neuroscience, epilepsy is a neurological disorder characterized by recurrent seizures caused by abnormal electrical activity in the brain. Seizures often manifest as distinct changes in the brain’s electrical rhythms, which can be observed using electroencephalography (EEG). These rhythms, categorized into different frequency bands, play a crucial role in understanding and managing epilepsy. The plots shown in
Figure 3 visualize pulse signals at various frequencies, simulating chaotic behavior similar to that observed in epileptic seizures. This approach is essential in understanding how different frequency components interact to model complex neurological patterns.
The sampling frequency, set at 1000 Hz, ensures a high-resolution representation of the pulse signals. With a total duration of 10 s, this results in 10,000 samples, creating a detailed time series for analysis. The time array is generated to span this duration with 1-millisecond intervals between samples, providing an accurate depiction of the pulse signals over time. The top plot illustrates a pulse signal with a low frequency of 2 Hz. Here, the
x-axis represents time in seconds, while the
y-axis shows the amplitude of the signal, which alternates between 0 and 1. At 2 Hz, the signal completes a cycle every 0.5 s, resulting in a repetitive pattern of pulses. Low-frequency oscillations, such as those in the Delta (0.5–4 Hz) and Theta (4–8 Hz) bands, are associated with various brain states. Delta waves are linked with deep sleep, while Theta waves are observed during lighter sleep and certain cognitive processes [
20]. This plot captures the lower end of these oscillatory patterns, providing insight into baseline brain activity. The second plot depicts a pulse signal with a medium frequency of 5 Hz. The time axis and amplitude axis follow the same conventions, but at 5 Hz, the signal completes a cycle every 0.2 s. This creates a more frequent pulse pattern compared to the 2 Hz signal. Medium-frequency oscillations, such as those in the Theta range, are often observed during cognitive tasks and can reflect transitional brain states. In epilepsy, these frequencies may appear during seizures or abnormal brain activity [
21]. This plot demonstrates the contribution of medium-frequency components to overall brain dynamics. The third plot (from the top) shows a pulse signal with a high frequency of 15 Hz. The signal oscillates every 0.067 s, leading to a densely packed pulse pattern. High-frequency oscillations, including Beta (13–30 Hz) and Gamma (30–100 Hz) bands, are associated with heightened neural activity and various cognitive functions. They are also relevant in the context of epileptic seizures, where high-frequency bursts can indicate increased seizure activity [
22].
This plot illustrates how high-frequency components are represented, which is important for understanding the impact of rapid oscillations during seizures. The bottom-most plot presents a chaotic pulse signal with dynamically varying frequency. The
x-axis shows time, and the
y-axis indicates the amplitude of the signal, which changes to simulate seizure-like behavior. The signal begins with a low frequency, transitions to a medium frequency, and then shifts to a high frequency. This modulation reflects the complex and dynamic nature of epileptic seizures, where frequency and amplitude fluctuate unpredictably due to the rapid synchronization and desynchronization of neural activity. In actual seizures, the brain’s normal rhythms are disrupted, leading to irregular and high-amplitude bursts of activity [
21].
This chaotic behavior in the plot offers a visual representation of the erratic nature of seizure activity, providing valuable insights into the dynamics of neural oscillations during epilepsy. The generated plots effectively illustrate how different frequency components and their combinations can model brain activity and epileptic seizures. By varying the frequency dynamically, the chaotic signal captures the unpredictable nature of seizures, enhancing our understanding of these complex neurological phenomena. This simulation serves as a valuable tool for analyzing seizure activity and offers a foundation for further research into the dynamics of epilepsy. Furthermore, such simulations can enhance the development of methods for seizure detection and modulation, providing practical applications for real-time monitoring and therapeutic interventions [
22].
2.2. Hardware Design and Implementation
Digital counters are fundamental components in digital electronics, used to count pulses or events, and are employed in this study to generate periodic waveforms, including various brain rhythms such as Alpha, Beta, Gamma, Delta, and Theta rhythms. These counters operate by incrementing their count with each clock pulse and can be tailored to produce specific frequencies by adjusting the counting range and clock frequency. In this study, synchronous counters were utilized to generate periodic signals corresponding to these brain rhythms.
The basic operation involves a counter that increments with a clock signal and generates an output pulse when a designated count is reached. This pulse can then be used to create waveforms with the desired frequencies. To produce the Alpha rhythm at 10 Hz, with a clock frequency of 1 kHz, the counter produces an output pulse every 100 clock cycles. Therefore, a counter with 100 stages, or a modulus of 100, is employed, which is implemented as a 7-bit counter with additional logic to reset at 100 counts. This design ensures that a pulse is generated each time the counter reaches 100. For the Beta rhythm at 20 Hz, also with a 1 kHz clock frequency, the counter needs to generate a pulse every 50 clock cycles. Thus, a counter with 50 stages or a modulus of 50 is used. This is implemented with a 6-bit counter, producing a pulse whenever the counter reaches 50. To achieve the Gamma rhythm at 40 Hz, the counter must output a pulse every 25 clock cycles. A counter with 25 stages, or a modulus of 25, is used, which is implemented with a 5-bit counter. This setup generates a pulse each time the counter reaches 25. Each of these counters is designed with an appropriate number of flip-flops to match its modulus.
For the Alpha rhythm, seven D-flip-flops were used, as this is sufficient for the modulus of 100. For the Beta rhythm, six flip-flops are adequate, and for the Gamma rhythm, five flip-flops are used, as 25 = 32 is enough for the modulus of 25. Each counter is connected to a 1 kHz clock source, with flip-flops arranged in series and logic gates employed to decode the count and generate the output pulse. These digital counters and their waveforms are designed to be implemented on a chip using the Google Skywater 130 nm node with open-source tools.
This open-source approach allows for the development and fabrication of the chip at a lower cost, fostering innovation and accessibility in academic settings with limited resources to budget and tools. The digital waveforms produced by these counters are characterized as periodic pulses, demonstrating the rhythm frequencies. For instance, the Alpha rhythm’s waveform displays a pulse every 100 clock cycles, the Beta rhythm shows a pulse every 50 clock cycles, and the Gamma rhythm reveals a pulse every 25 clock cycles. These waveforms are depicted as digital step functions, highlighting the periodic nature and frequency of each brain rhythm. In each design, the D flip-flops are connected in a series configuration to form a binary counter. The clock input drives the flip-flops, and the output from the last flip-flop is used to determine when the counter reaches the specified count. A comparator was employed to detect the specific count value and generate an output pulse. The reset logic ensures that the counter restarts after reaching the designated count, maintaining periodic waveform generation.
A synthesis view of the circuit diagram simulated by Yosys 0.38 [
23] is shown in
Figure 4. The circuit was simulated with Icarus Verilog 12.0, and simulations are shown in
Figure 5. An overall flowchart from design specification to implementation, including GDS generation and final chip characterization, is shown in
Figure 6. As shown in
Figure 4, square boxes represent cells. Outputs are shown on the right, while input ports are shown on the left. The first line of text inside the box indicates the cell name for internal cells. The second line specifies the cell type. Internal cell types start with a dollar sign. Diamond-shaped nodes represent wires that are not ports (blue wires interface), whereas octagon-shaped nodes represent ports (purple wires interface). Elliptical nodes are constant drivers (green wires interface and standard paths), and their labels follow the format <width>’<bits>. Boxes with rounded corners and labels such as 4:0–4:0 are used to break out and re-combine nets from buses (olive wire control signal). These boxes help manage and reorganize signal connections within a bus structure.
To calculate computational latency for software simulations and hardware synthesis, unlike commercial tools, the open-source tools used in this study provide very limited automated options. In this work, an HP ProBook laptop was used with Intel(R) Core i7-10510U CPU @ 1.80 GHz, four cores, and eight logical processors with 8 GB RAM. Given the complexity of the code, computational latency is negligible. The computational latency for software simulations was recorded as 6 milliseconds for various brain rhythms generation. For hardware simulations, Yosys, an open-source tool, does not provide built-in functions for measuring synthesis time; however, a time counter in Verilog is included. The CPU user time was recorded as 0.03 s, and the system time as 0.01 s. Hence, the total elapsed time for the synthesis of the FSM using Yosys was recorded as 40 milliseconds. A screenshot of the calculated time is shown below.
Similarly, Yosys does not provide a built-in power analysis tool; however, the power consumption could be estimated using the demo board’s 3.3 V IO supply voltage and 4 mA drive strength. For the low-frequency digital circuit, static power consumption is considered negligible, and dynamic power consumption can be estimated using the following expression, as shown in Equation (4).
The load capacitance could be estimated by Equation (5).
For 1 kHz operating frequency, 3.3 V IO supply voltage, and 4 mA drive strength, the load capacitance is ≈1.21 uF. Hence, the dynamic power consumption is estimated at 42 mW.
2.5. IoT Connectivity with Mobile App Interface
To enhance the functionality of the open-source customized platform for brain rhythm generation, an open-source Blynk mobile application was integrated with the platform [
29]. The Blynk app was developed to remotely control the Wi-Fi module integrated into an Arduino board. This integration demonstrates how the platform can be extended into an integrated IoT ecosystem, allowing wireless control of modulating brain rhythms. By introducing this IoT feature, we can illustrate how IoT-enabled wireless communication modules interact with the custom-designed brain rhythm chip, enabling real-time control and monitoring, as illustrated in
Figure 10 and
Figure 11.
The integration was achieved by setting up an Arduino board (MKR WIFI 1010) [
30] with a Wi-Fi module, which facilitated wireless communication between the Blynk mobile app and the brain rhythm chip. The Arduino board was programmed using the Arduino IDE, and code was developed that allowed the Arduino to receive commands from the Blynk app and transmit them to the brain rhythm chip via the GPIO pins, as shown in
Figure 10. The Wi-Fi module was configured to connect to a local wireless network, enabling communication between the mobile app, Arduino board, and the brain rhythm chip. In the code implementation, the SAMD21 Cortex-M0+ module connected to the local Wi-Fi network using authentication tokens from the Blynk app. The mobile app sent control commands to the Arduino via the Wi-Fi module, which were then relayed to the brain rhythm chip. The Blynk app’s switches were mapped to virtual pins (2, 3, and 4), which allowed the user to select different brain rhythm frequencies (such as Alpha, Beta, and Gamma) connected through the Arduino IoT board to the input pins of the daughter board. When the user selects the virtual switch, it sends a signal through the SAMD21 Cortex-M0+ microcontroller to the GPIO pins to trigger the corresponding output on the chip, as illustrated in
Figure 11.
This setup allows for smooth interaction between the mobile app and the hardware, resulting in a fully functional IoT-enabled brain rhythm modulator. The Blynk mobile app was configured with user-friendly interfaces to instantiate different frequencies, emulating brain rhythms wirelessly. This user interface enables quick and easy control over the chip’s output, making the system accessible for further research in IoT-enabled neural signal modulation. The platform successfully demonstrated the ability to wirelessly switch between different brain rhythms without manual reconfiguration, showcasing its flexibility and robustness, as shown in
Figure 12.
The proposed IoT platform, combined with the Blynk app interface and a custom-designed chip developed with all open-source tools, serves as a novel platform for learning and research. It enables researchers to gain practical experience with IoT, hardware–software integration, and system design. The simplicity of the app interface makes it easy for researchers to experiment with IoT-enabled devices. This approach also fosters innovation, allowing engagement with cutting-edge technologies in a meaningful way. In addition to its educational benefits, the integration offers scalable possibilities for industrial applications. Combining IoT, and real-time brain rhythm generation, as a prototype opens the door to applications in smart healthcare solutions, adaptive control systems, and real-time neural signal processing. The computational latency and low power aspects pave the way for standalone IoT applications, as alluded to in
Section 2.2.
The designed chip was interfaced with an Arduino MKR Wi-Fi 1010 powered by the SAMD21 Cortex-M0+ 32-bit ARM microcontroller, offering efficient performance with low power consumption, making it ideal for IoT applications. It integrates the NINA-W102 module (based on ESP32) for Wi-Fi and Bluetooth connectivity, supporting 2.4 GHz networks while maintaining energy efficiency for battery-powered applications. The author acknowledges the use of Grammarly 14.1202.0 and ChatGPT 4 mini in the process of translating and improving the clarity and quality of the English language in this manuscript.