The perfect Raspberry Pi enclosure

The perfect Raspberry Pi enclosure

There are many and I mean many Raspberry Pi cases out there. Fucking tons. There are a few great ones and a lot of mediocre ones. I came across a pretty good one. It is a great case and not just because it looks cool. It’s actually function-able. The case is designed to fit a VESA monitor mount. So if you have a TV or monitor on a stand you could bolt this to the rear and bam!. The holes are also great for general purpose mounting. The case is designed slightly different than all the others out there. There is NO CUTOUT for the micro USB power plug. We don’t use it here. This case has room for a DC-DC buck converter. Available on Amazon, eBay and all over. Standard part.

We take a nice big fat power source like 12v DC 3A and knock it down to 5.1v DC for the Pi. Then we wire that output directly to the Pies GPIO pins for 5v and GND. This works great, a nice fat stable power source. And the bricks are far easier to get a hold of then a 3A 5v USB plug. I have tons of them lying around.

DC-DC Buck Converter

 

We take the barrel plug and solder in a diode to the source side of the DC-DC buck converter. We take the output and apply that to the power GPIO pins for 5v and GND. Then we take a LED and wire in a 330ohm resistor and connect that to GND and GPIO 14 (UART TXD). Heres the trick to get the GPIO pin to follow the Pies power up and power down cycle. So the LED will turn off when the Pi is safe to unplug.

Edit your /boot/config.txt file and add the following line:

enable_uart=1

Thats it, now the LED will light when powered on and it will shutoff when it is safe to unplug the Pi. If you wish to use a different pin other than 14 you can follow this guide over here.

The case

Heres the thingy for my modified version of the case. The original calls for brass inserts for the screws, which is awesome I just don’t use them. So I remixed the files to use standard M3 screws. No more brass inserts. I also increased the depth of the lid. My jumper wires were hitting the top of the  lid and preventing me from closing it. No I have plenty of room fire wires and jumpers.

My Remixed Case

https://www.thingiverse.com/thing:2956874

Original Version

https://www.thingiverse.com/thing:2286741

 

Monitor your security system with a RPi

I had programmed a page of goodness in Node-Red for being the middle-man between the internet and my security system. Here’s the schpeal…

I used to work for an alarm company for a number of years. It’s a job that has kind of stuck with me, specially all the shit and skills that I learned while doing it. So I still have friends in the industry and I still have equipment from when I worked there. Naturally I install my own security system. Not wanting to pay for monitoring but still wanting to be notified with issues gave me a problem. I happen to know Pies so I decided to use a Raspberry Pi with Node-Red to solve that problem.

There are many ways to get notifications from your security system these days but they all require some kind of monitoring or to be activated by an alarm company (someone with a license). Using the Raspberry Pi I could do everything I wanted to. Node-Red just made it that much easier.

I programmed all of this via NR on one of my Raspberry Pies. I believe at the time I was programming in Node-Red v0.12 (around May 2016 I think). Here’s the flow:

https://github.com/jhaury/rpi-nodered-security

I cannot be held responsible for anything bad that may happen. This has been coded to the best of my ability but there may be bugs and some of it may be unfinished. USE AT YOUR OWN RISK!

Enter the world of Jasper

Want to play around with some voice activation? Want to talk to your Raspberry Pi? Your choices so far are Alexa and Jasper. I went with Jasper after finding out AlexaPi requires you to press a button on a website to activate the voice goodies. So you would have to click a button on a web page every time you want to talk and are done talking to Alexa. Fuck that noise! Jasper it is! First off don’t follow the Jasper Documentation install guide. Do not! (as of 05/04/2016), it doesn’t work. It was also written for older Pies.

Instead you should probably follow this guide (Wheezy only): https://github.com/bablokb/jasper-install (I have not tried this myself). I downloaded an image made for a Pi2 B+.

Pros to not downloading an image, you don’t have to wait for the download and you can tweak stuff during the build I’m sure, if you know what you are doing, this is not me. Cons, the build time takes 4-8hrs. Pros to downloading an image, all that build time is gone. Cons, you have to (find!) download the 2gb-7gb torrent.

So this is what I did. Download the image for the Raspberry Pi 2 B+ and bake it to a SD Card (I use the ApplePi Baker, so easy). Do the standard raspi-config crap after your first boot. Now go and follow everything in the configuration section. All of it. Now you should be good to go. Use thePi Baker to “freeze” (copy the image) of the SD so when you fuck it up later you don’t have to start from scratch when you jack shit up later.

(Finding and) Downloading Jasper for the RPi2…
This guy did all the work and released it to the world for free but he requires you to download and install some shitty ass 3rd party torrent software to get it. What a total asshat, on top of that he protects everything with fucking keys. Total douche cannon move.

Mega download: https://mega.nz/#!T5VHXb4A!ZFaDDAUASswYb6Fi_-opDScBWOpNqmJMWS9KgPgn2nU
Guy that made the IMG: http://www.dansinclair.co.uk/raspberry-pi-2-jasper/

Debian DEB: https://groups.google.com/forum/#!topic/jasper-support-forum/RVATTGel-OQ

You can also find a few IMGs for the RPi2/B+ in the Google Groups, most of them require that stupid 3rd party software and keys to unlock them (fucking asshat!!): https://groups.google.com/forum/#!forum/jasper-support-forum

Some side notes that may help keep your sanity longer:

To start Jasper at Boot
sudo crontab -e
Add the following:
@reboot /home/pi/jasper/jasper.py;

To remove Jasper start at boot
sudo crontab -e
place # in front of the job or remove it
save (ctrl+o) and quit (ctrl+x)
https://groups.google.com/forum/#!searchin/jasper-support-forum/boot/jasper-support-forum/5C6wtDfBlRE/AoRN5j8cJFUJ
http://jasperproject.github.io/documentation/usage/

OR (untested, copy/pasted from Google-Groups)

You can just add the scrip to ‘/etc/rc.local’, something like:
su -c '/usr/bin/python /home/pi/jasper/jasper.py' pi

I removed News.py and HN.py, these news scripts were useless to me and for some reason News.py would override every other script. So Jasper would constantly tell me the news no mater what I asked him, and that is not a short script so you get tired of waiting for it to finish and telling him no all the time.

I tried to change the default voice (its hard to understand sometimes) but Google-TTS is a no go for me, it requires a Google Developer Account and that costs $25. I’ll pass. So stuck with espeak. Have not tried the others yet.

If you are running into “I’m sorry but I can’t see that far into the future” with Weather.py then you’re probably using your zipcode in the config, like the instructions said, well that wont work surprise. You need to use the special chart to get the closest big city in your area and use that number then Jasper will tell you the weather. I also started using the Weather.py from the google groups here instead, its better and worked for me out of the box.
(I can’t remember where that special chart was, soon as I do I will update the post)
https://groups.google.com/d/msg/jasper-support-forum/kQ7KzDqJIDs/THW-DZxSBQAJ

Super handy tip #1:
The volume level will most likely not be set at a decent usable level. From a terminal run “alsamixer” on your Raspberry Pi for microphone and speaker level controls. Raising the microphone level will help Jasper to hear your voice from a greater distance, and up the output volume while you’re at it.

Super handy tip #2:
After a day or so of playing with Jasper he started crashed constantly for what seemed like no reason. The only error I would get is

Which after some digging I found is related to the Google email notification script. If you comment out your email address in profile.yml the error will go away. Google email notifications won’t work either, but at least Jasper will stop crashing.

Super handy tip #3:
This person suggests changing keywords to at least 4 syllables so Jasper has an easier time hearing you over background noise, sounds like a legit idea but I haven’t tried it yet.
https://github.com/GeoBeBee/mySystem/blob/master/Jasper_keywords.txt

Some useful information on how to write Jasper scripts:

Build your own Siri with Raspberry Pi2 and Jasper

Things left to do:
1. Spotify control
2. Integrate with the house security system/Raspberry Pi (the one in the garage)
3. Write some more scripts

Jasper modules I have found
https://github.com/studioimaginaire/phue#groups
Reports system status https://github.com/edouardpoitras/jasper-status
https://github.com/edouardpoitras/jasper-movies
https://github.com/iamjake648/jasper-dictionary
https://github.com/iamjake648/jasper-wiki
https://github.com/marclave/Jasper-Google-Calendar
https://github.com/adamjreed/jasper-hue/tree/master
https://github.com/maalbano/jumpsparc

Collections of modules I have found
https://github.com/Hadjimina/JasperModules (some good ones)
https://github.com/ketonne/jasper-modules
https://github.com/aaskasen/JasperModules – sample home automation
https://github.com/RosesDurden/Jasper_modules
https://github.com/alexsiri7/jasper-modules
https://github.com/androbwebb/jasper-yelp-module