A Raspberry Pi Is A Hardware Hacker’s Swiss Army Knife

By now most of us have used a Raspberry Pi at some level or another. As a headless server it’s a great tool because of its price point, and as an interface to the outside world the GPIO pins are incredibly easy to access with a simple Python script. For anyone looking for guidance on using this device at a higher level, though, [Arun] recently created a how-to for using some of the Pi’s available communications protocols.

Intended to be a do-everything “poor man’s hardware hacking tool” as [Arun] claims, his instruction manual details all the ways that a Raspberry Pi can communicate with other devices using SPI and I2C, two of the most common methods of interacting with other hardware beyond simple relays. If you need to go deeper, the Pi can also be used as a full JTAG interface or SWD programmer for ARM chips. Naturally, UART serial is baked in. What more do you need?

As either a tool to keep in your toolbox for all the times you need to communicate with various pieces of hardware, or as a primer for understanding more intricate ways of using a Raspberry Pi to communicate with things like sensors or other computers, this is a great write-up. We also have more information about SPI if you’re curious as to how the protocol works.

Thanks to [Adrian] for the tip!

33 thoughts on “A Raspberry Pi Is A Hardware Hacker’s Swiss Army Knife

    1. Expect a pricetag to match (loadsamoney), which’ll stifle demand and keep prices high.
      Seems honestly like that’s over in “high speed FPGA linked to high-end ARM SoC” territory.

      1. I truly don’t understand why people think the Rpi is some extreme bargain that has managed to pack as much tech as humanly possible onto a board for 35 bucks. Almost every competitor out there has managed to make a higher performing board for the same price or less. usb 3 and sata aren’t exotic technology, and neither is a gigabit ethernet port either. For a company that claims they have sold 9 millions units, they should be able to significantly update the specs. I wouldn’t be surprised to see the rpi popularity fade as gpu support for these other boards make it into mainline.

    2. Orange Pi Lite2 has most of that, though development is early as the manufacturer didn’t do well with the release or the hardware design. Pretty fast for a $20 board, however. Armbian guys have been making efforts at mainlining and getting all of the features working.

    3. It’s called a Rock Pi 4. 1GB version starts off at $39.

      >At its heart is a 64-bit Rockchip RK3399 system-on-a-chip (SoC) which has a relatively beefy hexa-core design. There’s a quad-core 1.5GHz Cortex-A53 cluster combined with a dual-core 2GHz Cortex-A72 cluster in a big.LITTLE arrangement. There will be variants of the board available with either 1GB, 2GB or 4GB of LPDDR4 RAM.

      On the storage front, the Rock Pi 4 includes an M.2 connector with support for NVMe SSDs up to 2TB in size and eMMC up to 128GB. With respect the connectivity, the Rock Pi 4 has all bases covered with dual USB 3.0 ports, two USB 3.0 ports and even a USB-C port.

      1. Actually, I was looking at the Rockpro64 with a PCI slot. But Rock Pi 4 looks good, too.
        There’s a limit to GPIO pins in Raspberry Pi configuration, which was the point of my original comment.

          1. perl is the swiss army three legged dog…

            but back to the main point – the pi is just a small pc – so if you need a small pc it’s great. But the 8266/esp32 can be used in way more ways than just beign a pc….

          1. For me all folding knives without any blade lock are unusable. So I carry big folder, big Victorinox, Wera Toolcheck Plus, tweezers, side cutters Little wrench and pliers. ;)
            Also Brymen BM867S, Raspberry Pi3B in case.
            I need Soldering iron similar to TS100, because now I carry ZD916 with me and it’s little bit cumbersome. ;P
            That’s my minimalist mobile hacking setup ;)

    1. As much as I like the ESPs, is there JTAG / SWD firmware for them? Transparent I2C or SPI bridge? Datalogger with X GB of storage without having to think about it?

      If I want to write a quick test suite to make sure all the devices on an I2C bus are working, is it quicker to write in Python on a Pi, or “from scratch” on the ESP32?

      Maybe it’s a waste of resources to treat a Pi like a mega-Bus-Pirate, but it’s hard to deny the utility of doing so, IMO.

      If I were stranded on a desert island with one debugging tool…

      1. >If I were stranded on a desert island with one debugging tool…

        I think you would rather that you have a Swiss army knife there. :P Software especially open source can be ported. Whether or not there are any motivation or skills are the questions.

        RPi is more like a Swiss army hammer. Everything looks like a nail when you have a hammer.

  1. The EspressoBin (with a Marvell ARM chip like the pogoplug, but a bit more modern) has documentation for how to set it up as a PCIe endpoint, which seems like a good start to doing some PCIe hacking: http://wiki.espressobin.net/tiki-index.php?page=Enabling+ESPRESSObin+board+as+PCIe+Endpoint

    But I don’t know if that setup is then supported by Linux’s PCIe endpoint framework (https://github.com/torvalds/linux/blob/master/Documentation/PCI/endpoint/pci-endpoint.txt).

  2. This isn’t exactly the same but a great hacking platform none the less with amazing expansion capabilities. Here is a walk through on just one way you can use the PI as an HID that you can control over the PI’s own wifi.

  3. Micropython on an ESP32 is great. Talking over the I2C/SPI buses or other buses using the REPL one command at a time is a great way to probe the buses and extract all kinds of useful information without even having to compile a program!

  4. Talking about REPL, I personally reach for some “Espruino” boards ( stm32fXxx nRF82Xx, .. ) whenever I need to quickly hack something up – feels like browser dev console for uCs – it seems to lessen the time it takes to get a poc of stg.
    Ex: I recently dumped & flashed eeprom from a cheap hdmi dongle in a breeze :)
    this being said, no i2c nor spi ‘slave’ mode currently supported, ( like the rpi if I recall correctly .. ), so whenever nedding such things, I’d go for a good old avr :), but you can go for embed C or native stuff +wrappers if needing speed or more ( I personally didn’t digg that enough yet :/ .. )
    For the rpi, a zero appearing as usb gadget is very handy to have & less cumbersome to have in a pocket ;)

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.