Home Elements Boards Recipes

SD Card Element

The SDElement uses the SPI bus to connect a SD card and makes the files available for reading and writing in the `/sd` folder.

There are 2 elements supporting SD cards in the Homeding library, supporting the 2 different available wirings:

Only one of these Elements can be activated at a time.

Both implementations enable using the SD card memory for storing files locally e.g. for recording sensor data or serving additional files on the web frontend.

The SD Element uses the system wide SPI bus for data transfer and is available on ESP8266 and ESP32 boards.

The pins that are used by the SPI bus in general can be configured in the Device Element.

Only the SPI Chip Select signal for the SD card has to be configured in the SD Element configuration.

Micro SD Card SPI Mode

Pin Description
1 Chip Select (CS)
2
3 SPI-MISO (Data in)
4 VDD
5 SPI-CLK
6 GND
7 SPI-MOSO (Data out)
8
9

Element Configuration

The following properties are available for configuration of the element:

csPin – this is the GPIO pin for the cs (chip select) signal of the sd card.

From the base element implementation the following properties are available for configuration:

title – Caption text for the element. Used by the element specific cards on the dash boards.

description – A line of text that gives a short description of the device used in the web UI.

room – The location of the device.

loglevel – This property holds the element specific log level. The default value is LOGGER_LEVEL_ERR == 1.

startup – This property can be used to start the element using a different initialization phase. Possible values are “sys”, “net”, “time”. See The Startup sequence.

Configuration Example

This example shows how to configure this element:

{ 
  "sd": {
    "0": {
      "cspin": "D4"
    }
  }
}

Element State

The following properties are available with the current values at runtime

active - Is set to true when the element is active.

Example State

{
  "sd/0": {
    "active":"true"
    ...
    "
  }
}

See Also

Tags

Element Wip