Discolight using PIC16F84ADiscolight using PIC16F84A - 2
Description: External circuit converts bass beat of music into pulses. The motor is controlled by them. If there's bass beat recognized then the motor rotates one direction (in full stepping) for a predefined time then stops. If the second beat comes in then it rotates again for the same time and so on. There is a random number generator (from 1 to 4) written into the code which tells how many times have the motor to rotate one direction. After that, the PIC changes rotation direction of the motor. If the tempo is too fast (<400msec) then the direction is changed immediately. When the motor stops after the predefined time period a counter is enabled. If beat doesn't come in for 15sec the motor starts to rotate slowly in half stepping. If a beat comes in the counter is disabled and the motor continues its normal rotation in full stepping. Half stepping is smoother but unfortunately the torque is less. The PIC can control the motor after every beat or it's possible to bypass some beats. It can be done by pushbuttons. Rotation speed and rotation length can be adjusted too. Settings are limited between values to prevent possible register overflow-underflow. These values are saved in EEPROM so after shut-down the settings don't get lost. A beat consists of a series of vibrations, so the PIC gets a few interrupts. To prevent multi-triggering there's a counter written into the code which disables reaction to beat for 200msecs after the first interrupt. 180msec delay is enough if you are using amplifiers output (or line out) as music source. The delay was increased to 200msec because a microphone is used and the room's echo influences operation.
When programming the PIC16F84A, it is necessary to fill the first three EEPROM locations with the setting values. The values used are: 01 14 E0. The PIC is programmed with Ic-Prog using a simple JDM programmer.
After successfully building the whole hardware, it is necessary to adjust the trimmers very precisely. If adjustments are not experimented with several times, it is possible that the PIC will not recognize every beat due to the small amplification level, or it may perform several actions for only one beat. Therefore, finding the best adjustment is crucial. The original circuit that converts the bass beat into pulses is from Dan Fraser's Audio Trigger Circuit for light chasers, updated by Tomi Engdahl. The line-out control was replaced with a microphone, and the 555 circuitry was removed due to the software solution. The unique aspect of this project is the software for the PIC microcontroller.
The circuit employs a PIC16F84A microcontroller to process audio signals and control a stepper motor based on detected bass beats. The audio input is captured via a microphone, which converts sound waves into electrical signals. These signals are processed to identify bass beats, which trigger the motor's operation.
The motor operates in two stepping modes: full stepping and half stepping. Full stepping provides greater torque but less smoothness, while half stepping allows for smoother operation at the cost of reduced torque. The microcontroller implements a timing mechanism to determine the duration of motor rotation and the direction of rotation based on detected beats, with a random number generator influencing the number of rotations.
To ensure reliable operation, the system incorporates a debounce mechanism to prevent multiple triggers from a single beat detection. This is managed through a timing counter that disables further beat detection for a specified duration after the first detection. The system is designed to save configuration settings in EEPROM, ensuring that adjustments are retained even after power loss.
User adjustments are facilitated through trimmer potentiometers, allowing for fine-tuning of the circuit's sensitivity and response characteristics. This flexibility is essential for accommodating different audio environments and ensuring optimal performance.External circuit converts bass beat of music into pulses.The motor is controlled by them. If theres bass beat recognised then the motor rotates one direction(in full stepping) for a predefined time then stops. If the second beat comes in then it rotates again for the same time and so on.There is a random number generator (from 1 to 4) written into the code which tells how many times have the motor to rotate one direction.After that the PIC changes rotation direction of the motor.If the tempo is too fast (<400msec) then the direction is changed immediately.
When the motor stops after the predefined time period a counter is enabled.if beat doesnt come in for 15sec the motor starts to rotate slowly in half stepping. If a beat comes in the counter is disabled and the motor continues its normal rotation in full stepping. Half stepping is smoother but unfortunately the torque is less)
The PIC can control the motor after every beat or its possible to bypass some beats.It can be done by pushbuttons.
Rotation speed and rotation lenght can be adjusted too.Settings are limited between values to prevent possible register overflow-underflow. These values are saved in EEPROM so after shut-down the settings dont lost. A beat consist of a series of vibrations(dont know the correct english word for that-sorry) so the PIC gets a few
interrupts.To prevent multi-triggering theres a counter written into the code which disables reaction to beat for
200msecs after the first interrupt.
180msec delay is enough if you are using amplifiers output (or line out) as music source. I had to increase it to 200msec because i use microphone and the rooms echo influences operation. Programming the PIC - Adjustments
When programming the PIC16F84A you need to fill the first three EEPROM locations with the setting values. I used these one: 01 14 E0
I programmed the PIC with Ic-Prog using a simple JDM programmer. Download Source Code
After you succesfully built the whole hardware you need to adjust the trimmers very precisely.
If you dont experiment a few times with adjusting them then its possible that the PIC will not recognise every beat because of the small amplifycation level. Or,it will do several things at only one beat.So you have to find the best adjustment. The original circuit which converts bass beat into pulses is from Dan Frasers Audio trigger circuit for light chasers.
(updated by Tomi Engdahl). I only replaced the line-out control with microphone and removed the 555 circuitry
because of the software solution. The very-own in this project is the software for the PIC microcontroller.
This circuit is not visually appealing nor easy to implement, requiring considerable effort. The stepper motor consists of two coils, necessitating the use of two LMD18245 chips to manage the current flow through these coils. It is noteworthy that motor...
To achieve a low-cost, accurate, and simple position control system, a stepper motor can be utilized. A circuit designed to drive the motor should be mounted in proximity to the motor itself.
Stepper motors are widely employed in applications requiring precise...
The new design of a tutorial board based on the popular PIC16F84A microcontroller features eight single LEDs, an LCD display, and five push buttons.
The tutorial board designed around the PIC16F84A microcontroller serves as a versatile platform for educational purposes and...
The circuit illustrated in the schematic diagram below allows for the visualization of the direction and shaft rotation of a stepper motor on an LED display. Instead of utilizing a digital rotation encoder as an input, this circuit employs a...
This program initializes all sixteen I/O lines of the U4x1 to function as outputs. The lower four port pins of port A (A0 - A3) correspond to "channel 1" for stepper motor activity, while the upper four port pins of...
Wireless stepper motor speed control project using a laser and IC555. This project provides insights into the fundamentals and circuit construction for controlling the speed of a wireless stepper motor utilizing a laser and the IC 555 timer.
The project centers...
This integrated circuit is highly efficient and does not require any external glue logic for operation. It features two pins to control a motor: one for direction and the other for stepping pulse triggers. The design is compact and compatible...
The circuit operates using a dedicated stepping motor controller, the L297. Pin 17 (CW/CCW) is utilized to control the rotation direction of the stepper motor. Pin 18 (CLOCK) regulates the speed of the stepper motor, while pin 19 (HALF/FULL) allows...
The circuit operates by using a clock signal to drive four D-flip-flops in the control section, which store the on/off state of each current direction for the two stepper motor coils. The flip-flops create a finite state machine (FSM) that...
We use cookies to enhance your experience, analyze traffic, and (if you allow) serve personalized ads.
By clicking Accept All, you agree to our use of cookies.
Learn more