Hardware Reference
In-Depth Information
Figure 16-3:
he Hall efect
sensors in the
AS5040.
Enter the Arduino
Now there is one snag with using the Raspberry Pi running Linux with this project, and that
is the data from the pendulums is coming out in a constant stream, and, as you know, Linux
has a habit of popping out for a cup of tea every now and again. If you were to let this hap-
pen, you would have discontinuities in the data, and subsequently, the pattern would look
broken up. his is where the Raspberry Pi could do with a little help in reading the data from
the sensor, and putting it in a queue or bufer so the Python code can take it out and plot it,
without having to worry about when that code is suspended while Linux is doing housekeep-
ing. So here is where the Arduino comes in.
he Arduino is a very popular embedded processor, similar in some respects to the one in the
Raspberry Pi. However, it is much, much slower, and has a very small amount of memory -
but the Arduino has the advantage of not running an operating system at all. his means
that if you program it to do one thing it does it without interruption at a regular rate. What
you are going to do is use the Arduino to gather the data from the pendulums, do a bit of
processing on it and then send it into the USB serial bufer of the Raspberry Pi. hen this
bufer is emptied by the Python program, and the points are plotted on the screen.
he Arduino is programmed in C++, but anyone with any experience in C will be able to write
a program for it straight of. It is designed to be used by beginners and nontechnical art
users, so it is quite easy to use. It comes with its own integrated development environment
(IDE) which is a multiplatform program, and you can run it on the Raspberry Pi, on a laptop
Search WWH ::




Custom Search