I’ll have more on this in the next couple of days. But here’s a preview just to whet your appetite.
Best posts made by bhepler
Motion Detection with RaspiCam, Non-Module version
First, I want thank @alexyak for his
In the end, I ended up seeking another solution. The Facial Recognition module didn’t work due to the reduction in light coming through the mirror itself. But I do get an image. I started browsing sites of people who have turned their Raspi into a security system. It turns out, someone ported the Motion framework to Raspberry Pi and called it MMAL-Motion.
After a lot of reading, I found a Wiki for MMAL Motion. Following the steps for Jessie, I did the following:
- Change to your home directory.
- Install the library dependencies (just copy & paste into the terminal. I wouldn’t want to do this by hand)
sudo apt-get install -y libjpeg-dev libavformat56 libavformat-dev libavcodec56 libavcodec-dev libavutil54 libavutil-dev libc6-dev zlib1g-dev libmysqlclient18 libmysqlclient-dev libpq5 libpq-dev
- Download the precompiled binary archive file:
- Uncompress the archive file
tar -zxvf motion-mmal-lowflyerUK-20151114.tar.gz
This will put a configuration file called
motion-mmalcam-both.confand a folder called
motionin your home folder. At this step you can test it if you like, but for my purposes I needed to make a few changes tot the config file. So, make a copy and edit the copy.
cp motion-mmalcam-both.conf motion.conf
I played around with the configuration quite a bit until I found one I liked. But for our purposes (turning the display on when someone comes near) you only have to make a few changes.
framerate 4- run the detection video at 4 frames per second
threshold 2500- increase the # of pixels to trigger the screen. We want them to get close to the mirror
minimum_motion_frames 2- Motion must be detected in 2 consecutive frames (at 4 FPS)
event_gap 60- This is important. This is how long in seconds after no motion the screen will turn off.
output_pictures off- Do not save images
ffmpeg_output_movies off- Do not record video
stream_port 0- Turn off remote viewing
webcontrol_port 0- Turn off HTTP control of camera
on_event_start vcgencmd display_power 1- Important! This is the command to turn on the screen
on_event_end vcgencmd display_power 0- Important! This is the command to turn off the screen
motion.conffile and now you can test it out by entering
./motion -c motion.conf. If you stay very still for a minute, the screen should turn off. Move close to the mirror, and everything should come back after a couple seconds.
- Change to your home directory.
RE: remoteFile in compliments module
Sorry for not helping earlier, folks. I was at a wedding and delivering my mirror as a gift. I’ll investigate and see if I can’t improve the mirror code.
You should not ever have to modify the
compliments.jsfile. You should be able to pull it off with just modifications to the
RE: Office Installation
So this was an interesting project. I showed my first mirror to my boss and he was so impressed with it, he voluntold me to make one for the office. He gave me a budget and told me to complete it at my own pace. Other than “make it impressive” and “modern”, I was given more or less a free hand.
I considered mounting a 65" TV and doing it that way, but I had a piece of one-way glass fall into my lap. I figured it would be faster to use it than order a chunk of glass large enough to make that ginormous mirror. The trouble is… the glass is 88" x 15". It’s repurposed from a faux-fireplace thing that my neighbor is installing in his bathroom (don’t ask). So in the end, I decided that two monitors behind one glass would work. This way, there’s always a portion that is just reflection so people can primp.
So I started out by working out the mounting problem. With two monitors and a really long piece of mirror, I decided that I could keep the bezel on the monitors and use commercial wall mounts that attach to the VESA holes in the back of the monitor. The mirror hangs off of the monitors, instead of the frame supporting both the monitor and mirror.
First step: Route a rabbit into the frame so that the glass will sit flush with the face of the frame.
A quick coat of stain in case someone sees it from the side:
Paint the inside edges black to cut down on the visibility of the lighter edge through the glass:
A layer of window weather stripping goes in the rabbit to provide cushioning to for the glass, and also to push the glass up against the moulding.
Screw the moulding down over the glass and into the frame. The moulding is a fairly simple round over type, usually used for chair rails. I wrapped it in a vinyl wrap with a carbon fiber pattern.
I haven’t ever mounted anything in an office before. They don’t use wooden studs, so I was unsure how to mount this thing into the walls. On the building construction supervisor’s advice, I build a mounting plate out of pine. A quick pass with the router put a good edge on it, and a stain plus sealant gave it some color.
Time to install everything in the office! Here’s what it looks like beforehand:
The mount is up along with the monitor mounts attached to the mounting board.
Monitors, power strip, RasPi and Fitlet in place:
And finally, we hang the mirror over the top of the two monitors.
RE: Office Installation
To answer @dsegel’s question: There are two monitors and two instances of the Magic Mirror software running. Originally, I was going to run two copies on the Fitlet, which is an i3, 8GB micro PC. But I couldn’t reliably get one instance to run on an assigned monitor. Ubuntu doesn’t have the graphics drivers for this sort of thing. I could extend the desktop to encompass both monitors, but I would end up with one interface stretched over two monitors. I tried putting the electron interface on one monitor and run a browser in kiosk mode on the other, but I couldn’t programatically guarantee that they wouldn’t both end up on the same monitor. In the end, I opted to go with two devices.
The RasPi is going to run a fairly standard mirror installation. Weather, newsfeed, traffic, calendar (I’ll set one up for the office to track visits from customers). The Fitlet is going to run my MMM-GlobeJS module and tie into our software product. We offer a VPN service with locations around the world, so my plan is to plot where our VPN exit points are on the globe as it spins. Once I get it complete to where I like it, I’ll publish the module. The RasPi uses the onboard WiFi to tie into the office network, securely log into the VPN and then shares the connection to the fitlet via ethernet. It’s not quite ready yet, but we’ll be able to log into either the Pi or the Fitlet via SSH, so I can turn our front end team loose on it.
It’s coming along. Much work left to go, but it’s coming along.
RE: Create another PM2 Script?
@Damian Sure, I can do that. Let me re-write this a bit.
Step 1 - Create a script called
sonos.shin the home directory (
cd ~ nano sonos.sh
Enter the following in the nano editor for the contents of your
cd ~/node-sonos-http-api DISPLAY=:0 npm start
Save the file and exit the nano editor.
Step 2 - Make your script executable by entering
chmod +x sonos.sh
Step 3 - Tell pm2 to manage your sonos script so that it is always running in the background:
pm2 start sonos.sh pm2 save
Verify that pm2 is managing both your
sonos.shscript and the
mm.shscript by typing
pm2 status all. You should see two lines, one for each script.
Step 4 - Clear the logs and bounce your mirror and verify that everything works as planned.
pm2 flush pm2 restart all
RE: MMM-Bob-Ross: For putting a happy little painting up on your mirror
This is a happy little module.