PicorderOS

From Squared Wave
Revision as of 20:38, 16 July 2020 by Directive0 (Talk | contribs)

Jump to: navigation, search
Logo for the PicorderOS project

PicorderOS is a Python based set of modules that provides a quick and easy way to use a Raspberry Pi as a handheld sensing device. The real goal of PicorderOS is not just to operate my various Picorder projects as a monolithic entity but to work as a set of modules that the user can enable and disable at will.

By design it will support a wide range of arbitrary selected sensors, displays and form factors. Development is proceeding simultaneously on all elements.


Variants

Tr108.png

The TR-108 uses a sensehat module and pygame to draw elements to screen.


Tr109.png

The TR-109 comes in two flavours (BW and Color) and uses several sensors all brought together under one module. It is the most complex variant of the picorder.

Basic Structure

PicorderOS diagram.png

Objects

The Objects module contains some basic functions that are shared by many elements of the program. Most importantly it contains the "configuration" object that holds settings for the program. The user can edit this file to change settings quickly.

Main

PicorderOS's basic functional structure starts with the Main module. Main creates and directs all the elements necessary for a picorder session and directs the flow of information to and from each element.

Sensor

The sensor object is different depending on the physical sensors present. While the means of pulling sensor data may be different between different sensor types the purpose of the sensor object is to pull each value from the sensor and prepare it into a *sensor fragment*. Sensor fragments are lists (sort of like arrays) that contain the most recent sensor value and information for the program to put that value in context like the upper and lower possible ranges of the senor, the unit, symbol, and the name of the item itself. Many parts of the program will need to access this information so it is important for these elements to be available. Any sensor data can be accessed by PicorderOS so long as it follows these standards.

Notes

To reduce power consumption:

  • Only draw to screen when sensor reading has changed.

scale would be a factor for determining; different decimal places would trigger different refresh rates.

Download

https://github.com/directive0/picorder2

Installation

PicorderOS requires quite a few python libraries to work.

Requirements:

PicorderOS uses a number of modules to operate, specifically:

  • Pygame - Handles screen drawing and Luma.LCD emulation
  • Luma.LCD - Supports a number of displays.
  • Sensehat - For the TR-108 or any Picorder using a Sensehat
  • RPi.GPIO - General IO
  • sys
  • time
  • math
  • os
  • psutil -for PC stats

Be sure you have these modules installed before attempting to run the main module.

Open a terminal and follow the next instructions:

  • We must first enable SPI and I2C for sensor and display communications.
    • Open Raspi Config sudo raspi-config
    • Select "Interfacing Options" (Item 5)
    • Scroll down to SPI and when prompted enable it following the onscreen dialogue
    • Do the same for I2C
  • Ensure you have Python3 and Pip3 installed (should already be there on Raspbian) sudo apt-get install python3-pip python3-dev
  • Install Sensor Libraries
  • Install luma.lcd for the displays sudo pip3 install luma.lcd

Operation

PicorderOS is run from main.py.