A fundamental software framework was meticulously crafted to execute the intricate measurements elucidated earlier. This ingenious framework was ingeniously engineered to seamlessly orchestrate various tasks, namely generating a Pulse Width Modulation (PWM) signal as an output and acquiring precise voltage readings as inputs from Analog-to-Digital Converters (ADCs). The virtuosity of this software framework lay in its adept utilization of STM's Hardware Abstraction Layer (HAL) Drivers, facilitating a harmonious interface between software and hardware components.
Within the intricate tapestry of this software architecture, the core task involved the determination of amplitudes and phases associated with the fundamental frequency. This was achieved through the adept application of a simple yet robust Discrete Fourier Transform (DFT) algorithm, meticulously designed to cater to the resource constraints of microcontroller environments. The efficacy of this DFT implementation was further enhanced by leveraging the power of Look Up Tables (LUTs), precomputed repositories of sine and cosine wave functions. These LUTs provided an efficient means to expedite the computation of sine and cosine values, ensuring expeditious and precise calculations, thereby rendering this software framework exceptionally adept in fulfilling its intended objectives.
To swiftly gain access to the sensor-derived data, an Android-based application was diligently developed. This application facilitated communication between the Android device and the sensor through the use of a Bluetooth transceiver module, taking advantage of Android's inherent support for the Bluetooth network stack. The development of this application was carried out using Java as the programming language, within the Android Studio integrated development environment (IDE).
Data packets in JSON format were employed to convey essential information from the LCR circuit to the Android device. These data packets included not only the measured value but also a timestamp, providing context regarding when each measurement was taken. Upon the conclusion of the measurement phase, the application efficiently processed the data and presented a concise result, either positive or negative, on the device's screen. This harmonious integration of software and hardware components ensured a seamless and informative user experience.