Basics To Arduino and Raspberry Pi

Most of the computing devices we use (including phones, tablets and games consoles) are designed to stop us from tinkering (experiment) with them. You can only use them in the predefined ways that the company offers to i.e. make calls, take photos, etc. You can’t enhance its functionality in terms of adding an extra hardware such as a fingerprint sensor. To do that you need some interfaces (inside the phone) to which you could connect the fingerprint sensor which is not readily available inside the main circuit board of the phone. Then what to do?

Fortunately, those days are gone when there was a considerable gap between a mobile company manufacturer and an electronic hobbyist. You don’t need to have a PhD or any formal type of higher studies to master the concepts of building your own mobile or a portable laptop. Thanks to Raspberry Pi and Arduino.

Raspberry Pi and Arduino are two open source hardware platforms which enables us to build/hack any electronic/electrical device and use them according to our needs. The idea is that the user provides the input and his imagination and these platforms gives us our desired result. These hardware platforms provides us a simple and low cost recipe that we can use to experiment with and play with our own ideas.

Over the years they have been the brain of thousands of projects, from everyday objects to complex scientific instruments. A worldwide community of makers – students, hobbyists, artists, programmers, and professionals – has gathered around theses open-source platforms, their contributions have added up to an incredible amount of accessible knowledge that can be of great help to novices and experts alike.

Now one may ask, why Arduino/Raspberry Pi only? It’s because they have got some serious advantages one of them being, they can interact with LEDs, motors,Speakers,GPS, cameras,smartphone,TV and any electronic/electrical device you can think of with great ease.

Let’s start with Arduino first. A big advantage that the Arduino has is the environment in which the commands are given to do specific tasks. Commands are nothing but some lines of English like language which have a definite syntax (pattern) as described by the software in which you will write the lines of commands. Now I am sure you are confused with the term ‘Environment’. Let’s try to understand with the help of an example.

Consider two environment: – A school environment and your own home environment. Certainly, inside your house in your home environment you would feel quite free to do any task as you want to. You won’t need to focus on external disturbances unlike the school environment in which it becomes quite time consuming. Here in your home environment each and every task becomes easy to achieve.

Likewise here in Arduino, it uses a home environment called the Arduino programming Environment which is nothing but a software which can be installed in a laptop. Here because of this user friendly software we can write complex tasks (written in English like language) very much easily.

Before we take an in-depth analysis let us 1st understand what each and every component of an Arduino does-

  1. Micro-controller- It’s the brain of the circuit board. It processes the given tasks and executes it to give an output.
  2. Input/output Pins- They are nothing but some pathways with help of which information is sent to the micro-controller or information is sent out from the micro-controller.
  3. DC input- The power supply needed for the Arduino to work.
  4. USB port- The port through which we can connect the Arduino to the laptop.
  5. Reset Switch- To reset the program which we had executed inside the micro-controller.

Consider your own family consisting of your father, mother, yourself and the servants. Here your father is the head person who attends each and every tasks of the family and processes them to give an advice to the desired person. But he doesn’t do all the tasks by himself, he just orders the servants to do the tasks. So you can consider the father as the micro-controller. Now, the servants when they start doing the tasks given to them and individually produces some output (work) to the external members of the family like your neighbour then these servants behaves like the output pins to the micro-controller (father). Again, after the father has given a task to the servant to analyze something from the external member of the family, if he reports back a result to the father than this servants becomes the Input pins to the micro-controller (father). The language that you speak with your family can be compared with the Arduino programming language which is used by the micro-controller to communicate with the input and output pins. An Arduino R3 model is shown below-

Let us build our 1st project of blinking an L.E.D. Here the micro-controller turns on the LED ON for one second, then OFF for one second, repeatedly. First take an L.E.D and connect the shorter leg (-ve) to the GND (ground) which is located to the left side of PIN 13. And connect the +ve terminal of the LED to the pin 13(See the upper figure for the pin’s position). Then connect the USB to the computer with the help of a USB cable. As soon as the Arduino is powered up, open the Arduino IDE software and write the following program-

void setup()
{
    pinMode(13, OUTPUT);
}

void loop()
{
    digitalWrite(13, HIGH);
    delay(1000);
    digitalWrite(13, LOW);
    delay(1000);
}

