Smartphone Portkontrol med RaspberryPi

1 RPi A+ eller B rev.2 eller nyere

1 PSU 5v DC 1.2A
1 USB WiFi
1 SD-card 8GB 
1 Relæ Modul 
1 Magnet kontakt 
Jumperwire med HUN-HUN stik men det kan også loddes.
Signalkabel min. 2x0.6 - de fleste kabler har flere ledere.

Du kan nok finde det hele her http://elektronik-lavpris.dk/.

Værktøj
Multimeter
Små skruetrækkere (PZ1, PH1, 5mm)
Evt. lille loddekolbe + tin med flus

Python controller modul
Et python script med en webservice.
Webservicen bruger GPIO til at levere status-data og aktiverings-signal for åbning/lukning.
[plain]git clone https://github.com/andrewshilliday/garage-door-controller[/plain]

TRIGGER
[plain] RPi pin 1 (3.3v) => Relæ Modul pin Vcc
RPi pin 16 (BCM GPIO 17) => Relæ Modul pin In1
RPi pin 3 (GND) => Relæ Modul pin Gnd
[/plain] STATUS
[plain] RPi pin 9 (GND) => MK reed
RPi pin 11 (BCM GPIO 23) => MK reed
[/plain] RELÆ
[plain] Common => portstyring
Normally Open => portstyring
[/plain]

Using USB harddrives on RaspberryPi

This is surprisingly easy.

  • Make sure your PI has enough power – at least a 2Ah or better.
  • Mount the root partition your SD card
  • Mount your USB harddrive (ext4 formatted
  • Copy the root partition of the sdcard to a ext4 formatted usb-harddrive.
  • Rebember to sync to ensure all data are flushed from cache.
mount /dev/sdxY /your/sdcard/mountfolder
mount /dev/sdxY /your/usb/mountfolder
cp -r /your/sdcard/mountfolder/* /your/usb/mountfolder
sync

On the boot partition of the sdcard copy the file cmdline.txt -> cmdline.txt.bak.

cp /boot/cmdline.txt /boot/cmdline.txt.bak

Open cmdline.txt and find where it reads

root=/dev/mmcblk0p6

Change it to

root=/dev/sda1

Save your file.

Attach your USB drive to your PI, insert your SD card and plugin power. Your PI will boot faster and you dont wear your SD card down.

Raspberry Pi: resources

Resources

Raspberry Pi

http://www.raspberrypi.org/documentation/configuration/device-tree.md

http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=97314

https://github.com/Hexxeh/rpi-firmware/tree/master/overlays

ArchLinux

http://archlinuxarm.org/platforms/armv6/raspberry-pi

http://archpi.dabase.com/

https://wiki.archlinux.org/index.php/Raspberry_Pi

http://elinux.org/ArchLinux_Install_Guide

http://docs.rpi-dashboard.com/system_configuration/enable_spi.html
http://www.raspberrypi.org/tag/arch-linux/

http://docs.rpi-dashboard.com/build_from_source/build_on_arch_linux.html

Raspberry Pi: status

How are you today?

#!/bin/bash                                                               
for src in arm core h264 isp v3d uart pwm emmc pixel vec hdmi dpi
do
    echo -e "$src:\t$(vcgencmd measure_clock $src)"
done                                  
for id in core sdram_c sdram_i sdram_p
do
    echo -e "$id:\t$(vcgencmd measure_volts $id)"
done
vcgencmd codec_enabled MPG2
vcgencmd codec_enabled WVC1