PicorderOS

From Squared Wave
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

PicorderOS is written to support two specific variants of Picorder, though modification and customization is definitely possible and it is a goal that any sensor supported by PicorderOS can be used on any variant of Picorder.

TR-108 TR-109
Tr108.png Tr109.png
The TR-108 by default uses a Sensehat module and pygame to draw elements to screen using the composite or HDMI video connection. It is easily constructed of mostly off-the-shelf components. The TR-109 is designed to use a number of optional sensors and uses the SPI bus to address a small TFT LCD screen. It is almost entirely custom built and requires a 3D printer.

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

Things I'd like to add:

  • A real database module. Data analysis is a big part of the idea of a Tricorder. I haven't had a chance to learn it yet.

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
  • amg8833 - Supports the AMG8833 8x8 Pixel Thermal Camera
  • BME680 - Supports the BME680 Environmental Sensor IC
  • 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.