Controlling hardware SPI on Raspberry Pi using Python

Raspberry Pi has an I/O header available for many interesting hacks. In other hand a Python is a great scripting/programming language that allows programming things pretty quickly. So it is always nice to have a good arsenal of tools around when you need. Louis shares his findings and experiments on how to access hardware SPI on Raspberry Pi through Python. The way he does it is that he uses C extensions to Python.

Controlling hardware SPI on Raspberry Pi using Python

The fact is that there is already a hardware SPI library written in C. All you need is to access it from python. C Extension in python gives access to functions from C based module. A minor tweak is required [More about extending Python with C]. Once you get simple SPI echoing working there is a simple Arduino sketch that allows testing hardware SPI functionality. Don’t forget that Raspberry Pi runs at 3.3V while Arduino may be 5V based. In such case you might want to use a signal level converter.

Read

Bookmark the permalink.
Add Comment Register



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>