Introduction: Spotlight

About: http://student.howest.be/yoran.pauwels/portfolio/ student NMCT at Howest (Belgium,Kortrijk)

The Spotlight project attempts to integrate an LED with a 180° servo and 360° servo. It is adjustable via an Android App and all data gets saved and is reachable in an Azure SQL Server Database by using an Azure Functions API. It's possible to give the led one color setting or make it loop through a self-made set of colors and delays. The idea behind the project is to create a spotlight that you can move and give the right color and brightness to fit your current needs. This document describes the workings of the code behind the Spotlight project.

Step 1: Setup the Pi

To setup the pi we first need to upload nesecerry files, use for example fillezilla to upload all the files fro mthe pi folder.

To make these files start on bootup we need to add them to the rc.local file, only the mqqt file need to bootup.

python /home/pi/mqqt.py &

We could't use an Apipa addres on the pi so the easiest way to set it up is to plug in the pi into a router and lookup the ip addres in the client table.

Once you've found the ip address you can use it to connect to the pi using for example putty. Now you have to edit the wpa_supplicant.conf file bys using the code below.

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

In the file you need to fill in the network name and the password

network={   
    ssid="testing"
    psk="testingPassword"
}

Now you can just reboot the pi.

When you now plugin the spot it will display red untill it has connect connected to the internet. When it has connected it will display green followed by just white light.

Step 2: Setting Up the App

Now that the spot is working we need to setup the app.

Intsall the app on your phone. When you open it you will see the login page. Because it is the first time you open the app, you will need to register. Tap the "register here" text to go to the register page.

Now that your on the register page you need to fill in a username, password (at least 9 characters) , email-address, first-name and last-name. When you're done just press the register button to register.

Once you're registered you will see the dashboard page for now this page is empty because you haven't added any spots yet.

Step 3: Adding a Spot

Before we add a spot we need to add a location.

Open the menu and go to the locations page. On the location page tap the plus sign. Just fill in the name of the location and select a color wich "represent" that location. When you're done press save.

Now that you've added a location you can add a spot.

Once again open the menu and go to "add a spot". Here you can fill in a spot name, select a location where the spot should be added and the id of spot. The spot id can be found on the spot itself

Now you can see that a spot has appeared on the dashboard page. there are 3 options you can do with the spot

  1. Delete it
  2. Edit it
  3. Just turning it off and on by pressing the toggle button

Step 4: Editing a Spot

Now that we have a spot we can start editing it.

Press the pencil next to the spot. Now you're at the edit spot page. Here you can:

  1. change the name of you're spot
  2. select a preset (more on this later)
  3. change the location
  4. select a colorshifting mode (more on this later)
  5. select the color of the spot using the colorpicker and sliders, the large bar displays the selected color
  6. select the brightness of the spot
  7. set the horizontal rotation by selecting a direction and a number of degrees
  8. set the angle of the spot

Once you've decided you're settings you can activate it by pressing save. Now the spot should change.

This is the basics of the app, I will now further explain some extra options.

Step 5: Color Shifting

At the color shifting page you can make make the spot change colors with a certain of delay between the colors.

To add a color press the plus button. Now select the color, the brightness and how many seconds it should stay that color.

If you want to edit a color or delay, just press the colorbar.

When you're done selecting your colors you can press save.

To start the color shifting toggle the button to the on state an press save on the edit spot page.

Step 6: Presets

With a preset you can save certain spot settings so it is easier to change your spots .

Just give your spot a name, select the color of the spot and brightness and the angle of the spot

If you want to use a preset just select it in the edit spot page and the values will change

Step 7: Account Settings

If you want to change you're account settings you can press your username or image to change:

  1. your password
  2. email
  3. image
  4. or to log out all your accounts on all different devices.