Archive

Archive for the ‘Raspberry Pi’ Category

Alexa Turn on the TV

December 20th, 2016 No comments

 

Turn your regular old TV into a Smart TV with this script that emulates a Wemo smartplug called “Fauxmo,” an IR led circuit hooked up to a GPIO pin and a Raspberry pi! This is a walkthrough for getting it setup on your raspberry pi on your home network and making it callable by your Alexa Smart Home assistant.

 

 

Install LIRC:

sudo apt-get install lirc

Add this to your /etc/modules file:

lirc_dev
lirc_rpi gpio_in_pin=23 gpio_out_pin=22
Change your /etc/lirc/hardware.conf file to:
########################################################
# /etc/lirc/hardware.conf
#
# Arguments which will be used when launching lircd
LIRCD_ARGS=”–uinput”

# Don’t start lircmd even if there seems to be a good config file
# START_LIRCMD=false

# Don’t start irexec, even if a good config file seems to exist.
# START_IREXEC=false

# Try to load appropriate kernel modules
LOAD_MODULES=true

# Run “lircd –driver=help” for a list of supported drivers.
DRIVER=”default”
# usually /dev/lirc0 is the correct setting for systems using udev
DEVICE=”/dev/lirc0″
MODULES=”lirc_rpi”

# Default configuration files for your hardware if any
LIRCD_CONF=””
LIRCMD_CONF=””
########################################################
Now restart lircd so it picks up these changes:
sudo /etc/init.d/lirc stop
sudo /etc/init.d/lirc start

In the 3.18.x RaspberryPi firmware you must modify one additional file for the lirc-rpi kernel extension to be loaded:
Edit your /boot/config.txt file and add:
dtoverlay=lirc-rpi,gpio_in_pin=23,gpio_out_pin=22
Reboot your RaspberryPi after making this change.

 

 

 

Here is my schematic for the IR LED

 

 

 

 

 

 

 

 

 

 

Get a TV Config File for LIRC:

http://lirc.sourceforge.net/remotes/
# Copy over your new configuration file
sudo cp ~/lircd.conf /etc/lirc/lircd.conf

# Send the KEY_POWER command once from the shell
irsend SEND_ONCE Vizio_VX37L KEY_POWER

 

Install Fauxmo as a network switch for your TV:

Install the requirements: Python 2.7, pip and required Python modules
sudo apt-get install python-pip ; sudo pip install requests

Download the fauxmo files and the AlexaTV.py and Fauxmo script Here:

wget “https://github.com/Spacecase808/echo/archive/master.zip”

Extract the zip file
unzip master.zip -d echo

Move to the newly created echo folder
cd echo/echo-master

Start the server – you should see some debugging text indicating the server has started polling.
python AlexaTV.py

Modify this line in the python script to have your IR command that you wish to issue on voice command:
os.system(“irsend SEND_ONCE Vizio_VX37L KEY_POWER”)

Testing:

The Echo integrates with the WeMo home automation protocol – simply say “Alexa, discover my devices” and it’ll search the local network for WeMo devices. So let’s give it a device to discover!

Say to your Echo “Alexa: discover my devices”. She’ll take a few seconds to find the new device. If she doesn’t find it the first time, try killing and restarting the process and discovering devices again.

Say, “Alexa: turn off TV”, or “Alexa, TV on”. You’ll see an echo of the output Philips TV On/Off command from: IP of alexa.

Alternatively you could always think of other ways issue the IR commands through SSH to the raspberry pi from the command line. I have had some fun setting timers for volume mutes during commercial breaks.

Hope you have fun making this one

-James

 

 

 

Categories: alexa, Android, Raspberry Pi Tags:

Raspberry Pi Torrent Box HDD Enclosure Hack

September 20th, 2015 1 comment

Check out this enclosure for the raspberry pi and this 160GB HDD I made out of my old Western Digital HDD case. I took the 5V off the molex connector to power the everything so the cool blue power button still works on the enclosure to turn everything on.

NCM_1547NCM_1548

NCM_1544

 

 

 

I have the HDMI jack on there right now for debugging and console output if I need it. I will remove it so it is truly a headless torrent box.

-James

Categories: linux, Modification, Raspberry Pi Tags:

Launchpad + Raspberry Pi

January 20th, 2013 3 comments

Hi there. I got Novation Launchpad connected with the Raspberry Pi running the Raspbian installation and talking with Pure Data.

I wanted to be able to load PD patches on the Pi, let it run under the hood of the launchpad and output custom midi.

 

 

 

 

 

These were the steps I took:

1. Installed raspbian on the sd card and got the pi booted up. If you are having trouble check out the Raspbian FAQ

2. Got PureData installed and got PD talking with alsa.

$ sudo apt-get update
$ sudo apt-get install puredata

3. Got dependancies and configured the launchpad executable driver “launchpadd” on the pi.

$ sudo apt-get install libusb-1.0-0-dev
$ sudo apt-get install automake

$ autoreconf -i
$ ./configure
$ make install

4. Installed other drivers for other perferials, I used the MidiSport Uno usb midi cable.

5. Loaded up my PD skeches on the Raspberry Pi and started them up.

6. To have the Launchpadd executable run at startup I changed the /.profile file in linux to start the “launchpadd” program at login.

Some of the things I would like to do to finish this project is to build an awsome enclosure to hold the pi and the launchpad also use the gpio pins for midi instead of the usb to midi converter.

 

Launchberry Pi from james on Vimeo.

I’m using a sketch that changes the output channel of the LP with the top row of buttons. its like having 8x launchpads.

Here’s a zip including all the readme files, launchpadd driver and a pd sketch to test the functionality of the launchpad. launchberrypi_files.zip

also here’s a link to get pd-extended running on the pi PD_extended_on_RaspberryPi

 

James