Difference between revisions of "PicorderOS"

From Squared Wave
Jump to: navigation, search
(Installation)
(23 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
===Variants===
 
===Variants===
  
[[File:Tr108.png|80px]]
+
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.
  
The TR-108 uses a sensehat module and pygame to draw elements to screen.
+
{|class="wikitable" style="text-align: center;"
 
+
|TR-108
 
+
|TR-109
 
+
|-
[[File:Tr109.png|60px]]
+
|[[File:Tr108.png|80px]]
 
+
|[[File:Tr109.png|60px]]
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.
+
|-
 +
|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===
 
===Basic Structure===
Line 30: Line 33:
  
 
==Notes==
 
==Notes==
To reduce power consumption:
+
Things I'd like to add:
* Only draw to screen when sensor reading has changed.
+
 
scale would be a factor for determining; different decimal places would trigger different refresh rates.
+
* 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==
 
==Download==
Line 43: Line 46:
 
PicorderOS uses a number of modules to operate, specifically:
 
PicorderOS uses a number of modules to operate, specifically:
  
* Pygame - Handles screen drawing and Luma.LCD emulation
+
* [https://www.pygame.org/news Pygame] - Handles screen drawing and Luma.LCD emulation
* Luma.LCD - Supports a number of displays.
+
* [https://pypi.org/project/luma.lcd/ Luma.LCD] - Supports a number of displays.
* Sensehat - For the TR-108 or any Picorder using a Sensehat
+
* [https://pythonhosted.org/sense-hat/ Sensehat] - For the TR-108 or any Picorder using a Sensehat
* RPi.GPIO - General IO
+
* [https://github.com/adafruit/Adafruit_CircuitPython_AMG88xx amg8833] - Supports the AMG8833 8x8 Pixel Thermal Camera
 +
* [https://github.com/pimoroni/bme680-python BME680] - Supports the BME680 Environmental Sensor IC
 +
* [https://pypi.org/project/RPi.GPIO/ RPi.GPIO] - General IO
 
* sys
 
* sys
 
* time
 
* time
Line 69: Line 74:
 
==Operation==
 
==Operation==
 
PicorderOS is run from main.py.
 
PicorderOS is run from main.py.
 +
 +
==Installation==
 +
PicorderOS depends on a number of python modules to function. Before the main loop can be run we need to install the dependencies.
 +
 +
Below is an experimental list of commands that are used to prepare a asRpberry Pi OS install.
 +
 +
<code>
 +
sudo apt-get update
 +
 +
sudo apt-get upgrade
 +
 +
pip3 install --upgrade psutil numpy luma.lcd luma.emulator adafruit-circuitpython-bme680 pandas colour adafruit-circuitpython-mpr121
 +
 +
sudo apt-get install libatlas-base-dev libsdl2-dev libopenjp2-7-de libtiff5
 +
</code>

Revision as of 16:10, 2 May 2021

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.

Installation

PicorderOS depends on a number of python modules to function. Before the main loop can be run we need to install the dependencies.

Below is an experimental list of commands that are used to prepare a asRpberry Pi OS install.

sudo apt-get update

sudo apt-get upgrade

pip3 install --upgrade psutil numpy luma.lcd luma.emulator adafruit-circuitpython-bme680 pandas colour adafruit-circuitpython-mpr121

sudo apt-get install libatlas-base-dev libsdl2-dev libopenjp2-7-de libtiff5