The actual Raspbian distribution Jessie released on May 27 216 (NOT the lite version) or newer brings a cool feature to preconfigure the WIFI settings. A keyboard and a screen aren't necessary to bring a Raspberry Pi with Raspbian to life.
Configuration on Windows
- download the Raspbian image on RapsberryPi.org and extract it
- if you don't have download the Win32DiskImager to copy the image to the SD card
- insert the SD card in your card reader (micro SD cards with adapter, start the Win32Diskimager (it will ask to run as Administrator), and select the extracted image file (from 1)
- click "Write" to start the transfer of the image to the SD card
- when the process is finished successfully, you should see a part of the SD card in Windows Explorer
- right click into the SD card folder and create a new text-file with the name wpa_supplicant.conf
- open the file (if possible with Textpad or Notepad++) copy the following text into the file, ensure the bold parts are changed to your WIFI, the quote marks are necessary
update_config=1
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
ssid="testwifi"
psk="testpassword"
}
- save the file, move the SD card from your computer to the Raspberry and start it
Configuration on Linux
- download the Raspbian image on RapsberryPi.org and extract it
- before inserting the SD card, check the attached devices with this command:
df -h
- then insert the SD card and repeat the command after a few seconds
df -h
in the output you should find a line like
/dev/mmcblk0p1
or
/dev/sdd1
okay in this example I will use "mmcblk0p1". - With the command:
mount
you need to check if the SD card is mounted somewhere. If so, unmount the SD card with
sudo umount /mnt/sdcrd
- Because df shows the partition and we want to copy the image file to the device, the name of the device in the copy command will be /dev/mmcblk0 or /dev/ssd
- when the device name of the SD card is known, the image file can be copied there. the command is:
dd bs=4M if=2016-05-27-raspbian-jessie.img of=/dev/mmcblk0 - after the successful copy to the SD card, the card can be removed and reinserted. There will be a check for the partitions again
df -h
in the output you should find again the same /dev/mmcblk0p1device with the command
mount
you will see the mountpoint of the SD card (in this example should be /mnt/sdcrd) - in this folder should be files like
bcm2708-rpi-b.dtb
bcm2708-rpi-b-plus.dtb
bcm2708-rpi-cm.dtb
bcm2708-rpi-2-b.dtb
bcm2708-rpi-3-b.dtb
bootcode.bin
cmdline.txt
config.txt
... - with the command (change in the command mywifi to your SSID and mypassword to the password of your WIFI)
sudo wpa_passphrase mywifi mypassword >> mnt/sdcrd/wpa_supplicant.conf
you will create a file wpa_supplicant.conf in this folder - now the SD card can be unmounted
sudo umount /mnt/sdcrd
the card can be removed and inserted in the Raspberry.
username: pi
password: raspberry
No comments:
Post a Comment