Use an Arduino Uno as an accessory to a Raspberry Pi.
This exercise assumes you have the basic Raspberry Pi materials as specified in 1.c.iv.1, as well as the following materials:
The Raspberry Pi GPIO interface is great for easy and fast interfacing to individual digital I/O lines and SPI and I2C busses. However, there are still circumstances under which using an Arduino makes sense. Even though the Raspberry Pi is much, much faster than an Arduino, Linux is not a real time system and so other processes can interfere with the precise timing of your program. And many devices have exising libraries for the Arduino, so the fastest way to test a part can be to use the existing Arduino code but transmit the data to and from the Raspberry Pi for display and further processing.
Some specific rationale for using the Arduino/Pi combination would be a project requiring features compelling both an Arduino and a Pi:
Requirements motivating a Raspberry Pi: networking, graphics, audio signal processing, machine learning, databases, data logging, machine vision, extensive numerical computations, use of Python or Pure Data, libraries available under Linux, transferring an existing Pure Data patch into embedded form.
Requirements motivating an Arduino: simple analog input, rapid start-up (e.g. no boot time), existing hardware device libraries, tight signal timing requirements, fast digital pattern generation such as for driving a stepper motor.
With enough work, many of these Arduino requirements can be satisfied with just a Pi and additional hardware such as an external ADC, but may require porting device libraries. The timing can be improved by adjusting Linux process priorities and disabling unneeded services.
But a short startup time is the hardest requirement to overcome with the Pi by itself. So for example, a sophisticated project might ideally have a failsafe mode in which the Arduino can still provide minimum behavior while the Raspberry Pi is booting up or in case of program failure.
pd OneInOneOutAsciiTest.pd
.
Note that no special permissions are required; Pure Data will
communicate with the Arduino over USB and not access the Pi
hardware.A useful tool for debugging the Arduino connection from the Raspberry Pi
is the minicom
text-mode terminal emulator which can be run
from the command line. The minicom commands are prefixed with Control-A:
type Control-A Z to see a menu, or Control-A Q to quit.