Raspberry Pi Peripherals

Device Conn. / Type Interface
Temp. Sensor DS18B20 Chip 1 Wire Interface
MCP3008 10 Bit ADC Chip SPI Interface
Waveshare 1.8" LCD Using ST7735 Controller Chip SPI Interface
Ultraschall-Abstandssensor 4-pol. GPIO
Relais 1x 250V / 10 A Grove 4-pol. ???
Relais 2x 250V / 10 A 4-pol. GPIO
Temperature & Humidity Grove 4-pol. ???
Bodenfeuchtigkeit / Moisture Grove 4-pol. Analog

  • RaspBian Stretch: Enable Interface by running sudo raspi-config
  • Module w1_gpio is loaded automatically
  • Some other modules are loaded automatically if a well-known device is detected
  • GPIO4 / Pin 7 is used for 1 wire data
  • 3.3 V operation
  • Module w1_therm is loaded automatically if a DS18B20 compatible device is detected
  • Detected devices are listed below /sys/bus/w1/devices/
  • For each DS18B20 compatible device a link to a subdirectory is created with name 28-*, e.g. 28-03177144feff
  • The device subdirectory contains a text file w1_slave that returns the data read when the file is read
$ cat 28-0000092bd91e/w1_slave 
58 01 4b 46 7f ff 08 10 f9 : crc=f9 YES
58 01 4b 46 7f ff 08 10 f9 t=21500

where crc=.. YES incicates that the data CRC is OK, and t= is the temperature in 1/1000 °C


  • MOSI: Master Out Slave In (data output from master)
  • MISO: Master Master In Slave Out (data output from slave)
  • 2.7V - 5.5V operation
  • Connect to SPI0 with CS0 –> SPI0.0
  • Edit /boot/config.txt and add line dtoverlay=mcp3008:spi0-0-present.
    This loads module mcp320x, which also supports the MCP3008.
  • Once the module is loaded the device appears under /sys/bus/iio/devices/iio\:
  • Read channel 0: cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw


Pin Raspi GPIO Signal Cable Color
VCC +3.3 V Power Supply violet
GND GND Ground white
DIN MOSI green
CLK SCLK orange
CS SPI0 CS0 yellow
DC GPIO24 Command / Data blue
RST GPIO25 Reset black
BL +5V? red

sudo modinfo fbtft_device  # list module parameters

sudo modprobe fbtft_device name=sainsmart18 busnum=1    # Use SPI0 CS1 instead of SPI0 CS0
sudo modprobe fbtft_device name=sainsmart18 speed=16000000
sudo modprobe fbtft_device name=sainsmart18 speed=16000000 rotate=270


Martin Burnicki martin.burnicki@burnicki.net 2018-02-11

  • miscellaneous_tips/03_raspberry_pi/raspberry_pi_peripherals.txt
  • Zuletzt geändert: 2021-01-18 17:20
  • von