-1

I have some development boards like the FiPy with Expansion Board, mainly to experiment with programming on the processor, but it would be interesting to connect some peripherals (by wire, not wireless) like cameras and sensors for motion, temperature, sound, etc. Is there a guide to generic peripherals that would help me understand what kind of wired connections are possible on these various boards? It's fairly easy to get info about a Raspberry Pi or an Arduino, but I'm not using those boards. I'm a total newbie to IoT, though I've been programming on ordinary desktops for many decades. How can I learn the basics of wiring generic peripherals to an IoT dev board?

5
  • 1
    it should be the same as an Arduino or RPi ... just make certain that the voltage levels are acceptable to the microcontroller ... you have to watch voltage levels with any microcontroller
    – jsotola
    Oct 14 '21 at 23:56
  • That doesn't seem to work out because the RPi has a port for a 15-pin ribbon cable (image here) and the FiPy does not. Oct 15 '21 at 18:50
  • 1
    that's just that particular camera ... your requirement was nothing specific ... cameras and sensors for motion, temperature, sound, etc
    – jsotola
    Oct 15 '21 at 20:38
  • The whole reason for my question is to find exactly that kind of information. Now I know that some cameras can be used with an RPi and a FiPy, and some cameras can only be used on an RPi (which directly contradicts your first comment). I didn't know this fact about IoT cameras yesterday, now I do. But I learned it on the resource hub (see answer), not from this little discussion. Oct 15 '21 at 23:33
  • 1
    that is why this site should be the last resort, after you have done extensive research on your own
    – jsotola
    Oct 16 '21 at 0:05
2

There are quite a number of possible interfaces for sensors and other peripherals. Some exist on nearly all platforms (possibly with a few differences), others are less common.

  • UART is probably the simplest. It also know as “serial port” or “RS232” (though this is nearly universally an abuse of language). It involves at the bare minimum one wire in each direction (TXD from one device connected to RXD of the other and vice versa, though sometimes peripherals will have pins labelled with the corresponding pin on the MCU). You’ll also need a reference ground, and there’s often a power line as well.

    UART is an asynchronous serial port. Data is sent as characters, which are framed with a start bit and a stop bit. Common speeds are 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 bits per second, though higher speeds can be found.

    Some devices will also have flow control pins (RTS/CTS and the like) but this is becoming quite rare.

    Either device can send data at any time.

    One important issue here (it may also be present on other interfaces, but is more often an issue for UART) is that not everybody uses the same voltages. Most common are 5V and 3.3V, but you can probably still find a few others. You may need voltage level adapters (you don’t want to send 5V to a 3.3V device, and vice versa, though. It for the same reasons). Some devices are “tolerant”, others not at all.

  • SPI is very common in the microcontroller world. It’s a synchronous point to point serial interface. Like UART, there’s one wire in each direction (MOSI and MISO, master out to slave in and vice versa), but there’s also a separate wire for the clock (SCLK), which allows speeds in hundreds of kilobits or megabits per second. There’s also often a “chip select” pin (CS) which allows several peripherals to share the same SPI interface on the MCU (one at a time, though): they will share SCLK, MOSI and MISO, but will each have a different CS on the MCU. One device (the MCU) is the master, the other is the slave.

    As usual, there’s usually also a common ground pin, and often a power supply pin.

    There are high speed versions of SPI using more pins like QSPI.

  • I2C is a bus, on which you can have multiple devices. There are only two “signal” wires (taken loosely), SDA, which is the actual data, and SCL, which is the clock. As usual, often complemented by ground and power.

    There’s one master (the MCU) and one or more slaves (peripherals). Each slave has an address, and all commands from the master include the address of the slave it wants to talk to. Some devices have a fixed address, others can be configured either via pins (you’ll usually have a limited choice of 2, 4 or 8 different addresses) or more rarely by software. Some devices have a single fixed address but can be ordered with different addresses.

  • Digital pins are used for peripherals which deliver or need a simple on/off signal.

  • Analog pins are used for devices which deliver or need a variable voltage (e.g. voltage is proportional to temperature or distance). They are connected to an ADC (Analog to Digital Converter, for inputs) or DAC (I’ll let you guess, for outputs), which convert a variable voltage to/from a digital value.

  • CSI is a special interface for cameras. It is available on many ARM-based SOCs like the RPi Broadcom chip or other ARM-based chips (Allwinner, Rockchip, etc.). Not common on lower-power MCUs like the ESP32.

  • Likewise, DSI is for high resolution displays, and the same kind of limits apply. You can also find LVDS, HDMI, DP, eDP…

Most MCUs, including the ESP32 on the FiPy, will include several UART, SPI, I2C, ADC and/or DAC ports, which can often be assigned to different pins. There are sometimes limits on which pins can do what, and of course a given pin can only be used for one function at a time. Different chips have different numbers of ports (for instance they may have 1, 2 or 3 UARTs), and have different numbers of available pins.

On a board like the FiPy, many pins of the ESP32 are already used to connect the various peripherals on the board itself (LoRa/SigFox modem, cellular modem, LED, flash). The expansion board uses a few more (for the SD card, the PIC which acts as a serial/USB converter…). The final choice is often quite limited.

Many types of devices exist in many different forms with varying interfaces. Which ones to use will depend on the combination of peripherals you need and what interfaces they are available with.

You’ll often find devices using “standard” interface ports like Grove (from Seeedstudio, also many M5stack devices and a few others), Qwiiic/Stemma QT (Sparkfun/Adafruit) or UEXT (Olimex). The first one at least is tricky, because it used the same physical interface, but may have different logical/electrical interfaces, either UART, SPI, I2C, digital or analog. I think the same applies to Qwiic/Stemma QT, though I’m not sure. They may also have different voltages (3.3V or 5V), though many devices have the necessary logic to support both. UEXT carries multiple interfaces on the same port, but they use different pins.

0

So far I'm finding good answers in the MicroKit Resource Hub (U.C. Berkeley). It explains the basics of all the generic parts on a typical dev board, and gives simple-yet-complete steps to configure and connect a variety of interesting peripherals that are easy to get online.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.