Raspberry Pi 3 Arrives

Got my new RPi3 today , I was able to get it ordered early Monday morning by poking around Element14’s website. Even though they didn’t have it posted they did an available part number, 77Y6520, so I used that to place an order and I got notified on Tuesday that it was sent 🙂 The CPU is a little beefier and its 64bit and the board now has wifi and bluetooth onboard. So I’ll probably implement some bluetooth geo-fencing with IFTTT in my home automation project.

pi1pi2pi3

Automated Signal Capture

Using Flask and JQuery, a friend helped me out with automating capturing the 433mhz signal from remotes so you don’t have to manually add them in the code.

Basically the Flask starts a webserver when you click n the add button, the code executes the RFSniffer binary and receives the data when a signal is received, then displays it to the webpage. Still have to finish the code for adding the data to the MySQL db , but thats the easy part.

Raspberry Pi touch display

So I received an official 7″ touch display for xmas. Even though it’s $60, it brings my total cost over 200$ for the project. But I thought it would be an awesome addition to the project because you don’t have to whip out your phone just to control everything. I’s a pretty sweet 800 x 480 10 point capacitive touchscreen display all you need to do is connect the DSI ribbon cable and feed ground/5v from the Pi’s GPIO pins. Im thinking starting the browser in kiosk mode should suffice once I finish the node.js interface. The only issue I havent resolved was to power down the screen fully when the Pi shutdowns. If anyone knows how to let me know.
front-centred-500x365

Pilybius

pilybiusMarquee_sharp
Working on mini MAME arcade machine. It was designed in Solid Works 2015 then cut out of 1/4″ MDF on our Epilog laser cutter. Will be powered by a Raspberry Pi and a 9″ TFT screen. The software is MAME4ALL-Pi running the MAME 0.375b5 romsets. The joystick and buttons are connected directly to the GPIO pins and the 9” monitor is connected to the Video out port.

Pilybius is based off an arcade cabinet described in an urban legend about a game called Polybius, which is said to have induced various psychological effects on players. The story describes players suffering from amnesia, night terrors, and a tendency to stop playing all video games.

Bizarre rumors about this game are that it was supposedly developed by some kind of weird military tech offshoot group, used some kind of proprietary behavior modification algorithms developed for the CIA. According to an operator who ran an arcade with one of these games, guys in black coats would come to collect “records” from the machines. They’re not interested in quarters or anything, they just collected information about how the game was played.

Around a month after its supposed release in 1981, Polybius is said to have disappeared without a trace. There is no evidence that such a game has ever existed.

cutoutcutout2cutout3cutout4cutout5painted2painted
donkeykongdonkeykong2

Raspberry Pi Nutritional Facts

This is based off a webpage i found around 2003-ish that had pseudo nutritional facts of the server specs. Only problem is I had just the html output saved. So I finally got around to doing the backend code to give realtime outputs of hdd space,memory,network stats,users,& uptime. Tested on a Rapsberry Pi running Raspian. The code is ugly nd was quickly done so there may be some inherent security issues in the code so dont put on a production server facing the web without testing. Result may vary on your system due to system calls, adjust accordingly.
https://github.com/xillwillx/Nutional_Server_Facts

nutritionalfacts

DS18B20 and php

As part of the cheap home automation project I am currently working on, I needed to get some temperature sensor info to my webserver. For the brain of my project I’ll be using a Raspberry Pi.

I had ordered a 5pk of DS18B20 temperature sensors so i can visualize monthly temperatures and eventually control my thermostat. In order to get the sensors working on the Pi, I needed to do a few things:

First I had to setup the pi to add OneWire support. I started by editing the boot config file with nano by running
sudo nano /boot/config.txt
I scrolled to the bottom and added the following line:
dtoverlay=w1-gpio
then pressed ctrl+x and y to confirm, then

sudo nano /etc/modules
add the following 2 lines to the bottom:
w1-gpio

w1-therm
I again press ctrl+x and y to confirm , then shutdown my pi.

I then hooked my sensors up to a 4.7k pullup resistor using the following diagram:
DS18B20 ds18b20-pinout

I booted my Pi back up and tested to see that my sensors were detected by typing the following command into the terminal:

cd /sys/bus/w1/devices

ls

cd 28-xxxx (change this to match what serial number pops up)

cat w1_slave
if all goes well you shouldn’t have seen any errors and it should have outputted some gibberish like this:
modprobe

The temperature is shown in the last five digits on the second line. (You need to divide this number by 1000 to get the temperature in degrees Celcius).

You finally need to have Apache2 and PHP5 installed on your Pi.

I had looked online for php code that had outputted the temperature from sensors and found that everyone had hardcoded the sensor ID’s in their code , since I wanted my automation to be as painless as possible, I wrote my own php script to automatically get all the sensor ID’s and then convert the output to Celsius and Fahrenheit. I have this on https://github.com/xillwillx/DS18B20
Add temp.php to /var/www/ then visit http://127.0.0.1/temp.php

Page output should look similar to this:

Sensor ID#: 28-0214640d18ff = 26 °C / 79 °F

Sensor ID#: 28-02146409b9ff = 25 °C / 77 °F
And that’s it! I will be added more posts as i finish each portion of my home automation project. My goal is trying to get it all done for less than $200.

Pi Bar

Using parts made from a Makerbot Replicator 2X 3D printer, some square metal rods, and a series of 5 peristaltic pumps. The project was based off a project called Bar Mixvah. The problem with the orginal is that you had to use a sluggish MongoDB database and a laptop in order to get it up and running. I wanted something that was self contained. Using an old Raspberry Pi with 256mb ram, I worked with a few guys from NESIT to redesign the top portion to fit the raspberry pi into and then created a slim MySQL backend with PHP and node.js.

20140623_22564620140625_221346

Below is the Pi hat to connect the pumps to the Pi
20140825_22035820140825_232749
20140825_23275820140825_232821
20140825_232843

RFPiD – Raspberry Pi Access Control

We’ve been working on our new door entry system for NESIT that will allow members to enter the space through our sliding door. This will replace our current Arduino RFID door access system. It utilizes a RFID card reader that checks the tag against a SQLite database then opens the door by triggering a 5v relay connected to a garage door opener. It also tweets when someone arrives @ the space to Twitter.com as well as logging the arrival into the database. Connected to the front of the device is a small 4.5 lcd screen connected by s-video port that plays videos when someone scans their card.

The door can also be controlled over GoogleTalk with multiple google accounts. An authorized user can open and close the door, add or remove users from the database, query the database accounts, check the current temperature, callerID lookups, geoIP lookups, play sounds/videos, and send messages to it’s twitter account. All this can be done right from your cell phone or laptop.

The door also has a PIR sensor that will sense when someone’s walking by and asks them to press the pushbutton on the front if they want to learn more about NESIT. When they press it, it’ll play a short promo video about us.

nesitpi

A sample of the base RFPiD python code is available here: Github

The idea:
This project came out of necessity. With the amount of members we have, it made more sense to make an automated door access system, than to give everyone keys. We originally used an Arduino for the last 2 years, but we wanted to be able to control the database of users easier, our current setup wrote the users to the eeprom of the Arduino. We were thinking about using an ethernet module to talk with a server on our network but if our network had issues that would prevent someone from entering. The small footprint of the Pi makes it a better choice than to run a server fulltime. Our modest server burns through around $200 a year worth of electricity. By comparison a Raspberry Pi consumes about $3 per year. With the Raspberry Pi we could now have ethernet capabilities, could store its own database, gpio pins , video output and more.

Starting the project I needed to figure out how to interface a RFID reader with the Pi. I wanted to interface it with the UART pins but due to time constraints I ended up using a sparkfun USB adapter with my Innovations ID-20 RFID reader. The only thing I has to do was monitor the USB in /dev and receive the RFID tag ID when someone scanned their card. To do this I used python script that monitored serial connection on /dev/ttyUSB0 the base of the script which I have posted to my github account and used a sqlite3 database to verify if the card scanned was a valid member, if so it would trigger the door. Also used a RGB LED to notify if the card was good or not.

With the RFID stuff working it was time to pick out a good enclosure. We had a few old outdoor phone boxes laying around the space, these are the same ones you would commonly see being used for phone service hookup outside of your house. These were perfect because the plastic is thick and sturdy and you are able to lock the case. The first thing we had to do was gut the inside, which consisted of removing the electronics and dremeling the plastic to fit everything inside the box.

phoneboxphonebox2

Since the Pi supported S-video out, I found a cheap 4.5” LCD screen on Amazon that was from a car backup camera system that had S-video inputs. I cut out the front of the box and fit the screen into place. So now when someone entered it would play a video corresponding to that user.
phonebox3phonebox4

I also started modding a python script for GoogleTalk from mitchtech.net that allowed me to control the Pi from my Android phone by sending it commands. I also added code to it to allow multiple bot admins, allow me to add/remove/modify users in the RFID card database, check the current temperature, callerID lookups and geolocate IP addresses. Also added Twitter capabilities , so when someone entered the space , the Pi would tweet who entered and what time. Which served as sort of a backup to our entry log, and let other members know who was currently at the space.

nesitpi

Originally I was going to use a 12v door actuator with our normal door, which you will see if some of the videos, but we also had a sliding door that one of our members decided to hook up to a garage door opener to. So now all I had to do was interface the garage door trigger with a 5v relay. I also added a arcade button so members can open the door from inside the space.
garagedoorarcadebutton

I added a tamper button inside that would send out an email alert if someone tried to open the case, it also curls an image from the IP camera we have outside the door. Another button in front that would play a promo video when someone pressed it. The final thing I installed was a PIR sensor, It would wait for movement , such as someone walking by, and beckon them to press the button to play a randomly picked NESIT promo video.

The power for the device was a power supply for an external hard drive. The great thing about it is that it outputs 5v and 12v natively so I didn’t have to muck around with stepping the voltages up or down. You can get one on eBay etc for about $7. This helped because the LCD screen runs on 12v and the other components run off 5v. I installed a mounting block inside to help run all the wires to each device.

RFPiD-inside3RFPiD-frontRFPiD-front2RFPiD-insideRFPiD-inside2

All the python code and C code runs from bootup and/or cron jobs that check to see if the files are running and restart them if needed to keep the device running perfectly.

In total the project was around $160
$40 for PI
$50 for RFID and USB breakout board
$20 for LCD
$30 for used garage door opener
$3 for PIR sensor
$10 for wiring,4gb SD card, LEDs, and resistors
$4 for Temp sensor


To be continued….