Skip to content

MZandtheRaspberryPi/mood_lamp_guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mood_lamp_guide

A guide on how to setup a pimoroni mood lamp, including links to various tutorials.

There are four steps to this. Setup the pi, put in the headers to the pi and the pHAT, and then put together the mood lamp, and then configure the mood lamp to run regularly.

Equipment Needed

You'll need a mood lamp kit from pimoroni here.
You can use solderless headers so you don't have to solder them and you can instead hammer them in. For example these products here.
You may also want a power adaptor that will plug into the wall. I like the official power supply in white color as it matches the lamp (ensure its a micro usb port for the pi zero). You can see an example here.

Setting up the Pi

You can follow the guide here pi_setup_guide and do the first two sections including "Preparing the Micro SD Card" and "First SSH connection, changing default user".

Putting in the headers to the Pi and pHAT

I'll assume you have solderless headers. To use them, follow the guide and put in the male headers to the pi, and the female headers to the pHAT. guide here.

Putting the Lamp Together

You can follow the guide here.

Get familiar with the pHAT code

I'd recommend going through this tutorial here and running a python console and running the given commands line by line to see how the lamp works and how you can control it with code. From here you should be ready to write your own code! Imagine a light show, a lamp that turns itself on and off at regular times, or some other creative use.

Scheduling a script to run on startup

You'll need to setup a cron job to run a script of your choosing on startup. You can see the example script I included called auto_lamp.py in this repository, or you could use one of the pimoroni examples in unicornhat/examples folder in your home directory. I particularly like the rainbow.py example!

To use this, navigate to your crontab for the super user:
sudo crontab -e

And add a line at the bottom replacing your user in the home directory.
@reboot sudo python3 /home/[your_user]/unicornhat/examples/rainbow.py

Then when you reboot the pi, it should run this script at startup and you should see your line come in.
sudo reboot

About

A guide on how to setup a pimoroni mood lamp, including links to various pieces

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages