DEV Community

Ivan Delgado
Ivan Delgado

Posted on • Edited on

My Journey into Software Engineering #3: Exploring Raspberry Pi and SPI

It's been almost a week since my last post, and I'm excited to share the latest developments in my journey of learning embedded systems.

Project Update
My boss finally sent me the code for the project we're working on. The GUI user-interface is in Java, which I'm a bit rusty in, but I've programmed in Java before, so it shouldn't be too hard. Surprisingly, the rest of the code is primarily in Python. I expected it to be in C due to performance constraints, but since we're using a Raspberry Pi with a full Linux operating system, we can manage with Python. I plan to ask my boss if they've considered migrating to C for any performance reasons.

Raspberry Pi Setup
I ended up purchasing a Raspberry Pi 4 Model B since the code uses the RPi.GPIO library. I began by reviewing the documentation for this library and exploring its capabilities.

I learned about pull-up and pull-down resistors, which help avoid high impedance or floating values. When we press a button, we want a clear distinction between on/off, true/false, high/low. Without proper pull-up or pull-down resistors, floating values can create ambiguity.

Learning About SPI Protocol
Now, I’m diving into the Serial Peripheral Interface (SPI) communication protocol. So far, I understand that "Serial" means data is transferred sequentially, like when circuits are connected in series. "Peripheral" refers to devices controlled by another device, while "Interface" is the communication point between them.

The two devices are known as Master and Slave, where the Master can be a microcontroller or Raspberry Pi, and the Slave might be an ADC. SPI is a synchronous serial protocol with a clock line to keep communication synchronized. MOSI (Master Out Slave In) sends data from the Master to the Slave, while MISO (Master In Slave Out) sends data back to the Master. SPI allows one Master and multiple Slaves, requiring one chip select line for each peripheral.

Here’s a helpful video explaining this process: What is SPI? Serial Peripheral Interface.

I look forward to learning more about these concepts and applying them to the project.

Top comments (0)