Disco light effect with PIC16F84A

29,117

Circuit Image

This is an early picture of my discolight effect. Because of the AGC circuit, there's no need for potentiometers for sensitivity adjustment. I replaced them with trimmers. Now the microphone is on the control electronics because there's no need to place it outside the box, and the possible noises from the surroundings are reduced. You have to choose the distance between Lens-Lamp-Parabola to get sharp beams. It's all about optics. That little wall (hindrance) before the Lamp doesn't let the white light pass through the Lens. External circuit converts the bass beat of music into pulses. The motor is controlled by them. If there's a bass beat recognized, then the motor rotates in 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 the motor has to rotate in one direction. After that, the PIC changes the 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 a beat doesn't come in for 15 seconds, 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 is possible to bypass some beats. This 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 shutdown, the settings do not get lost.

A beat consists of a series of vibrations, so the PIC gets a few interrupts. To prevent multi-triggering, there is a counter written into the code which disables reaction to the beat for 200ms after the first interrupt. A 180ms delay is enough if using the amplifier's output (or line out) as the music source. The delay had to be increased to 200ms because a microphone is used, and the room's echo influences operation. The box was obtained from a friend who had a larger homemade parabola. Thus, the box could be smaller, but resizing was not desired. It is satisfactory.

The described discolight effect circuit utilizes an Automatic Gain Control (AGC) circuit to stabilize the input from the microphone, allowing for a more consistent response to audio signals without the need for manual sensitivity adjustments via potentiometers. The integration of trimmers allows for fine-tuning while maintaining a compact design. The optical setup includes a lens and parabola arrangement that requires careful positioning to achieve the desired beam sharpness, emphasizing the importance of optical design in the performance of the light effect.

The control system is driven by a microcontroller (PIC), which interprets audio signals converted into pulses by an external circuit. The motor's operation is contingent upon detecting bass beats, which trigger the motor to rotate in full stepping mode for a predetermined duration. The incorporation of a random number generator adds variability to the motor's operation, enhancing the visual effects produced by the discolight.

The program logic implemented within the PIC includes a timing mechanism that allows for quick responses to audio signals while preventing false triggering through a brief delay after the initial beat detection. The ability to switch between full stepping and half stepping modes provides flexibility in motor control, balancing torque and smoothness of operation.

Additionally, user interface elements such as pushbuttons enable manual override and adjustment of the rotation speed and duration, enhancing the system's versatility. The EEPROM storage of settings ensures that user preferences are retained even after power loss, contributing to a user-friendly experience.

Overall, this discolight effect circuit exemplifies a sophisticated integration of audio processing, motor control, and optical design, resulting in an engaging light display synchronized with music.This is an early picture of my discolight effect. Because of the AGC circuit theres no need for potentionmeters for sensitivity adjust. I replaced them with trimmers. Now the microphone is on the control electronics because theres no need to place it outside the box and the possible noises from the surroundings are reduced. You have to choose the distance between Lens-Lamp-Parabola to get sharp beams. Its all about optics.That little ?wall?(hindrance) before the Lamp doesnt let the white light to pass through the Lens. 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. I have that box from a friend who had there a bigger home-made parabola. So the box with mine could be smaller but i didnt want to resize it.Its OK. 🔗 External reference