Skip to content

Raspberry Pi

Is a general-purpose computer that can runs Raspberry Pi OS among other things

GPIO

  • 505
  • Full GPIO Layout
  • Pinout on Raspberry 1 model B rev 2 and following are the same, save for the fewer pins.

I2C Development

I2C introduction

Setup

  1. Activate I2C in raspi-config
  2. Install sudo apt install i2c-tools and add current user to i2c group sudo adduser $USER i2c
  3. Reboot
  4. Test if I2C device is found sudo i2cdetect -y 1 Source

Usage

  • Programming I2C with Python
  • Use hexadecimal (start with 0xF) or binary (0b1111)
  • Setup
    1. sudo apt install python3-pip python3-smbus
    2. pip3 install smbus2
    3. Then usage: python from smbus2 import SMBus i2c_bus = SMBus(1) # Create a new I2C bus on bus 1 data_read = i2c_bus.read_i2c_block_data(I2C_ADDR, 0x0, 1) i2c_bus.write_i2c_block_data(I2C_ADDR, 0x0 , I2C_COMMAND)
  • Documentation:

Network

USB WLAN / Wi-Fi network interface

  • The EW-7811Un 802.11n Wireless Adapter is a Realtek RTL8188CUS
    • You need kmod-rtl8192cu in OpenWrt

Use the Raspberry Pi as a router, wireless access point, ...

  • Install OpenWrt, it's much more convenient
  • To use a tethered smartphone, install corresponding modules
    • To download them by hand, check the URLs in the "Software" page of the Open-WRT installation

SD Card

  • Migrate to smaller SD Card
    1. Backup
    2. Use a Linux host to resize the partition
    3. Make an image and restore it to target SD