Skip to content

Get Started Hardware

Ben edited this page Feb 23, 2019 · 8 revisions

Raspberry Pi

First of all you have to install a distribution of your choice. In our case we chose Raspbian Jessy with the new PIXEL desktop. Take Care, these explanations are based on Linux Kernel 4.4 or higher.

  1. Download an image from https://www.raspberrypi.org/downloads/raspbian/

  2. Put your SD card in your pc and format it with the FAT32 filesystem

  3. Install the image on your SD card (with Linux you can use dd: "sudo dd bs=4M if=path/to/image/file.img of=/path/to/device") NOTE: you have to declare the path to the sd card and not an partition, e.g. sdb and not sdb1!

  4. put the sd card in the raspberry pi

  5. Connect a monitor and keyboard to your raspberry pi

  6. Plug in a micro usb cable to your pi to power up

  7. Now the PIXEL environment should start and you can use it like a normal Linux

  8. Open the terminal, type "sudo apt-get update" and afterwards "sudo apt-get dist-upgrade"

  9. Reboot and the Pi is ready for usage

Change default autologin user

To change the default user for auto GUI login, I modified the raspi-config script (http://raspberrypi.stackexchange.com/questions/12538/boot-into-the-gui-after-changing-default-user).

  1. sudo vi /usr/bin/raspi-config

  2. Inside the do_change_pass() method search for the following lines and replace 'pi' with your username:

  • whiptail --msgbox "You will now be asked to enter a new password for the pi user" 20 60 1
  • passwd pi &&
  1. Inside the do_boot_behaviour() method search for the following lines and replace 'pi' with your username:
  • "B2 Console Autologin" "Text console, automatically logged in as 'pi' user" \
  • "B4 Desktop Autologin" "Desktop GUI, automatically logged in as 'pi' user" \
  • sed /etc/inittab -i -e "s/1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1/1:2345:respawn:/sbin/getty --noclear 38400 tty1/"
  • sed /etc/inittab -i -e "s/1:2345:respawn:/sbin/getty --noclear 38400 tty1/1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1/"
  • if id -u pi > /dev/null 2>&1; then
  • sed /etc/lightdm/lightdm.conf -i -e "s/^#autologin-user=.*/autologin-user=pi/"
  • whiptail --msgbox "The pi user has been removed, can't set up boot to desktop" 20 60 2
  • "2 Change User Password" "Change password for the default user (pi)" \
  1. edit the lightdm.conf "sudo vi /etc/lightdm/lightdm.conf" to change the autologin user. Replace "pi" in the following line with your user:
  • autologin-user=pi
  1. reconfigure the raspi config to use your new user. So type "sudo raspi-config" go to "Boot Options > Desktop / Cli" and select "Desktop Autologin", select finish and reboot your raspberry pi.

  2. Now your raspberry pi should start with your new user automatically.

GPIOs

On this site you can find the GPIO allocation: http://indibit.de/raspberry-pi-die-gpio-schnittstelle-grundlagenbelegung/

The following page describes how you can access all GPIOs of the Raspberry Pi: http://raspberrypi.znix.com/hipidocs/topic_gpiodev.htm

Camera

  1. Connect the camera to the camera hardware interface on the pi

  2. open the terminal, type "sudo raspi-config" and enable the camera support

  3. go to the menu (top left) > preferences > Raspberry Pi configuration > Interfaces Tab > change camera related checkbox to enabled

  4. Reboot your pi to activate your changes

  5. Now the camera can be accessed with several language APIs like python and java

Display

This explanation is based on the following tutorial: www.circuitbasics.com/setup-lcd-touchscreen-raspberry-pi Caution: The linked tutorial is outdated, so this explanation contains several modifications.

  1. open fbturbo video driver config to set the output device ("sudo vi /usr/share/X11/xorg.conf.d/99-fbturbo.conf")

  2. In this file search for the line 'Option “fbdev” “/dev/fb0”' and change it to ' Option “fbdev” “/dev/fb1”' (fb0 outputs to hdmi port and fb1 to a display that is connected over GPIOs)

  3. Per default the SPI (serial peripheral interface) is disabled but the touchscreen is using this interface. Type "sudo raspi-config", go to "Advanced Options" and enable "A6 SPI".

  4. Since Linux kernel 4.4 the display drivers are built in, so there is no custom firmware needed anymore. Skip this task in the linked tutorial above.

  5. For 3.5" and 4" Display you have to copy waveshare35a-overlay.dtb from https://github.com/swkim01/waveshare-dtoverlays to /boot/overlays using this command: "sudo cp ./waveshare35a-overlay.dtb /boot/overlays/waveshare35a-overlay.dtbo".

  6. edit /boot/config.txt and change the following entries:

  • "hdmi_group" from 1 to 2
  • "hdmi_mode" from 1 to 2
  • add "dtoverlay=waveshare35a,speed=14000000" at the bottom of the file
  1. Now we have to configure the kernel modules which should be loaded at the boot process. Add the following text to "/etc/modules"

     fbtft_device name=waveshare35a gpios=dc:22,reset:27 speed=48000000
    
     waveshare35a width=320 height=240 buswidth=8 init=-1,0xCB,0x39,0x2C,0x00,0x34,0x02,-1,0xCF,0x00,0XC1,0X30,-    1,0xE8,0x85,0x00,0x78,-1,0xEA,0x00,0x00,-1,0xED,0x64,0x03,0X12,0X81,-1,0xF7,0x20,-1,0xC0,0x23,-1,0xC1,0x10,-1,0xC5,0x3e,0x28,-1,0xC7,0x86,-1,0x36,0x28,-1,0x3A,0x55,-1,0xB1,0x00,0x18,-1,0xB6,0x08,0x82,0x27,-1,0xF2,0x00,-1,0x26,0x01,-1,0xE0,0x0F,0x31,0x2B,0x0C,0x0E,0x08,0x4E,0xF1,0x37,0x07,0x10,0x03,0x0E,0x09,0x00,-1,0XE1,0x00,0x0E,0x14,0x03,0x11,0x07,0x31,0xC1,0x48,0x08,0x0F,0x0C,0x31,0x36,0x0F,-1,0x11,-2,120,-1,0x29,-1,0x2c,-3
    
     ads7846_device model=7846 cs=1 gpio_pendown=17 speed=1000000 keep_vref_on=1 swap_xy=0 pressure_max=255 x_plate_ohms=60 x_min=200 x_max=3900 y_min=200 y_max=3900
    
  2. To configure several boot options which are required to get this display working, add the following to "/boot/cmdline.txt"

     dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbtft_device.custom fbtft_device.name=waveshare35a fbtft_device.gpios=dc:22,reset:27 fbtft_device.bgr=1 fbtft_device.speed=48000000 fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo dma.dmachans=0x7f35 console=tty1 consoleblank=0 fbtft_device.fps=50 fbtft_device.rotate=0
    
  3. Edit the lightdm.conf and add '-nocursor' to xserver-command

  4. If you wanna use Browser with touchscreen, chromium is recommended with the following start parameters: T.B.D

Calibrate the touch screen

After a fresh display setup it could be the case that axes are inverted and more. Thats why it is necessary to calibrate the touch screen. There are several tools like xinput-calibration but for any reason with these tools the calibration is not working correctly for me. That's why I created this calibration file with trial n error.

  1. Create /etc/X11/xorg.conf.d/99-calibration.conf

  2. Copy this calibration information in that file:

     Section "InputClass"
             Identifier      "calibration"
             MatchProduct    "ADS7846 Touchscreen"
             Option          "Calibration"           "3919, 208, 236, 3913"
             Option          "SwapAxes"              "1"
             Option          "InvertY"               "true"
             Option          "InvertX"               "true"
     EndSection
    

Disable the screensaver

Add the following lines to the [SeatDefaults] section in /etc/lightdm/lightdm.conf:

xserver-command=X -s 0 dpms