Explanation: – Every Arduino program has two main functions called setup() and loop(). The setup() runs only once when the Arduino is powered on. The loop() runs continuously after the setup() has completed (Please note that the micro-controller reads the lines step by step. That’s why the micro-controller will read first the voidsetup part followed by the voidloop part). When we write pinMode it means we will be assigning a specific pin either as OUTPUT or INPUT. The reason as to why we have written the pinMode under the setup is because we need to tell the microcontroller that the pin 13 is to be used as an output only once. Once the microcontroller understands that it needs to use the pin 13 as an output it will keep on thinking that it is an output throughout the execution of the current program. Also you may ask as to why we have used the pin 13 as an output. The answer is simple. The microcontroller will send a +5 Volt as an output to the LED but if we had used a fingerprint sensor then it would have been an INPUT to the microcontroller i.e. pinMode(13, INPUT). Again, since our project demands us to blink the LED so we need to send +5v PULSES after a short duration gap in between in order to turn the LED OFF or ON. Here, when we write digitalWrite it means for the current instant the microcontroller needs to turn ON pin 13 i.e. give a +5v as an output through pin13 which in turn is connected to the +ve terminal of the LED and we can see the LED glowing and thus we write digitalWrite(13, HIGH). As we know to blink the LED you need to turn off the LED too. So we write digitalWrite(13, LOW) which means for the current instant we are turning OFF the LED. Also note there are two delays here. The first delay is to make the LED glow for 1000ms (1s) and the next is to make the LED dim for 1000ms (1s).

Thus when we click the UPLOAD option this program gets uploaded to microcontroller with the help of the USB cable. Congrats, you have made your 1st Arduino project.

Let us proceed to the next part of our discussion- The Raspberry PI(RPi)

Raspberry Pi (RPi) is a tiny and affordable computer consisting of a single, credit card-sized circuit board. You can use it to do almost anything that is doable with a regular desktop computer, such as running desktop applications and playing music files. Raspberry Pi also has great potential for developing automation systems using sensors, relays, lights, and motors due to its small size, low power requirements, and small price tag.

Before beginning with RPi you should first know the difference between Arduino and RPi.

An Arduino board is best used for simple repetitive tasks: opening and closing a garage door, reading the outside temperature, driving a simple robot, etc.

Raspberry Pi is best used when you need a full-fledged computer: driving a more complicated robot, performing multiple tasks, doing intense calculations.

Actually, there is a simple rule which will help us to decide in which project we are to use which hardware platform. The rule is stated below-

“If you can describe your project with less than two ‘ANDs’ then go for Arduino. If you need to use more than two ‘ANDs’ then it would be better to go for Raspberry Pi. A simple example would make this rule easier. If you want to monitor the water level of a tank and when full then send a message to your mobile, Arduino is the 1st choice. It’s because this project uses a single ‘AND’.

Again, if we need to monitor the water level and also monitor the total litres that has been pumped out of the pump and then comparing the total water consumption for today with the rest of the days and if the water consumption for today is greater than yesterday then switch the pump off regardless the tank is full or not and then store the data in an online server for future reference then Raspberry Pi would undoubtedly be the best!!!! As we see here, we are using more than two ‘ANDs’ and so RPi is chosen.

Now, let us see the different parts of the Raspberry Pi in reference with a general laptop-

Raspberry Pi 3 General Laptop
Central Processing Unit(CPU) 1.2GHz 64-bit quad-core ARMv8 Intel Core 2 duo,I3,I5,I7,AMD
RAM 1GB More than 1GB
Graphics Processor(GPU) Broadcom VideoCore IV Nvidia Geforce,AMD radeon
WIFI 802.11n Wireless LAN 802.11n Wireless LAN
HDMI Yes Yes
Bluetooth Yes Yes
General Purpose Input/output Pins(GPIO) 40 Not available on board
LAN Yes Yes
Camera Interface(CSI) Yes Yes
Display Interface(DSI) Yes Yes
3.5mm Audio Jack Yes Yes
Internal Storage microSD Card Hard Disk
Weight ~50gm ~1000gm
Size Credit Card Much larger
Input Voltage 5volt D.C 19V D.C

*Please note that the size and weight of the general laptop is calculated including the on board RAM, hard disk, camera and all the minimum requirements to run the computer with an Operating System installed. The raspberry pi has all the features inbuilt on the motherboard and that’s why it is so small yet powerful.

That’s all you need to know about raspberry pi for now. We hope we have successfully made you a little interest in this two platforms. There are tons of tutorials present in the net. We could have written more about raspberry pi but actually, a little knowledge of LINUX operating system and networking is needed to work in this platform. You are most welcome to send us your queries, project ideas at jistehc2008@gmail.com or follow us at www.facebook.com/ehcjist

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s