Raspberry tutorial
 
This tutorial explains first steps with a raspberry PI: Install the OS "raspbian" and program a simple RC servo.

Install Raspbian
Download the latest raspbian image from https://www.raspberrypi.org/downloads/raspbian/
Upload to a sd card with the following command (eg. Mac OS X):
diskutil list
Find out the correct device of your SD card, replace "/dev/diskX" with it in the following commands:
diskutil umount /dev/diskX
diskutil partitionDisk /dev/diskX 1 "Free Space" "unused" "100%"
hdiutil convert -format UDRW -o ~/Desktop/mini ~/Desktop/2017-03-02-raspbian-jessie-lite.img
sudo dd if=~/Desktop/mini.dmg of=/dev/rdiskX bs=1m


Then, to enable SSH connection to Raspberry PI, if you do not want to connect a momnitor, execute (still on Mac OS X):
touch /Volumes/boot/ssh

Now you are ready to unmount the SD card and plug it into the raspberry



Raspbian configuration

To connect to the PI, use SSH.
ssh pi@raspberry.pi
Login: pi, Password: raspberry

Now some configuration examples:
# ETHERNET
sudo vi /etc/network/interfaces

# auto eth0
# iface eth0 inet static
#    address 192.168.0.3
#    netmask 255.255.255.0
#    network 192.168.0.0
#    broadcast 192.168.0.255
#    gateway 192.168.0.1

#WLAN:
# wlan stick einstecken
sudo iwlist wlan0 scan
sudo vi /etc/wpa_supplicant/wpa_supplicant.conf
# Netzwerk hinzufügen:
# network={
#   ssid="BCW17"
#   key_mgmt=NONE
# }
# Route über wlan0:
sudo route add default gw 100.127.0.1

# restart wifi:
# sudo wpa_cli reconfigure

# Wlan prüfen (inet_addr muss ausgefüllt sein):
ifconfig wlan0

# Software installieren:
sudo apt-get install git vim




RC servo example
As an example, connect a RC hobby servo (5V) to the Raspberry PI's GPIO pins:
red wire to the 5V pin
black wire to the GND pin
yellow/white signal wire to eg. GPIO17

The execute python on raspberry PI, and within python, enter the following:
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)
GPIO.setup(11,GPIO.OUT)
pwm=GPIO.PWM(11,50)

pwm.start(2)
pwm.start(11)


This should move the servo from one end to the other.
 
admin / Dec 03, 2016
   
 
 
Login: 
Pass: 
 
 
     
     
2004 - 2017 / lookass.ch
makememad@lookass.ch