User Tools

Site Tools


FIXME - Mr. Worthings notebook has more comprehensive information at this point. Needs to be transfered.

Raspberry PI

The raspberry pi is a small computer that is designed to interact with sensors, motors, cameras and much more. On the following pages we will explore some of the capabilities and uses for the pi. We will also explain how to set up the pi to work in the Technodog environment and ensure that it has all of the necessary software.

Capabilities Briefing

Vision Processing

Installation A to Z

Preparing the Raspberry PI for the following

  • Assignable Roles
    • Each role has a sequence of items to boot
    • Each system must have a means for discovering it
      • FRC - network tables
      • Hot Spot for Ellie, Scout and Industrial Machines
        • own network tables
    • capabilites
      • Open CV
      • X / no X
      • ssh access
      • frame buffer
      • web configuration

I should mirror this on the BBB (blue)

  1. Download OS
  2. Use etcher to write it to sd card
  3. Put empty file in /boot  called ssh  (this enables ssh)
  4. Uninstall some unnecessary stuff
      a. sudo apt-get purge wolfram-engine
      b. sudo apt-get purge libreoffice*
      c. sudo apt-get clean
      d. sudo apt-get autoremove
  5. Update and upgrade - sudo apt-get update && sudo apt-get upgrade
  6. Get ready for OpenCV
      a. sudo apt-get install build-essential cmake pkg-config
      b. sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
      c. sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
      d. sudo apt-get install libxvidcore-dev libx264-dev
      e. sudo apt-get install libgtk2.0-dev libgtk-3-dev
      f. sudo apt-get install libatlas-base-dev gfortran
      g. sudo apt-get install python2.7-dev python3-dev
  7. Download opencv
      a. wget -O
      b. unzip
      c. wget -O
      d. unzip
  8. Python PIP
      a. wget
      b. sudo python
      c. sudo python3
  9. Virtual Env for python
      a. sudo pip install virtualenv virtualenvwrapper
      b. sudo rm -rf ~/.cache/pip
  10. Edit .profile so install emacs and add the following lines
      # virtualenv and virtualenvwrapper
      export WORKON_HOME=$HOME/.virtualenvs
      source /usr/local/bin/
  11. I plan on using python3 for everything  (if you want python2 just say that instead) - so a virtual environment called frc using python3: mkvirtualenv frc -p python3
  12. Numpy
      a. workon frc
      b. pip install numpy
  13. OK opencv  make sure that you are in the frc environment
      a. cd opencv-3.3.1/
      b. mkdir build
      c. cd build
      d. cmake -D CMAKE_BUILD_TYPE=RELEASE \
          -D CMAKE_INSTALL_PREFIX=/usr/local \
          -D OPENCV_EXTRA_MODULES_PATH=~/install/opencv/opencv_contrib-3.3.1/modules \
          -D BUILD_EXAMPLES=ON ..
      e. Need to increase swap space in order to compile opencv with enough memory for all four cores
          i. Open your /etc/dphys-swapfile  and then edit the CONF_SWAPSIZE
          ii. Change it to 1024 from 100
          iii. sudo /etc/init.d/dphys-swapfile stop
          iv. sudo /etc/init.d/dphys-swapfile start
      f. COMPILE CV  - 
          make -j4
      g. sudo make install
      h. sudo ldconfig
      i. List the directory contents of /usr/local/lib/python3.5/site-packages
          i. if it does not show but something else like
          ii. We can rename it, but I am going to copy it - sudo cp -p /usr/local/lib/python3.5/site-packages/ /usr/local/lib/python3.5/site-packages/
      j. Link the opencv lib to your virtual env  NOTE right now I am sticking with python3.  Need to do some other things for python2 from above
          i. cd ~/.virtualenvs/frc/lib/python3.5/site-packages/
          ii. ln -s /usr/local/lib/python3.5/site-packages/
      k. TEST it.   Run python once as it spits out a bunch of imports then
          (frc) pi@raspberrypi:~ $ python
          Python 3.5.3 (default, Jan 19 2017, 14:11:04) 
          [GCC 6.3.0 20170124] on linux
          Type "help", "copyright", "credits" or "license" for more information.
          >>> import cv2
          >>> cv2.__version__
      l. Remove the install stuff to free space
      m. Change swap back to correct size
  14. Install Screen so we can leave things running after logout - sudo apt-get install screen
  15. I plan on using YAML so it would be nice to have emacs have a mode - sudo apt-get install yaml-mode (edited)

Some changes would need to be made depending on where you unpack your build stuff. But no worries, I will be doing this again myself, and replicating the SD card, so we could do plug and play with yours if you want to wait.

engineering/computer/microcontrollers/pi.txt · Last modified: 2022/10/01 17:00 by

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki