V2024_step_01.html 13.15 KiB
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>STEP n°1 : Raspberry Pi configuration &mdash; OhmPi v2024rc documentation</title>
      <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
      <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
        <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script src="../../_static/doctools.js"></script>
    <script src="../../_static/js/theme.js"></script>
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" /> 
</head>
<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          <a href="../../index.html" class="icon icon-home">
            OhmPi
          </a>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <ul>
<li class="toctree-l1"><a class="reference internal" href="../Ohmpi.html">OhmPi project</a></li>
<li class="toctree-l1"><a class="reference internal" href="../hardware.html">Hardware</a></li>
<li class="toctree-l1"><a class="reference internal" href="../software.html">Software and operation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../api.html">API reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="../troubleshooting.html">Troubleshooting</a></li>
<li class="toctree-l1"><a class="reference internal" href="../gallery.html">Examples of applications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../developing_hardware_components.html">Software interface to new hardware components</a></li>
<li class="toctree-l1"><a class="reference internal" href="../archived_version.html">Archived versions</a></li>
</ul>
        </div>
      </div>
    </nav>
    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../index.html">OhmPi</a>
      </nav>
      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../index.html" class="icon icon-home" aria-label="Home"></a></li>
      <li class="breadcrumb-item active"><strong>STEP n°1</strong> : Raspberry Pi  configuration</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../_sources/source_rst/V2024.x.x/V2024_step_01.rst.txt" rel="nofollow"> View page source</a>
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
</li> </ul> <hr/> </div> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <div itemprop="articleBody"> <section id="step-n1-raspberry-pi-configuration"> <h1><strong>STEP n°1</strong> : Raspberry Pi configuration<a class="headerlink" href="#step-n1-raspberry-pi-configuration" title="Permalink to this heading"></a></h1> <div class="admonition warning"> <p class="admonition-title">Warning</p> <p><strong>OhmPi is a participative project open to all, it requires skills in electronics and to respect the safety rules. OhmPi must be assembled in a professional context and by people competent in electronics. The OhmPi team cannot be held responsible for any material or human damage which would be associated with the use or the assembly of OHMPI. The OhmPi team cannot be held responsible if the equipment does not work after assembly.</strong></p> </div> <section id="part-a-os-installation"> <h2><strong>PART A:</strong> OS installation<a class="headerlink" href="#part-a-os-installation" title="Permalink to this heading"></a></h2> <table class="docutils align-default"> <tbody> <tr class="row-odd"><td><p><strong>Required components</strong></p></td> <td><p><strong>Quantity</strong></p></td> </tr> <tr class="row-even"><td><p>Raspberry Pi 4 Model B</p></td> <td><p>1</p></td> </tr> <tr class="row-odd"><td><p>Micro SD 32 Go</p></td> <td><p>1</p></td> </tr> <tr class="row-even"><td><p>HDMI Cable</p></td> <td><p>1</p></td> </tr> <tr class="row-odd"><td><p>Computer mouse</p></td> <td><p>1</p></td> </tr> <tr class="row-even"><td><p>Computer Keyboard</p></td> <td><p>1</p></td> </tr> </tbody> </table> <p>The first step is to start up the Raspberry Pi board, including installation of an OS (operating system). For this step, the installation instructions are well described on the Raspberry website</p> <ol class="arabic simple"> <li><p>Watch the video <a class="reference external" href="https://www.youtube.com/watch?v=wjWZhV1v3Pk">how to set up your raspberry Pi</a>.</p></li> <li><p>The authors recommend installing the latest stable and complete version of Raspberry Pi OS (Previously called Raspbian) by using Raspberry Pi Imager.</p></li> <li><p>or you can visit this <cite>website &lt;https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up&gt;</cite>.</p></li> </ol> <div class="admonition note"> <p class="admonition-title">Note</p> <p>All the development tests were performed on Raspberry Pi 3 Model B, we used the following version of Raspbian:</p> <figure class="align-center"> <a class="reference internal image-reference" href="../../_images/raspbian_version.jpg"><img alt="alternate text" src="../../_images/raspbian_version.jpg" style="width: 800px; height: 400px;" /></a> </figure> </div> <div class="admonition warning"> <p class="admonition-title">Warning</p> <p>Once the OS has been installed, <strong>1-wire, spi and GPIO remote option</strong> must be deactivated and <strong>I2C option</strong> must be activated via the Raspbian GUI settings menu. Failure to carry out this task may cause damage to the relay shield cards during measurements.</p> </div> </section> <section id="part-b-virtual-environment-and-packages"> <h2><strong>PART B:</strong> Virtual Environment and packages<a class="headerlink" href="#part-b-virtual-environment-and-packages" title="Permalink to this heading"></a></h2> <p>A virtual environment is a way to have multiple, parallel instances of the Python interpreter, each with different package sets and different configurations. Each virtual environment contains a discrete copy of the Python interpreter, including copies of its support utilities. It also protects your system in case of problems with the packages.</p> <p>All dependencies are specified in requirements.txt</p> <div class="admonition note"> <p class="admonition-title">Note</p> <p>All instructions below should be typed in the terminal</p> </div> <p>It is first necessary to ensure that the libatlas-base-dev library is installed:</p> <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apt</span><span class="o">-</span><span class="n">get</span> <span class="n">install</span> <span class="n">libatlas</span><span class="o">-</span><span class="n">base</span><span class="o">-</span><span class="n">dev</span> </pre></div> </div> <p>We strongly recommend users to create a virtual environment to run the code and installed all required dependencies. It can be done either in a directory gathering all virtual environments used on the computer or within the ohmpy directory.</p>
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
<p>Create the virtual environment:</p> <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">venv</span> <span class="n">ohmpy</span> </pre></div> </div> <p>Activate it using the following command:</p> <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">source</span> <span class="n">ohmpy</span><span class="o">/</span><span class="nb">bin</span><span class="o">/</span><span class="n">activate</span> </pre></div> </div> <p>Install packages within the virtual environment. Installing the following package should be sufficient to meet dependencies:</p> <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">export</span> <span class="n">CFLAGS</span><span class="o">=-</span><span class="n">fcommon</span> <span class="n">sudo</span> <span class="n">pip</span> <span class="n">install</span> <span class="n">RPi</span><span class="o">.</span><span class="n">GPIO</span> <span class="n">adafruit</span><span class="o">-</span><span class="n">blinka</span> <span class="n">numpy</span> <span class="n">pandas</span> <span class="n">adafruit</span><span class="o">-</span><span class="n">circuitpython</span><span class="o">-</span><span class="n">ads1x15</span> <span class="n">adafruit</span><span class="o">-</span><span class="n">circuitpython</span><span class="o">-</span><span class="n">tca9548a</span> <span class="n">adafruit</span><span class="o">-</span><span class="n">circuitpython</span><span class="o">-</span><span class="n">mcp230xx</span> <span class="n">gpiozero</span> </pre></div> </div> <p>Check that requirements are met using</p> <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="nb">list</span> </pre></div> </div> <p>You should run you code within the virtual environment to leave the virtual environment simply type:</p> <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">deactivate</span> </pre></div> </div> </section> <section id="part-c-activate-virtual-environment-on-thonny-python-ide-on-raspberry-pi"> <h2><strong>PART C:</strong> Activate virtual environment on Thonny (Python IDE) (on Raspberry Pi)<a class="headerlink" href="#part-c-activate-virtual-environment-on-thonny-python-ide-on-raspberry-pi" title="Permalink to this heading"></a></h2> <p>If you decided to use a virtual environment, it is necessary to setup Thonny Python IDE the first time you use it.</p> <p>1- Run the Thonny Python IDE software, Click on raspberry access <strong>menu &gt; programming&gt; Thonny pythonIDE</strong></p> <p>2- Thonny opens, Python runs on the root (Python 3.7.3 (/usr/bin/python3))</p> <figure class="align-center"> <a class="reference internal image-reference" href="../../_images/thonny_first_interface.jpg"><img alt="alternate text" src="../../_images/thonny_first_interface.jpg" style="width: 600px; height: 450px;" /></a> </figure> <p>3-Click on <strong>Run&gt;select interpreter</strong>, a new window opens click on interpret</p> <figure class="align-center"> <a class="reference internal image-reference" href="../../_images/thonny_option.jpg"><img alt="alternate text" src="../../_images/thonny_option.jpg" style="width: 600px; height: 450px;" /></a> </figure> <p>4-On the new open windows select <strong>alternative Python3 or virtual environment</strong></p> <figure class="align-center"> <a class="reference internal image-reference" href="../../_images/thonny_interpreter.jpg"><img alt="alternate text" src="../../_images/thonny_interpreter.jpg" style="width: 600px; height: 450px;" /></a> </figure> <p>5- New buttons appeared, selected <strong>“locate another python executable “</strong></p> <p>6- A new window opens, find the folder where there is the python 3 file in the virtual environment folder previously created <strong>/home/pi/ohmpi/bin/python3</strong>.</p> <p>7- In the <strong>known interpreter</strong> tab the path of the virtual environment should appear</p> <figure class="align-center"> <a class="reference internal image-reference" href="../../_images/thonny_interpreter_folder.jpg"><img alt="alternate text" src="../../_images/thonny_interpreter_folder.jpg" style="width: 600px; height: 450px;" /></a> </figure> <p>8- Close the window by clicking on <strong>ok</strong>.</p> <p>9- Close Thonny to save modifications</p> </section> </section> </div> </div> <footer> <hr/> <div role="contentinfo"> <p>&#169; Copyright 2022, the OhmPi Team..</p> </div> Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. </footer> </div> </div> </section>
211212213214215216217218219
</div> <script> jQuery(function () { SphinxRtdTheme.Navigation.enable(true); }); </script> </body> </html>