Projects   /   Motors & Robotics   /   PIC16F84A

PIC16F84A discolight effect with bass beat control

Introduction External circuit converts bass beat of music into pulses.The motor is controlled by them.

Published

At a glance

CategoryMotors & Robotics
PIC modelPIC16F84A
IncludesCircuit diagram
Reading time~3 min

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.

PIC16F84A discolight effect with bass beat controlWhen 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.PIC16F84A discolight effect with bass beat control SchematicTo 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

 

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.
Beginner Tutorials · PIC16F84A

PIC Stepper Motor Controller using PIC16F84A with Proteus Simulation

Introduction Stepper motors are widely used in embedded systems and DIY electronics projects where precise position control is required. This PIC Stepper...

Programmers & ICSP · PIC16F84A

PIC Musical Doorbell using PIC16F84A with Proteus Simulation

IntroductionThis microcontroller project demonstrates a musical doorbell built around a PIC16F84A and a simple piezo sounder.Using two push buttons, the system allows...

Beginner Tutorials · PIC16C84

Exploring the World of PIC Microcontrollers: An Architectural Overview

A Peripheral Interface Microcontroller (PIC), developed by General Instruments Microcontrollers in 1993, operates under software control and is programmed to execute various...

Motors & Robotics

Real-Time CAN-Based Vehicle Monitoring System with PIC MCU

INTRODUCTION The Controller Area Network (CAN) is a robust vehicle communication bus standard that was primarily developed for automobile applications but has...

Motors & Robotics

Easy Way to Learn Robotics Using Microcontrollers: A Beginner’s Guide

The title, "Easy Way to Learn Robotics Using Microcontrollers," promises an accessible entry point for those curious about the exciting world of...

Motors & Robotics · PIC16F877A

Efficient Sun-Following Robot: A Solar Tracker with Microcontroller Control

Abstract The impending global challenge of dwindling non-renewable fuel resources underscores the urgency of transitioning towards renewable energy alternatives like solar power....

Ibrar Ayyub

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough...