ECE434 Project - Comrade Candles: Linked Lighting
Embedded Linux Class by Mark A. Yoder
I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!
09 Executive Summary 09 Packaging 09 Installation Instructions 09 User Instructions 09 Highlights 09 Theory of Operation 09 Work Breakdown 09 Future Work/Conclusions 09 Hackster.io 09 Demo/Poster 00 Not Late Score: 90/100
Comrade Candles are a set of customizable led strips that synchronize colors and flashing speeds over the internet, It also has a sound implementation that allows preloaded songs to be played as well. This allows users to have a creative way to communicate and express themselves with a friend so long as both have an internet connection.
Using flask and pagekite, we are able to use a Beagle Bone to run python files on another Beagle Bone. Using this concept, we have implemented a way for the lights to change on one Beagle and Match the other, as well as play matching audio files (so long as both Bones have the audio file downloaded).
The IR remote input was not ale to be implemented for the project. With the remote and transceiver we chose to use and a lack of libraries to use for decoding signals. We could not find any consistent patterns that distinguished each signal from the remote, making it impossible for us to implement.
Using the method that implemented the comrade candle project, we are able to create a way to synchronize operations on two bones so long as they have the same scripts on them. While this was used for our comrade candle project, there is a vast range of projects such concepts to apply to. The files should also be able to be modifiable to incorporate more than 2 bones as well. The only negative side is pagekite has only a month long trial so a free solution that could last permanently would be preferred and ideal for a user.
There is no specific packaging for this project. The structure of it allows you to customize it how you want. Hang up the LED strips in your room for mood lighting, use it to make a lamp, or whatever you can think of. Feel free to get creative.
Github Repository: https://github.com/rutantj/comrade-candles-ECE434. The final code for this project is in musicAndLED folder but you can use the other folders to implement only certain parts of the project. It should be noted that while the ir-and-uart files have the ability to take input from an IR sensor, it can not reliably distinguish between different inputs and should not be used in its current state.
Before we can run the code we must first setup Pagekite accounts to allow our bones to be access through the internet. Head over to https://pagekite.net/, make an account for each device. Then run the following code to setup Pagekite on your device:
bone1$ curl -O https://pagekite.net/pk/pagekite.py bone1$ python pagekite.py 80 username.pagekite.me
This will take you through the pagekite setup process if you have not done it before. Use your first account Repeat on your second device with your second account.
Note: your pagekite page is what will be used in the code so you will need to edit the pagekite links in serverLED.py and serverLED2.py to the two pagekite pages that you created.
After navigate to the musicAndLED folder, set up the PRU (our code uses PRU0 but you could configure it to work with PRU 1) source the setup.sh file. Then log in as root and run make (sudo will not work with the make file)
bone1$ source setup.sh bone1$ sudo bash bone1@root# make
TODO: talk about make file problem
Finally, we will connect to our Pagekite page
bone1$ python pagekite username1.pagekite.me
The last step is to repeat this process with the 2nd bone and your bones you're ready to start sending LED messages to each other.
bone2$ source setup.sh bone2$ make bone2$ python pagekite username2.pagekite.me TODO: double check this
Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.
Now that the program is everything is setup. Run the program on both bones using the serverLED.py and ./serverLED2.py
bone1$ ./serverLED.py bone2$ ./serverLED2.py
To initialize the bones in a state where they can begin sending signals they must first receive a signal. The easiest way to this is to open a new terminal window or tab and run:
bone1or2$ wget --spider --server-response username1.pagekite.me/22/22/22/0/2/tt ' bone1or2$ wget --spider --server-response username2.pagekite.me/22/22/22/0/2/tt ' Open up your bone's flask url with the extension of the r,g,b,flash delay values and whether or not you want the bone to play music (true or false). For example: https://123.456.789:8081/r/g/b/flashDelay/true.
From here the bones will take care of communication between themselves. All you have to do now is simply select the color, flash rate, and the song you want to play with the respective pushbuttons. The other bone will match. This communication works both ways.
Watch our video demonstration here Demonstration here.
Theory of Operation
Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.
Please reference the diagram at the bottom right as I explain how the project functions. The Diagram depicts how one of the devices in the pairing operates. We start with beaglebone1. Bone1 creates a server on a specific port. Pagekite listens in on the port forwards all communication to the public internet. The server we have coded detects when someone connects to a specific url then pulls the commands from the url. The server will then run a script on the local that handles the PRU LED code and gpio buttons. When a button is pressed on Bone1
Sam worked primarily on getting the LEDs to run properly with the PRU by using examples from the PRU Cookbook and also helped out Tom with the online interactivity.
T.J. worked on the the music playing feature and the IR remote feature that did not end up in the final model of the project. You can read more about that below.
We originally had plans to have the music and LEDs update from an IR remote that would send commands to an IR receiver on the Bone. We managed to get the UART communication on the BeagleBone to work via Adafruit's UART module in Python and had the IR pulses written to the terminal by using pySerial. Our issue was with processing the signals, as the input from a single button would often deviate between button presses and the signals from different buttons would often be too similar to distinguish. We were hoping we could calculate the Hamming Distance of a received signal and match it with the closest of the expected values for the implemented commands, but there wasn't a large enough difference between the signal values to use this process effectively.
Given more time, we would have liked to add this as one of the ways to interact with the Bone and provide a better user experience. The code examples and documentation from this feature's development have been left in the GitHub repository.
From this project, we learned a lot about how the interface with the Internet by using multiple Bones and communicate with each other indirectly by using Flask and Pagekite. We also learned more about how the UART protocol works and how to find new useful Python modules that run on the BeagleBone Black. We now have a better understanding of how research and development for embedded systems works and how to adapt to issues with preliminary design ideas and complicated software.
Embedded Linux Class by Mark A. Yoder