Skip to content

rasp-navidad is a project made to animate your crib or your Santa Claus village with light effects to the rhythm of music, instead of the usual boring fixed lights. The code is ready to use, just download, install and configure it :)

License

Notifications You must be signed in to change notification settings

pigi-spm/rasp-navidad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rasp-navidad

What is rasp-navidad?

Rasp-navidad is a project made to animate your crib or your Santa Claus village with light effects to the rhythm of music, instead of the usual boring fixed lights.
The code is ready to use, just download, install and configure it :)

what you need?

Raspberry
relay 4-channel raspberry pi (min. 3-channel)
3-way audio filter pi (I used only one way to get the white color) (Optional)
rgb led strip lights 12v (led strip with 12V and 4 pins)
3.5 mm Male to Male Stereo Audio Cable
radio with aux input and one output for the speackers
IRLZ34 N-Channel MOSFET
Breadboard for the Raspberry Pi
raspberry pi gpio male to female jumper
raspberry pi gpio male to male jumper
Power Supply Adapter Power Adapter AC 100-240V to DC 12V with Plug Power Converter Power Supply LED Driver

How to connect everything

We have designed the scheme that needs to be replicated, to make it work properly:

Scheme with audio filter. With it you can control each led from the led strips, so you get a more colorful effect.

rasp-navidad_with_audio_filter

With this scheme all the colors of the LED are combined. The color you get is only white.

rasp-navidad_without_audio_filter

Which operating system should I use?

I used the Raspberry Pi OS Lite with version 10.6, but the script should work with all Linux operating systems (It has not been tested with the various operating systems).

Installation

You must download the project in your raspberry. One possible way is to use the git to clone it in the raspberry.

Git installation: You must have installed the git on your raspberry to clone the repository. If you have not installed it, please run the follow command:

apt-get update & apt-get install git

After the installation, you can clone the repository in your raspberry. To make it, please show this doc:

After the cloning the project, you can install the rasp-navidad. In the folder you find the file install.sh, with it you can install the script simply by starting the installation process.
Please run the follow command:

sudo ./install.sh

If you can not start the file, please check if you have the permissions to execute the file.

After installation you can verify that the script has been installed by checking in location:

/usr/script/rasp-navidad

In this position you need to modify the config.py file to set the GPIO pins that will be used. What you must change in the file:

pid = dict(
    blue=<pin number>,
    red=<pin number>,
    green=<pin number>,
)

It corresponds to the connection between the raspberry and the relay for direct control of the led strips. rasp-navidad_without_audio_filter

relay = dict(
    blue=<pin number>,
    red=<pin number>,
    green=<pin number>,
)

It corresponds to the connection between the rasbperry and the relay for relay control. rasp-navidad_without_audio_filter

The package already contains some test songs inside

How you can load the music in the script

In the main folder (default /usr/script/rasp-navidad/) there is the 'audio' folder. In this location you can insert the mp3 files, that you wish use.

The audio files can be set differently: rasp-navidad_without_audio_filter

  • yellow: This files are used with the random function. if you set a number at the beginning of the file name, it will be embedded in the list of random music files. The format is [number]_name_of_the_file.mp3
  • blue: You want to select the file you want to use each time you start the script. Simply enter the number of the file name
  • red: You can exclude the file from the list of random music files, and it can be used directly by entering the file name
  • white: You can exclude the file from the list of random music files, and it can be used directly by entering the file name. If you use the function lightsEffectWithGPIO, you have to insert the color of the pins you want to use, inserting them in an array.
  • orange: You can exclude the file from the list of random music files, and it can be used directly by entering the file name. If you use the function lightsEffectWithoutGPIO, you do not have to enter any color pins.

You can insert as many songs as you want, but you must remember to edit the code in the main.py file

What to change in the code in the main.py file

The following items need to be modified:

  • Change the effectSelector function in the main.py file by entering for each if:
    • onRelay([relayBlue, relayRed, relayGreen]):
      • Insert in the array the relays you want to activate
      • onRelay is always in combination with lightsEffectWithGPIO
    • lightsEffectWithGPIO("[filename]"/str(self.utils.setRandomRange())/str([int]), [ledRed, ledBlue, ledGreen])
      • You can insert in the array the leds you want to activate/use to make the sunrise and sunset effect.
    • offRelay([relayBlue, relayRed, relayGreen])
      • Insert in the array the relays you want to deactivate
      • offRelay is always in combination with lightsEffectWithoutGPIO
    • lightsEffectWithoutGPIO("[filename]"/str(self.utils.setRandomRange())/str([int]))
      • Do not insert the LEDs, because they will be activated to the rhythm of the music.

The script is ready to be used.

Automatic start with cronjob

Two cronjobs were installed in the crontab to activate and use the script, as well as to automatically remove the log files after 7 days. It can be modified at any time by opening the crontab with:

crontab -e

Log files

A log file is created. You can find it in:
/var/log/rasp-navidad-logs/rasp-navidad_yyyymmdd.log

LICENSE

Creative Commons Attribution 3.0 International License (CC BY 3.0)

https://creativecommons.org/licenses/by/3.0/

Enjoy your life and stay healthy

We wish you a Merry Christmas and a Happy New Year.

About

rasp-navidad is a project made to animate your crib or your Santa Claus village with light effects to the rhythm of music, instead of the usual boring fixed lights. The code is ready to use, just download, install and configure it :)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published