1. Introduction
The Rasberry Pi which is a $ 25 credit Card Sized Computer has a good amount of computing power but lacks the ability to connect to field devices. This is due to the fact that the Rasberry Pi is a 3.3 V device and has no Analog channels. The Arduino on the other hand is a 5 V device that can interface many sensors and has many Analog, PWM and Digital I/O Channels. This article attempts to bring out the best in both worlds and explains a method to use the Arduino as a slave to gather field data and have the Rasberry Pi to use its computing power to achieve almost anything.
The Rasberry Pi is then programmed with Python and Tkinter to build …show more content…
Fig 1: The Rasberry Pi and Arduino as Slave
The article is divided into 3 parts:
Installation of Nanpy on the Rasberry Pi.
Installation of the Arduino program.
Writing a GUI(Graphical User Interface)Python program on the Rasberry Pi with Tkinter to control the Arduino.
2. Block Diagram of the system
Fig: 2 Block Diagram of the system
3. Part 1: Installation of Nanpy on the Rasberry Pi.
(Please ensure that the Rasberry Pi ic connected to the internet for all the following steps.)
1. Step-1:
Start-up the Rasberry Pi and when the opening screen appears go to Accessories and select LXT terminal to evoke the Linux text interface.
The prompt will be: pi@rasberrypi - $ Enter the command: sudo apt-get install update This will install all updates on the Rasberry Pi and have all packages up to date.
2. …show more content…
This will install the nanpy files for Pyton 3 on the Rasberry Pi.
If Python 2 is installed on the Rasberry Pi the command to be used is: sudo python setup.py install.
(sudo is a super user Do option).
5. Part 3: Programming in Python and Tkinter to Control an Arduino output.
In this final section a Python application will be developed which will use Tkinter(GUI Add-In for Pyhton).In the Rasberry Pi distro Python -3 and Tkinter are already preinstalled. When using Python 3 Tkinter is already installed. As an example we will write python code to achieve the following:
Establish connection between Rasberry Pi and Arduino.
With the Arduino as a slave manipulate the various pin modes.
Using two buttons in Tkinter turn ON and OFF the On –Board LED on Pin 13.
This program is a very basic program but provides the basic steps needed to provide the interface between the Rasberry Pi and Arduino.
Using this basic idea the Arduino can be controlled from the Rasberry Pi and can also be used as a sensor interface to read data and output data.
The Python Program is as