All Projects β†’ linusg β†’ Rpi Backlight

linusg / Rpi Backlight

Licence: mit
πŸ”† A Python module for controlling power and brightness of the official Raspberry Pi 7" touch display

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Rpi Backlight

Python Progressbar
Progressbar 2 - A progress bar for Python 2 and Python 3 - "pip install progressbar2"
Stars: ✭ 682 (+258.95%)
Mutual labels:  cli, library, gui
Pi Apps
Raspberry Pi App Store for Open Source Projects
Stars: ✭ 277 (+45.79%)
Mutual labels:  raspberry-pi, raspbian, gui
Gooi
LΓ–VE GUI Library
Stars: ✭ 168 (-11.58%)
Mutual labels:  library, gui
Cloudexplorer
Cloud Explorer
Stars: ✭ 170 (-10.53%)
Mutual labels:  cli, gui
You Dont Need Gui
Stop relying on GUI; CLI **ROCKS**
Stars: ✭ 4,766 (+2408.42%)
Mutual labels:  cli, gui
Rpimotorlib
RpiMotorLib : Raspberry Pi Motor Library : A python 3 library for various motors and servos to connect to a raspberry pi
Stars: ✭ 156 (-17.89%)
Mutual labels:  raspberry-pi, library
Passw0rd
πŸ”‘securely checks a password to see if it has been previously exposed in a data breach
Stars: ✭ 159 (-16.32%)
Mutual labels:  cli, library
Live Stream Radio
24/7 live stream video radio station CLI / API πŸ“Ή πŸ“»
Stars: ✭ 175 (-7.89%)
Mutual labels:  cli, raspberry-pi
Rpi Display
2.8" TFT-Display with Touchpanel for all Raspberry Pi Models
Stars: ✭ 151 (-20.53%)
Mutual labels:  display, raspberry-pi
Wirehome.core
Wirehome.Core is a home automation system written in C# targeting .NET Core. It runs on Linux, Windows and macOS.
Stars: ✭ 180 (-5.26%)
Mutual labels:  raspberry-pi, raspbian
Piwheels
Python package repository providing wheels (pre-built binaries) for Raspberry Pi
Stars: ✭ 180 (-5.26%)
Mutual labels:  raspberry-pi, raspbian
Brightness Cli
Change the screen brightness
Stars: ✭ 182 (-4.21%)
Mutual labels:  cli, brightness
Degate
Open source software for chip reverse engineering.
Stars: ✭ 156 (-17.89%)
Mutual labels:  library, gui
Abandon
😌 Simple and Robust Accounting
Stars: ✭ 155 (-18.42%)
Mutual labels:  cli, gui
Bt
BitTorrent library and client with DHT, magnet links, encryption and more
Stars: ✭ 2,011 (+958.42%)
Mutual labels:  cli, library
Ofxgpio
Library C++ for raspberrypi and orangepi, GPIO interfaces compatible with openframeworks.
Stars: ✭ 155 (-18.42%)
Mutual labels:  raspberry-pi, library
Lunar
Intelligent adaptive brightness for your external monitors
Stars: ✭ 2,712 (+1327.37%)
Mutual labels:  display, brightness
Briarids
An All-In-One home intrusion detection system (IDS) solution for the Raspberry PI.
Stars: ✭ 187 (-1.58%)
Mutual labels:  raspberry-pi, raspbian
Pieman
Script for creating custom OS images for single-board computers
Stars: ✭ 149 (-21.58%)
Mutual labels:  raspberry-pi, raspbian
Envy
Envy automatically exposes environment variables for all of your Go flags
Stars: ✭ 150 (-21.05%)
Mutual labels:  cli, library

rpi-backlight

A Python module for controlling power and brightness of the official Raspberry Pi 7" touch display.

PyPI Python Version Downloads Documentation License Black Build Read the Docs Issues

Example

Note: This GIF was created using the old v1 API, so please don't use it as API reference πŸ™‚

Features

  • Set the display brightness smoothly or abrupt
  • Set the display power on or off
  • Get the current brightness
  • Get the display power state (on/off)
  • Command line interface
  • Graphical user interface

Requirements

  • A Raspberry Pi or ASUS Tinker Board including a correctly assembled 7" touch display v1.1 or higher (look on the display's circuit board to see its version) running a Linux-based OS
  • Python 3.5+
  • Optional: Raspberry Pi: pygobject for the GUI, already installed on a recent Raspbian
  • Optional: Tinker Board: gir1.2-gtk-3.0 for the GUI install

Installation

Install from PyPI:

$ pip3 install rpi-backlight

Note: Create this udev rule to update permissions, otherwise you'll have to run Python code, the GUI and CLI as root when changing the power or brightness:

$ echo 'SUBSYSTEM=="backlight",RUN+="/bin/chmod 666 /sys/class/backlight/%k/brightness /sys/class/backlight/%k/bl_power"' | sudo tee -a /etc/udev/rules.d/backlight-permissions.rules

Emulator

For testing without a physical display (e.g. on your main Linux/macOS/Windows machine) you can use linusg/rpi-backlight-emulator.

Usage

API

Example in a Python shell:

>>> from rpi_backlight import Backlight
>>>
>>> backlight = Backlight()
>>> backlight.brightness
100
>>> backlight.brightness = 50
>>> backlight.brightness
50
>>>
>>> with backlight.fade(duration=1):
...     backlight.brightness = 0
...
>>> backlight.fade_duration = 0.5
>>> # subsequent `backlight.brightness = x` will fade 500ms
>>>
>>> backlight.power
True
>>> backlight.power = False
>>> backlight.power
False
>>>

To use with ASUS Tinker Board:

>>> from rpi_backlight import Backlight, BoardType
>>>
>>> backlight = Backlight(board_type=BoardType.TINKER_BOARD)
>>> # continue like above

For more details see docs.

CLI

Open a terminal and run rpi-backlight.

$ rpi-backlight -b 100
$ rpi-backlight --set-brightness 20 --duration 1.5
$ rpi-backlight --get-brightness
20
$ rpi-backlight --get-power
on
$ rpi-backlight -p off
$ rpi-backlight --get-power
off
$ rpi-backlight --set-power off :emulator:
$ rpi-backlight -p toggle
$ rpi-backlight -p toggle -d 1.5
$

To use with ASUS Tinker Board:

$ rpi-backlight --board-type tinker-board ...

For all available options see docs.

GUI

Open a terminal and run rpi-backlight-gui.

Graphical User Interface Graphical User Interface (2)

Adding a shortcut to the LXDE panel

Panel result

See docs.

Tests

Tests use pytest, install with pip3 install pytest.

Now, run from the repository root directory:

$ python3 -m pytest

Contributing

Please free to open an issue for bug reports and to discuss new features - pull requests for new features or bug fixes are welcome as well!

License

The source code and all other files in this repository are licensed under the MIT license, so you can easily use it in your own projects. See LICENSE for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].