Implementing the Luminosity Logger

Once the project has been configured, Go to Simuli Virtual Lab and start the Raspberry Pi instance we just created. Click on the Open button Under the instance name. A new tab with the built-in development environment opens up. On the left side, we have the code editor window along with the terminal at the bottom. On the right side, we have our Raspberry pi with the sensors below it.

Now go to the terminal and type the following commands to install pip, which is the python package manager.

sudo apt update
sudo apt-get install python3-pip

We need to install smbus and requests library which is required for the code to work so type the following commands in the terminal.

pip3 install smbus
pip3 install requests

The code for the project has been made available via GitHub. To get the code, we need to clone the repository into our instance. Type the following command in the terminal:

git clone https://github.com/simuli-lab/RaspberryPi-Luminous.git

All the required project files will now be cloned to a local folder with the same name. Let's change the working directory of the terminal to that folder.

cd RaspberryPi-Luminous

Open the logger.py file in the IDE by clicking on it in the File Explorer pane. Here replace <Deployment URL> with the url we got from the deployment of the app script.

url = '<Deployment URL>'

Now we are ready to run our program. Type the following command in the terminal. It will read the value once and post the value to the google sheet.

python3 logger.py

You have completed the Luminosity logger project. Now you can configure the project to input more than 1 sensor value and generate more complex graphs as per your requirements.

Last updated