Montag, 15. Februar 2016

Part 5: install #pilight on your #pi and controll your lightswitches

TinkerTable switches on and off one of my lights in my flat when I come home or leave home (using IFTTT and geofences and pilight and a python script. And it provides a nice website to switch my lights on and off using my mobile.


installing pilight:

# pilight
https://www.pilight.org/get-started/installation/
run as sudo:
    sudo su
add the apt to the repository:
    nano /etc/apt/sources.list
add this line:
    deb https://apt.pilight.org/ stable main

you'll need a key:
    wget -O - https://apt.pilight.org/pilight.key | apt-key add -

now update the apt package list
    apt-get update
this produced an error so I first installed that driver:
    sudo apt-get install apt-transport-https
and again:
    apt-get update
and install pilight
    apt-get install pilight
Pilight will start itself at boot time
YEAH!

a good guide to pilight in german:
https://raspberry.tips/hausautomatisierung/raspberry-pi-pilight-mit-433mhz-modulen-zur-hausautomatisierung/

you've got to make some changes to the config json file (in the older pilight version there where extra files for hardware and config and settings)
https://wiki.pilight.org/doku.php/config

stop pilight before editing the file:
    sudo service pilight stop
you can start it with
    sudo service pilight start

the config.json looks like
{
"devices": {
"living": {
"protocol": [ "intertechno_old" ],
"id": [{
"id": 0,
"unit": 0
}],
"state": "off"
},
"kitchen": {
"protocol": [ "intertechno_old" ],
"id": [{
"id": 2,
"unit": 0
}],
"state": "off"
},
"corridor": {
"protocol": [ "intertechno_old" ],
"id": [{
"id": 1,
"unit": 0
}],
"state": "on"
},
"bedroom": {
"protocol": [ "intertechno_old" ],
"id": [{
"id": 0,
"unit": 3
}],
"state": "on"
}
},
"rules": {},
"gui": {
"living": {
"name": "Wohnzimmer",
"group": [ "janhimself" ],
"media": [ "all" ]
},
"kitchen": {
"name": "Kueche",
"group": [ "janhimself" ],
"media": [ "all" ]
},
"corridor": {
"name": "Flur",
"group": [ "janhimself" ],
"media": [ "all" ]
},
"bedroom": {
"name": "TinkerTable",
"group": [ "janhimself" ],
"media": [ "all" ]
}
},
"settings": {
"log-level": 6,
"pid-file": "/var/run/pilight.pid",
"log-file": "/var/log/pilight.log",
"webserver-enable": 1,
"webserver-root": "/usr/local/share/pilight/",
"webserver-http-port": 5001,
"webserver-cache": 1
},
"hardware": {
"433gpio": {
"sender": 4,
"receiver": 1
}
},
"registry": {
"pilight": {
"version": {
"current": "7.0"
}
}
}
}

Sonntag, 14. Februar 2016

Part 4: old printer as wireless network printer using #cups and your #raspberry pi

TinkerTable has a built in HP Deskjet 940c printer, old but reliable and with this setup it's a super useful wireless network printer:


install cups for printing
    sudo apt-get install cups
give user permission to print
    sudo usermod -a -G lpadmin pi 

to print remotely enable:
sudo cupsctl --share-printers --remote-admin

from a browser log into your cups server: <YOURPISIP>:631/admin
add your printer to cups, (log in with your pi account) and default values in the cups management console

Install your printer on your windows pc
-->Devices and Printers--> Add Printer--> Printer isn't listed --> Select a shared printer by name--> http://<myPi IP Address>:631/printers/HPDeskjet940c

Samstag, 13. Februar 2016

Part 3 of: one button scan to dropbox with your #raspberry pi: buttons

This is just a short one: you'll need to install the gpio stuff so that your python scripts can make use of them:

now if you don't have it already on your pi: install python
    sudo apt-get update
    sudo apt-get install python-dev
    sudo apt-get install python-rpi.gpio
you need the gpio thingy to controll your pi with buttons and let some leds light up


And you'll need some soldering...
I've added 5 LEDs and 5 Buttons and three switches (of which only one is connected to the pi) 
and here's my wiring diagram :D 
You'll need some resistors for the red, green and yellow LEDs and some pullup resistors for the buttons (not sure if they are called pull down resistors in my case as they connect the pins so ground while the button is open...).... pull down.... pull down resistors!


Freitag, 12. Februar 2016

Part 2 of: one button scan to dropbox with your #raspberry pi

The dropbox part ist very useful: Andrea Fabrizi's script is very easy to use. I do also use it with my timelapse projects. But first mission was to get my snailMails scanned and saved digitally:

# dropbox-Uploader
I used Andrea Fabrizis Dropbox script:
https://github.com/andreafabrizi/Dropbox-Uploader/blob/master/dropbox_uploader.sh
get the bash script here:
https://github.com/andreafabrizi/Dropbox-Uploader/blob/master/dropbox_uploader.sh
    sudo apt-get install git-core
follow these steps:
https://github.com/andreafabrizi/Dropbox-Uploader
    git clone: https://github.com/andreafabrizi/Dropbox-Uploader/
    or just: curl "https://raw.github.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh" -o dropbox_uploader.sh

give the execution permission to the script (make sure your in the right directory)
    chmod +x dropbox_uploader.sh
    ./dropbox_uploader.sh

follow the steps that the script wants you to do... setting up a dropbox api and so on...

Donnerstag, 11. Februar 2016

Part 1 of: one button scan to dropbox with your #raspberry pi

My tinkerTable works as a document management system... kind of.
That's why there's a button which starts the scanner and saves the scan to dropbox.

Here's what you need for the scanning part:

sane
make sure your scanner is supported:
http://www.sane-project.org/sane-mfgs.html

Install sane:
    sudo apt-get update
    sudo apt-get install sane
allow user to scan:
    usermod -a pi -G scanner
this didn't work with the raspberry pi model b, but scanning worked anyhow.

check scanning:
    scanimage -L

this didn't work, but I got a result using
    scanimage > test.ppm

imagemagic is needed to convert images:
    sudo apt-get install imagemagick

I've found lot's of help here:
http://www.gaducated.com

Dienstag, 9. Februar 2016

How To prevent your pi's screen from going to sleep

If you don't want your screen to shut down try this:

sudo nano /etc/kbd/config

edit these two lines:

BLANK_TIME=0
POWERDOWN_TIME=0

and then, if you realize that this didn't work, try:

sudo nano /etc/lightdm/lightdm.conf

in the section [SeatDefault] insert this line:

xserver-command=X -s 0 dpms

(And: How To prevent yourself from going to sleep: ssh into your pi)