Unit 3: Configure and Connect the Raspberry Pi to EnOS


After setting up the Raspberry Pi, configure the Raspberry Pi before running the sample code.

Step 1: Install Libraries and cURL


  1. Update if necessary:

    pip3 install --upgrade setuptools
    
  2. Install enos-mqtt-sdk-python library:

    pip3 install enos-mqtt-sdk-python
    
  3. Install seeed-python-dht library:

    pip3 install seeed-python-dht
    
  4. Install grove:

    curl -sL https://github.com/Seeed-Studio/grove.py/raw/master/install.sh | sudo bash -s -
    
  5. If an error message “Check whether I2C enabled and Grove Base Hat RPi or Grove Base Hat RPi Zero inserted” is encountered, fix it with the below.

    • Give permissions to edit adc.py.

      sudo chmod 666 /usr/local/lib/python3.7/dist-packages/grove/adc.py
      
    • Locate and edit the adc.py file in /usr/local/lib/python3.7/dist-packages/grove.

    • At approximately line 57 in adc.py, change def __init__(self, address = 0x04) to def __init__(self, address = 0x08).

Step 2: Install Code to Connect to EnOS


  1. Download the code to connect to EnOS.

  2. Edit the code to enter the Group ID and Group Secret of the registration group.

    nano main.py
    
  3. The Device Provisioning Service will verify the device and register the device on EnOS. Once successfully registered, the device verification is passed from EnOS to the Device Provisioning Service and device information can be passed from the Device Provisioning Service back to the device.

Next Unit


Posting the Measurement Points to EnOS