I've seen few years ago someone who put lights in his stairway and I found it very beautiful. If it was all "esthetic" at first, I realized it could also be very useful since we often have to carry things between floors and we don't always have a hand free to open/close light.
So when I won a free Raspberry PI 2 at office's Christmas party, I decided it would be my first project with it.
Even if I know it could be all done by using only electronic skills, I wanted to start with something I'm able to do (coding) and learn basic electronic on top of it.
How did project development went?First challenge, find parts. Not knowing too much about it, I've read a lot and thanks to my Dad and my Uncle, who studied in electronics, gave me few tips to choose the right parts.
For the code, it went pretty straight forward since I knew what I wanted and I used to be a software developer (now in the dark side of project management). The hardest part was to find time to work on a project with new baby at home. First achievement? When lights were turning on properly without the PIR Sensor on.
Once I knew that code was running fine with "physical" lights, I started installing them in my stairway. Because my stairs have a carpet finish, it was a real pleasure (not!) to fix LEDs strips.
I fixed myself the objective to complete this project before the end of 2016.
So on Dec. 31st 1:02 AM, almost on the first try (I know, it's unbelievable), it all came to this:
How to use/configure code?
First thing, you need to turn on or off all the IoT (Raspberry PI) stuff. I'll suggest you to run program with this setting before doing anything to understand how it works.
_isIotConnected = false; //file: StairwayViewModel.cs
Then, define how many stairs you have in your stairway (MainPage.xaml.cs).
public MainPage()
{
ViewModel = new StairwayViewModel(PIR_TOP_PIN_NUMBER,
PIR_BOTTOM_PIN_NUMBER,
STAIRS_PIN_NUMBERS);
ViewModel.CreateStairs(13);
// ...
}
Important disclaimer:
I've run into an issue with the UI Dispatcher when running the program "in production" with my Raspberry PI. I don't understand why - very willing to have some help on that - so current version running on my RP2, I've commented all UI of the MainPage.xaml. Thanks to good architecture (MVVM), all was running perfectly without changing code.
Comments / feedback / questionsSince the community helped me a lot with my project by sharing thoughts, how-to, tips, etc., I promise myself I would share my results to give back to the community. Code is available on GitHub and I'll be happy to review any Pull Requests.
This said, I know the project is not perfect and it could be easily improved. But I'm proud to say it ran for few thousands times and it still works great.
Don't hesitate to leave comments or contact me for anything.
Enjoy!
French StoryI work in a small company of software development and they add sometimes an article on the blog about employees' project. Here's the link for the quick story in French.
Comments
Please log in or sign up to comment.