Skip to content

Instantly share code, notes, and snippets.

View raspberrytipsnl's full-sized avatar

raspberrytips.nl raspberrytipsnl

View GitHub Profile
@raspberrytipsnl
raspberrytipsnl / gyro.py
Last active August 18, 2023 01:37
MPU-6050 Gyroscoop + Accelerometer
#!/usr/bin/python
# Control MPU-6050 Gyroscoop + Accelerometer from Raspberry Pi
# https://raspberrytips.nl/mpu-6050-gyroscoop-raspberry-pi/
import smbus
import math
# Power management registers
power_mgmt_1 = 0x6b
@raspberrytipsnl
raspberrytipsnl / laser.py
Last active February 1, 2021 11:44
Laser module python script (Raspberry Pi)
#!/usr/bin/env python
# Control Lasermodule from Raspberry Pi
# https://raspberrytips.nl/laser-module-aansturen-via-gpio/
import RPi.GPIO as GPIO
import time
LaserGPIO = 17 # --> PIN11/GPIO17
@raspberrytipsnl
raspberrytipsnl / lirc_kpn_mediabox.conf
Created March 9, 2018 10:12
LIRC config KPN Mediabox (Arcadyan HMB2260, Motorola VIP 19xx, Arris VIP 29xx)
#
# Manufacturer: Motorola, Arcadyan, Arris
# Model: KPN Mediabox
#
# Keywords: lirc configuration, IR codes
# Remark: Should work the following devices: (often used by KPN and TELFORT)
#
# Arcadyan HMB2260
# Motorola VIP 1853
# Motorola VIP 1963
@raspberrytipsnl
raspberrytipsnl / ws2801ledstrip.py
Created March 19, 2017 13:43
WS2801 ledstrip demo
# https://raspberrytips.nl/ws2801-ledstrip/
# Simple demo script for a WS2801/SPI-like addressable RGB LED lightstrip.
import time
import RPi.GPIO as GPIO
import Adafruit_WS2801
import Adafruit_GPIO.SPI as SPI
# Configure the count of pixels:
PIXEL_COUNT = 32
@raspberrytipsnl
raspberrytipsnl / ds18b20.py
Created February 3, 2017 12:55
DS18B20 waterdichte temperatuur sensor aansluiten op Raspberry Pi
#!/usr/bin/env python
# DS18B20 waterdichte temperatuur sensor aansluiten op Raspberry Pi
# https://raspberrytips.nl/ds18b20-raspberry-pi/
import os
import glob
import time
os.system('modprobe w1-gpio')
@raspberrytipsnl
raspberrytipsnl / lcd20x4.py
Created April 11, 2017 09:50
LCD scherm 20×4 met behulp van I2C aansturen
#!/usr/bin/python
# https://raspberrytips.nl/lcd-scherm-20x4-i2c-raspberry-pi/
import sys
import smbus
import time
import datetime
import subprocess
I2C_ADDR = 0x3F # I2C device address
@raspberrytipsnl
raspberrytipsnl / lcdi2c.py
Created April 5, 2018 14:04
LCD scherm (16×2) via I2C backpack aansturen
#!/usr/bin/python
import smbus
import time
import datetime
I2C_ADDR = 0x27 # I2C device address
LCD_WIDTH = 16 # Maximum characters per line
# Define some device constants
@raspberrytipsnl
raspberrytipsnl / joystick.py
Created February 4, 2019 16:23
Analog Joystick / MCP3008 / Raspberry Pi
#!/usr/bin/python
import spidev
import time
import os
spi = spidev.SpiDev()
spi.open(0,0)
spi.max_speed_hz=1000000
@raspberrytipsnl
raspberrytipsnl / bmp180.py
Created February 3, 2019 12:03
BMP180 luchtdruk + temperatuur sensor (Raspberry Pi)
#!/usr/bin/python
# BMP180 luchtdruk + temperatuur sensor
# https://www.raspberrytips.nl
import smbus
import time
from ctypes import c_short
DEVICE = 0x77
@raspberrytipsnl
raspberrytipsnl / goodwe-lcd.py
Created August 25, 2018 14:50
Goodwe data LCD display
#!/usr/bin/python
# https://raspberrytips.nl/raspberry-pi-goodwe-zonnepaneel-omvormer/
# 25/08/2018 - Richard IJzermans
import sys
import smbus
import time
import datetime
import json