User Tools

Site Tools


contributors:rob.baynes:rpisetup

PFC 2.0 RPi development setup

  1. Buy a 32 GB SD card, Raspberry Pi 3 model B 64bit ARM core 1G ram, Arduino ATMEGA-2560 board and 5V power supply from Amazon:

  2. Original instructions (update later?): installing
  3. Download Raspbian Jesse with pixel GUI: https://www.raspberrypi.org/downloads/raspbian/. [Note from ferguman: See the note below (search for vim) on issues with installing vim when running on the 7/5/2017 release of Raspbian.]
  4. Using OS X 10.12.3 on a MacBook that has an SD slot, unzip the raspbian file and write it to the SD card:
    • Insert the SD card into the larger carrier and put into the SD slot (right side of my MacBook).
    • diskutil list

    • diskutil unmountDisk /dev/disk2 (you may have a different disk number!)

    • sudo diskutil eraseDisk FAT32 RASPBIAN MBRFormat /dev/disk2
    • diskutil unmountDisk /dev/disk2
    • sudo dd bs=1m if=2017-02-16-raspbian-jessie-pixel-gui.img of=/dev/rdisk2 (be patient, this takes a few minutes)
    • touch /Volumes/boot/ssh
    • sudo diskutil eject /dev/rdisk2
  5. Remove the small SD card from the larger carrier and insert it into the slot on the bottom of the RPi (which is still powered OFF).
  6. Attach the monitor and keyboard.
  7. Plug in the 5V power supply and connect it to the RPi and watch it boot!
  8. Type Ctrl + Alt + F1 to get the console (already logged in as pi@raspberrypi.local).
  9. Change the pi users' password: (default is 'raspberry') passwd
  10. The fast way to do the settings below is to use sudo raspi-config
  11. Change your keyboard to your country code (the default is Great Britain) sudo vi /etc/default/keyboard (use 'us')
  12. sudo dpkg-reconfigure locales (uncheck 'en_GB.UTF-8' and check 'en_US.UTF-8')
  13. sudo dpkg-reconfigure keyboard-configuration
  14. sudo dpkg-reconfigure tzdata
  15. Enable SSH.
  16. sudo reboot
  17. Enable WIFI by filling in your SSID and reboot: You MUST do this to get DNS to work.
    • Add the block below to the bottom of this file: sudo vi /etc/wpa_supplicant/wpa_supplicant.conf
      country=US
      network={
          ssid="YOUR_SSID"
          psk="YOUR_WIFI_PASSWORD"
      }
    • For example, this is what you use for the MIT open network:
      country=US
      network={
      	ssid="MIT"
      	key_mgmt=NONE
      }
    • If you are using an open / unsecured WIFI network without a password, replace the psk line in the above file with this: key_mgmt=NONE
    • 
sudo reboot now
  18. Type Ctrl + Alt + F1 to get the console. And wait a minute for the RPi to connect to WIFI.
  19. Get the RPi IP address (if you want to ssh into it) ifconfig wlan0
  20. You should now be able to ssh into the RPi (or you can continue to use the console) ssh pi@raspberrypi.local (or use the IP address).
  21. Change the swap size to 1GB:
    • sudo vi /etc/dphys-swapfile
      CONF_SWAPSIZE=1024 
    • free -m
    • sudo /etc/init.d/dphys-swapfile stop
    • sudo /etc/init.d/dphys-swapfile start
    • free -m
  22. Now update the debian package list and update/install some packages:
    • sudo apt-get update

    • [Note from ferguman: The following line fails on the vim install when I run on the 7/5/2017 release of Raspbian. It works on the 6/21/2017 release of Raspbian.]
    • sudo apt-get install -y vim git htop g++ gdb
    • sudo update-alternatives --config editor
  23. Install the OpenAg brain, python, ROS, CouchDB:
    • git clone https://github.com/OpenAgInitiative/openag_brain.git ~/catkin_ws/src/openag_brain
    • ~/catkin_ws/src/openag_brain/scripts/developer_setup This will do sudo a few times and prompt you for your password.
  24. Now go have lunch and take a long walk. The install script pulls code and builds many things. Trust me, it takes a LONG time: 138m47.989s
  25. sudo systemctl disable openag_brain.service
    • source ~/catkin_ws/devel/setup.bash
    • cd ~/catkin_ws/src/openag_brain
    • rosrun openag_brain init_pio Only need to do ONE time.
    • rosrun openag_brain firmware
    • rosrun openag_brain firmware --target upload
  26. How To Install and Deploy the latest openag_ui as a couchapp
  27. The SD card can be (easily) corrupted, so let's make a backup of it now:
    • On the RPi: sudo shutdown -h now
    • Wait until it is fully shut down (watch the second LED flash next to the power one, when it stops, you are safe).
    • Unplug the power from the RPi. Also remove the HDMI cable.
    • Remove the SD card from the RPi, put it in the carrier and insert into your desktop (macbook).
    • diskutil unmountDisk /dev/disk2
    • sudo dd bs=1m if=/dev/rdisk2 | gzip > rbaynespi.2017-03-02.img.gz
    • sudo diskutil eject /dev/rdisk2
    • Put the SD card back in the RPi and plug in the power and HDMI.
      • To restore an SD card from that backup file you just made, you would want to reformat/erase the SD card, then use a command like this: gunzip -c backup.img.gz | sudo dd bs=1m of=/dev/rdisk2
  28. Add this to your RPi users' .bashrc source ~/catkin_ws/devel/setup.bash
  29. Change the hostname:
    • sudo vi /etc/hostname (replace raspberrypi)
    • sudo vi /etc/hosts (replace raspberrypi)
    • 
sudo reboot
contributors/rob.baynes/rpisetup.txt · Last modified: 2017/11/22 15:07 by dukrat