Our Arduino SPI Tutorial

This is a placeholder topic for “Our Arduino SPI Tutorial” comments.



SPI stands for Serial Peripheral Interface and it is a way to send data between microcontrollers and other small devices. It is a synchronous data bus, meaning it uses a clock to regulate the data transfer.
SPI is also Full-Duplex communication mean…

Read more

I really liked the idea of this little project. I ran into a problem though, I used the diagram rather than your table. In the diagram the IC latchpin is hooked up to Arduino Pin 9, but it’s Pin 10 in the table and in the sketch program.

It took me a while to work out what was wrong, but got it in the end. I now get a lovely binary count on my LEDs.

1 Like

Hey Steven!
That’s fantastic! Sorry about the pin mistake, I must’ve had a small oversight on drawing the sketch up in Fritzing, I’ll go ahead and fix this up for any future unsuspecting Makers. Thanks very much for the feedback!
Did you have any cool uses for the binary counter in mind? It’s certainly an interesting project!

Hi Aidan,

Thanks for the feedback. I’d love to build an 8 bit home brew computer at some point, but I’m just starting out, so really just trying to understand how to move data around and get it from serial to parallel, then back again. I’m sure I’ll find multiple situations where this technique will come in handy. It’s funny, solving the problem with the pin actually helped me understand what is going on, and will mean that I’m unlikely to forget the lesson learned.

PS. I found a great visualisation of what a shift register is actually doing on a University of Sydney web page (https://www.ee.usyd.edu.au/tutorials/digital_tutorial/part2/register03.html).

Steve

That sounds awesome; when you do decide to get your 8-Bit Brew going, feel free to share it with us on our Projects module! I know I’d love to see it (and likely whip one up).

Maybe I should’ve left the pin error in the tutorial, if it’s encouraging that type of critical thinking :stuck_out_tongue:

What a fantastic visualisation you linked too, it made the name “Shift Register” click together for me at least.

I would recommend for you to take a look at the I2C counterpart tutorial, there’s some great info for moving data within a circuit (and it only uses two connections :wink: )

Hey,

Sorry to bring this back up after 4 years, but using SPI can you use different shift registers (595 & 165) sharing the same clock / latch lines (obviously different data with MOSI/MISO) to save pins?

Im doing it on a teensy 4 but i assume the process is the same :slight_smile:

1 Like

Hey Dylan,

Yes, you should be able to perform that combination of the clock and latch line on a Teensy using the SPI protocol, and the process to set it up should be nearly identical. All the best with it!

Bryce
Core Electronics | Support

ohh excellent. Id read conflicting reports about the clock phases being out of sync :slight_smile: