PIC 16F88 Microcontroller PIC based Tengu

13,949

Circuit Image

Tengu derives its name from a mythical Japanese creature known for getting into mischief. However, this Tengu is more earthly in nature. It responds to voice and sounds, changing its facial features depending on the intensity of the sound. If no sound is detected for a period, it transitions from a happy face to a sad face and then goes to sleep. Gently blowing on its face wakes it back up to its usual happy self. The project is based on a Microchip PIC 16F88, which is part of their mid-range microcontrollers. The sound is amplified through a pre-amplifier circuit based on the 2N3904 transistor and fed to the RB7/AN6 (pin 13) of the PIC microcontroller. The A/D converter on the microcontroller is utilized to convert the analog signal from the pre-amplifier. The LED matrix is directly driven by the PIC. To display the entire smiley face, the LED dot matrix is multiplexed so that only one row out of the seven is active at any given time. However, the rows are activated and deactivated rapidly, creating the illusion of a full picture to the human eye, a phenomenon known as persistence of vision. To achieve multiplexing, Timer 0 on the PIC operates at approximately 1 ms timeouts to switch the displayed row on the LED matrix. Timer 1 is configured as a general-purpose timer to track the time since any noise exceeding the threshold was detected, which is used to change the smiley face from happy to sad. The code is written in C using the MPLAB and Hi-Tech C compiler version 9.80.

The Tengu project integrates various electronic components and programming techniques to create an interactive visual display that responds to sound. The core of the design is the Microchip PIC 16F88 microcontroller, which serves as the brain of the system. This microcontroller features an integrated Analog-to-Digital Converter (ADC) that allows for the conversion of analog signals from the pre-amplifier circuit into digital data for processing.

The pre-amplifier circuit, constructed using a 2N3904 transistor, amplifies the incoming audio signals, ensuring that even soft sounds can be detected by the microcontroller. The amplified signal is fed into pin RB7/AN6 of the PIC, where the ADC processes the input. The resulting digital signal is then analyzed to determine the intensity of the sound, which influences the facial expression displayed on the LED matrix.

The LED matrix is composed of seven rows, each capable of displaying part of the smiley face. The multiplexing technique employed allows for only one row to be activated at a time, with rapid switching between rows creating the perception of a complete image. This is facilitated by Timer 0, which is programmed to generate interrupts approximately every millisecond. This timing ensures that the switching occurs quickly enough to maintain the illusion of a continuous display.

Timer 1 plays a crucial role in monitoring the duration of silence. When the sound level drops below a predetermined threshold, Timer 1 starts counting. If the silence persists beyond a specific duration, the system triggers a change in the facial expression from happy to sad, indicating a lack of interaction. The transition back to a happy expression occurs when the system detects a sound, such as a gentle blow, which resets Timer 1.

The software for the Tengu project is developed in C using the MPLAB IDE alongside the Hi-Tech C compiler. The code implements the necessary logic for sound detection, facial expression management, and LED matrix control, ensuring a responsive and engaging user experience. Overall, the Tengu project combines sound sensing, visual display, and timing control to create a playful electronic device that captures the essence of its mythical namesake.Tengu derives its name from a mythicalJapanese creature known for getting intomischief. Our Tengu, however is more earthly in nature. It responds to voice and sounds and takes on different facial features depending on the intensity of the sound. If no sound is heard for some time, it changes from a happy face to a sad face and then goes to sleep.

G ently blowing on his face wakes him back up to his usual happy self. The project is based on a Microchip PIC 16F88 which is part of their mid range of microcontrollers. The sound is amplified through a pre-amp circuit based on 2N3904 and fed to the RB7/AN6 (pin 13) of the pic microcontroller. The A/D converter on the microcontroller is used to convert the analog signal from the pre-amp. The LED Matrix is directly driven by the pic. In order to be able to display the entire smiley, the LED dot matrix is multiplexed in such a way that only one row out of the seven is active at any given time.

However the rows are turned on and off so rapidly, the human eye sees it as a full picture. This effect is called the persistence of vision. In order to achieve multiplexing, timer 0 on the pic is running at approximately 1 ms timeouts to switch the row that is being displayed on the LED Matrix. Timer 1 is configured as a general purpose timer used to keep track of the time since any noise over the threshold was heard.

This is used to change the smiley from a happy to a sad one. The code is written in C using MPLAB and Hi-Tech C compiler ver 9. 80. 🔗 External reference




Warning: include(partials/cookie-banner.php): Failed to open stream: Permission denied in /var/www/html/nextgr/view-circuit.php on line 713

Warning: include(): Failed opening 'partials/cookie-banner.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/nextgr/view-circuit.php on line 713