|
| 1 | +.. _adafruit_8chan_solenoid: |
| 2 | + |
| 3 | +Adafruit I2C to 8 Channel Solenoid Driver Shield |
| 4 | +################################################ |
| 5 | + |
| 6 | +Overview |
| 7 | +******** |
| 8 | + |
| 9 | +The `Adafruit I2C to 8 Channel Solenoid Driver Shield`_ features |
| 10 | +a `Microchip MCP23017 GPIO expander`_, eight MOSFETs and two STEMMA QT connectors. |
| 11 | + |
| 12 | +.. figure:: adafruit_8chan_solenoid.webp |
| 13 | + :align: center |
| 14 | + :alt: Adafruit 8 Channel Solenoid Driver Shield |
| 15 | + |
| 16 | + Adafruit 8 Channel Solenoid Driver Shield (Credit: Adafruit) |
| 17 | + |
| 18 | +There are indication LEDs for each output channel. Note that the solenoid power supply |
| 19 | +must be connected for these LEDs to work. |
| 20 | + |
| 21 | + |
| 22 | +Requirements |
| 23 | +************ |
| 24 | + |
| 25 | +This shield can be used with boards which provide an I2C connector, for example STEMMA QT |
| 26 | +or Qwiic connectors. The target board must define a ``zephyr_i2c`` node label. |
| 27 | +See :ref:`shields` for more details. |
| 28 | + |
| 29 | + |
| 30 | +Pin Assignments |
| 31 | +=============== |
| 32 | + |
| 33 | ++--------------+--------------------------------+ |
| 34 | +| Shield Pin | Function | |
| 35 | ++==============+================================+ |
| 36 | +| SDA | MCP23017 I2C SDA | |
| 37 | ++--------------+--------------------------------+ |
| 38 | +| SCL | MCP23017 I2C SCL | |
| 39 | ++--------------+--------------------------------+ |
| 40 | +| INT | MCP23017 interrupt out | |
| 41 | ++--------------+--------------------------------+ |
| 42 | +| A0 - A2 | MCP23017 I2C address selection | |
| 43 | ++--------------+--------------------------------+ |
| 44 | + |
| 45 | +The SDA and SCL signals are also available in the two STEMMA QT connectors. |
| 46 | + |
| 47 | +In order to use interrupts you need to connect a separate wire from the shield to a GPIO pin |
| 48 | +on your microcontroller board. See :dtcompatible:`microchip,mcp23017` for documentation on |
| 49 | +how to adjust the devicetree overlay file. |
| 50 | + |
| 51 | +By default are the I2C address selection pins pulled down to GND, resulting in a |
| 52 | +7-bit I2C address of 0x20. Remember to modify the devicetree overlay file if you change |
| 53 | +the address. |
| 54 | + |
| 55 | + |
| 56 | +Programming |
| 57 | +*********** |
| 58 | + |
| 59 | +Set ``--shield adafruit_8chan_solenoid`` when you invoke ``west build``. For example |
| 60 | +when running the :zephyr:code-sample:`sensor_shell` sample: |
| 61 | + |
| 62 | +.. zephyr-app-commands:: |
| 63 | + :zephyr-app: samples/sensor/sensor_shell |
| 64 | + :board: adafruit_qt_py_rp2040 |
| 65 | + :shield: adafruit_8chan_solenoid |
| 66 | + :gen-args: -DCONFIG_GPIO=y -DCONFIG_GPIO_SHELL=y -DCONFIG_I2C=y |
| 67 | + :goals: build |
| 68 | + |
| 69 | +To configure and turn on solenoid 0 (label A0 on board backside): |
| 70 | + |
| 71 | +.. code-block:: shell |
| 72 | +
|
| 73 | + gpio conf mcp23017_adafruit_8chan_solenoid 0 o |
| 74 | + gpio set mcp23017_adafruit_8chan_solenoid 0 1 |
| 75 | +
|
| 76 | +Turn off the solenoid: |
| 77 | + |
| 78 | +.. code-block:: shell |
| 79 | +
|
| 80 | + gpio set mcp23017_adafruit_8chan_solenoid 0 0 |
| 81 | +
|
| 82 | +Use pin B0 as an output, and set it high: |
| 83 | + |
| 84 | +.. code-block:: shell |
| 85 | +
|
| 86 | + gpio conf mcp23017_adafruit_8chan_solenoid 8 o |
| 87 | + gpio set mcp23017_adafruit_8chan_solenoid 8 1 |
| 88 | +
|
| 89 | +Set it low: |
| 90 | + |
| 91 | +.. code-block:: shell |
| 92 | +
|
| 93 | + gpio set mcp23017_adafruit_8chan_solenoid 8 0 |
| 94 | +
|
| 95 | +Use pin B0 as an input with pullup: |
| 96 | + |
| 97 | +.. code-block:: shell |
| 98 | +
|
| 99 | + gpio conf mcp23017_adafruit_8chan_solenoid 8 iu |
| 100 | + gpio get mcp23017_adafruit_8chan_solenoid 8 |
| 101 | +
|
| 102 | +
|
| 103 | +.. _Adafruit I2C to 8 Channel Solenoid Driver Shield: |
| 104 | + https://learn.adafruit.com/adafruit-i2c-to-8-channel-solenoid-driver |
| 105 | + |
| 106 | +.. _Microchip MCP23017 GPIO expander: |
| 107 | + https://www.microchip.com/en-us/product/mcp23017 |
0 commit comments