jiachengng
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Installation Guide for Smart Weighing Scale ## CONFIGURE PROJECT DEPENDENCIES ON THE RASPBERRY PI By: Team 07 Based on [pyimagesearch](https://www.pyimagesearch.com/2019/04/08/openvino-opencv-and-movidius-ncs-on-the-raspberry-pi/) ## 10 STEPS TO INSTALL & CONFIGURE OPENVINO ON RASPBERRY PI ### Step 1: Install Raspberry Pi <div style="text-align: justify"> Download Raspberry Pi (OS with desktop and recommended software) <a href="https://ibb.co/Lx4wTV6"><img src="https://i.ibb.co/tqyf0Vc/1.png" alt="1" border="0"></a> From there, use [balenaEtcher](https://www.balena.io/etcher/) (or a suitable alternative) to flash the card. Once you’re ready, insert the microSD card into your Raspberry Pi and boot it up. Enter your WIFI credentials and enable SSH, VNC, and the camera interface. From here you will need one of the following: - Physical access to your Raspberry Pi so that you can open up a terminal and execute commands - Remote access via SSH or VNC </div> <br> ### Step 2: Expand filesystem on your Raspberry Pi <div style="text-align: justify"> To check your disk space usage, execute the following command in your terminal: - df-h If there is enough available disk space, proceed to open the raspberry pi configuration in your terminal Enter the command in the terminal: - sudo raspi-config Select the "**Advanced Options**" menu item Followed by selecting "**Expand filesystem**" and hit Enter on your keyboard, arrow down to the "**<Finish>**" button Reboot your Pi Run the following command again to check that your file system is expanded: - df -h </div> <br> ### Step 3: Reclaim space on your Raspberry Pi <div style="text-align: justify"> To get more space on your Raspberry Pi, delete both <b>LibreOffice</b> and <b>Wolfram engine</b> to free up some space. The command line to uninstall the application are as followed: - sudo apt-get purge wolfram-engine - sudo apt-get purge libreoffice* - sudo apt-get clean - sudo apt-get autoremove After removing the **Wolfram Negine** and **LibreOffice**, you can reclaim almost 1GB. </div> <br> ### Step 4: Install OpenVino + OpenCV dependencies on your Pi <div style="text-align: justify"> Enter the command in the terminal to update the raspberry pi’s system: - sudo apt-get update && sudo apt-get upgrade Then install the developer tools including CMake with the command: - sudo apt-get install build-essential cmake unzip pkg-config Next, install a selection of image and video libraries with the following command: - sudo apt-get install libjpeg-dev libpng-dev libtiff-dev - sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev - sudo apt-get install libxvidcore-dev libx264-dev Next install GTK for GUI backend: - sudo apt-get install libgtk-3-dev Install a package which may help to reduce GTK warnings: - sudo apt-get install libcanberra-gtk* <b>Asterisk ensures we will grab the ARM-specific GTK</b> Now we need two packages which contain numerical optimizations for OpenCV </div> <br> ### Step 5: Download and unpack OpenVINO in your Raspberry Pi <div style="text-align: justify"> Navigate to home folder and create a new directory with the command: - cd~ Grab the OpenVINO Toolkit via wget with the following commands: - wget https://download.01.org/opencv/2020/openvinotoolkit/2020.1/l_openvino_toolkit_runtime_raspbian_p_ Grab the OpenVINO Toolkit via wget with the following commands: - tar -xf l_openvino_toolkit_runtime_raspbian_p_2020.1.023.tgz - mv l_openvino_toolkit_runtime_raspbian_p_2020.1.023 openvino </div> <br> ### Step 6: Configure OpenVINO on your Raspberry Pi <div style="text-align: justify"> Add a line to load OpenVino’s setupvars.sh each time you invoke a Pi terminal - nano ~/.bashrc Scroll to the bottom of the file and add the following lines: - source ~/openvino/bin/setupvars.sh Save and exit from the nano text editor Then go ahead and source your ~/.bashrc file: - source ~/.bashrc </div> <br> ### Step 7: Configure USB rules for your Movidius NCS and OpenVINO on Raspberry Pi <div style="text-align: justify"> Enter the following command to add the current user to the Raspbian “users” - sudo usermod -a -G users “$(whoami)” Log out and log back in. If on SSH, type exit and then re-establish your SSH connection. Rebooting is also an option: - sudo reboot now Once you’re back at the terminal, run the following script to set the USB rules: - cd ~ - sh openvino/install_dependencies/install_NCS_udev_rules.sh </div> <br> ### Step 8: Create an OpenVINO virtual environment on Raspberry Pi <div style="text-align: justify"> Install pip, a Python Package Manager. To install pip, simply enter  - wget https://bootstrap.pypa.io/get-pip.py - sudo python3 get-pip.py To install virtualenv and virtualenvwrapper - sudo pip install virtualenv virtualenvwrapper - sudo rm -rf ~/get-pip.py ~/.cache/pip Update ~/.bashrc - nano ~/.bashrc - export WORKON_HOME=$HOME/.virtualenvs - export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 nano - source /usr/local/bin/virtualenvwrapper.sh - VIRTUALENVWRAPPER_ENV_BIN_DIR=bin <a href="https://ibb.co/qDW9hBg"><img src="https://i.ibb.co/BfrjvL6/2.png" alt="2" border="0"></a> Alternatively, you can append the lines directly via bash commands: - echo -e "\n# virtualenv and virtualenvwrapper" >> ~/.bashrc - echo "export WORKON_HOME=$HOME/.virtualenvs" >> ~/.bashrc - echo "export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3" >> ~/.bashrc - echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc - echo "VIRTUALENVWRAPPER_ENV_BIN_DIR=bin" >> ~/.bashrc Source the ~/.basrc profile - source ~/.bashrc Create a virtual environment to hold OpenVINO, OpenCV and related packages: - mkvirtualenv openvino -p python3 </div> <br> ### Step 9: Install Packages into your OpenVINO environment  <div style="text-align: justify"> We would need to install a handful of packages required. They are only available in the openvino environment - workon openvino - pip install numpy - pip install "picamera[array]" - pip install imutils </div> <br> ### Step 10: Test your OpenVINO install on your Raspberry Pi   <div style="text-align: justify"> The first command activates our OpenVINO virtual environment. - workon openvino The second command sets up the Movidus NCS with OpenVINO and is very important. - source ~/openvino/bin/setupvars.sh From there we will fire up the Python 3 binary in the environment and import OpenCV. - python - import cv2 - cv2.__version__ - '4.2.0-openvino' - exit() </div> <br> ## 1 STEP TO CONFIGURE MQTT ### Step 1: Pip install dependencies for MQTT  <div style="text-align: justify"> We will create the necessary dependencies for MQTT - pip3 install tb-mqtt-client </div> <br> ## 3 STEPS TO START SCRIPT FOR FRUIT/VEGETABLE RECOGNITION ### Step 1: Navigate to the directory that contains classify_ncs_realtime.py <div style="text-align: justify"> The folder that has the classify_ncs_realtime.py file - cd Desktop/fruit-ml </div> <br> ### Step 2: Setting OpenVINO-OpenCV path by executing the following command <div style="text-align: justify"> Run the openvino setup for the movidus NCS stick - source ~/openvino/bin/setupvars.sh </div> <br> ### Step 3: Run the script classify_ncs_realtime.py <div style="text-align: justify"> Run the file and pass in the config filepath - python classify_ncs_realtime.py --conf config/config.json </div> <br> ## 3 STEPS TO CONNECTING RASPBERRY PI TO WEIGHING SCALE ### Step 1: Connect RS232 to Digital Weighing Scale <div style="text-align: justify"> - Connect the RS232 end to the digital weighing scale as shown below: <a href="https://imgbb.com/"><img src="https://i.ibb.co/NTqskBF/4.png" alt="4" border="0"></a> </div> <br> ### Step 2: Connect USB to Digital Weighing Scale <div style="text-align: justify"> - Connect the USB end to the Raspberry PI as shown below: <a href="https://imgbb.com/"><img src="https://i.ibb.co/wRdVRKn/5.png" alt="5" border="0"></a> </div> <br> ### Step 3: Start up Digital Weighing Scale <div style="text-align: justify"> - Power up the Weighing Scale as shown below: <a href="https://imgbb.com/"><img src="https://i.ibb.co/NCkCvMg/6.png" alt="6" border="0"></a> </div> <br> ## 2 STEPS TO CONFIGURE RS232 TO USB PORT NUMBER ### Step 1: Locating file for port number <div style="text-align: justify"> To identify your port number, open file explorer and navigate to the following: - File Explorer -> /dev Scroll down to locate the file for port number - ttyUSB? (? = 0, 1, 2, 3 [depending on which port you inserted the cable] - e.g. ttyUSB0, ttyUSB1, ttyUSB2, ttyUSB3 </div> <br> ### Step 2: Edit and configure port number <div style="text-align: justify"> Open the file weigh_tb.py At line no. 8, locate the following: - ser = serial.Serial(‘/dev/ttyUSB0’) Change the line of code according to the port number identified at Step 1 </div> <br> ## 2 STEPS TO CONFIGURE AND START WEIGHING SCALE SCRIPT ### Step 1: Install Dependencies for Digital Weighing Scale <div style="text-align: justify"> We will create the necessary dependencies for the weighing scale. Open the terminal window, enter the following command: - pip3 install pyserial </div> <br> ### Step 2: Start the python script for Weighing Scale <div style="text-align: justify"> Using the same terminal window, enter the following command: - python3 weigh_tb.py </div> <br> ## 3 STEPS TO CONFIGURE THE RC522 RFID MODULE <div style="text-align: justify"> ### Step 1: Connect the RC522 RFID Module to the Raspberry Pi Follow the schematic diagram to connect the RFID Module: <a href="https://ibb.co/HDBTvRq"><img src="https://i.ibb.co/gMmZ1QJ/3.png" alt="3" border="0"></a> ### Step 2: Enable SPI (Serial Peripheral Interface) Serial Peripheral Interface is required for the RC522 RFID Module. Run the following command in the terminal: - sudo raspi-config - Navigate to <b>"5 Interfacing Options"</b> using the arrow keys and press Enter. - Select <b>Yes</b> when prompted whether to enable the SPI Interface. - Navigate to <b>"P4 SPI"</b> using the arrow keys and press Enter. - When prompted, <b>reboot the Raspberry Pi</b>. ### Step 3: Pip install dependencies for RFID MODULE We will create the necessary dependencies for the RFID Module. Run the following command in the terminal: - sudo apt-get install python3-dev python3-pip - sudo pip3 install spidev - sudo pip3 install mfrc52 </div> ## 1 STEPS TO START RFID SCRIPT ### Step 1: Navigate to the directory that contains the rfid_reader_realtime.py <div style="text-align: justify"> - python3 rfid_reader_realtime.py </div>

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully