Raspberry Pi
Is a general-purpose computer that can runs Raspberry Pi OS among other things
GPIO¶
- Full GPIO Layout
- Pinout on Raspberry 1 model B rev 2 and following are the same, save for the fewer pins.
I2C Development¶
Setup¶
- Activate I2C in
raspi-config
- Install
sudo apt install i2c-tools
and add current user to i2c groupsudo adduser $USER i2c
- Reboot
- 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
sudo apt install python3-pip python3-smbus
pip3 install smbus2
- 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 aRealtek RTL8188CUS
- You need
kmod-rtl8192cu
in OpenWrt
- You need
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
- Backup
- Use a Linux host to resize the partition
- Make an image and restore it to target SD