Summary of PIC16F84A discolight effect with bass beat control
This article describes a PIC16F84A-based project that converts music bass beats into motor pulses to create a disco light effect. The system detects beats via a microphone or line-out, triggering full-stepping motor rotations with random durations and direction changes. If no beat occurs for 15 seconds, the motor switches to slower half-stepping. Users can adjust rotation speed and length via pushbuttons, with settings stored in EEPROM to persist after power loss. A 200ms debounce delay prevents multi-triggering from echoes.
Parts used in the PIC16F84A Disco Light Effect:
- PIC16F84A microcontroller
- Motor (with full and half stepping capability)
- Bass beat sensor (microphone or amplifier output/line out)
- Pushbuttons for adjustments
- EEPROM for saving settings
- Random number generator (software logic)
- Timer counter for beat detection
Introduction
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.

(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.
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
For more detail: PIC16F84A discolight effect with bass beat control
- How does the motor react when a bass beat is recognized?
The motor rotates one direction in full stepping for a predefined time determined by a random number between 1 and 4. - What happens if no beat comes in for 15 seconds?
A counter enables the motor to rotate slowly in half stepping mode. - Can the user bypass some beats during operation?
Yes, it is possible to bypass some beats using pushbuttons. - How are the rotation speed and length adjusted?
These values can be adjusted using pushbuttons, with limits set to prevent register overflow or underflow. - Why was the beat reaction delay increased to 200msec?
The author increased the delay to 200msec because they used a microphone where room echo influences operation. - Does the project lose settings after shutdown?
No, the settings are saved in EEPROM so they do not get lost after shutdown. - What is the purpose of the counter written into the code?
The counter disables reaction to a beat for 200msecs after the first interrupt to prevent multi-triggering. - Which microcontroller is used for this project?
The project uses the PIC16F84A microcontroller.