26 Apr 2016

Raspberry Pi VS Arduino Uno : The Showdown

Arduino VS Raspberry Pi : The Showdown

In the modern world, almost everyone who is into embedded programming with electronics have either an Arduino Uno or a Raspberry Pi. Many people believe that both of them do the same thing and that it is only the price that sets them apart.






It is only when we look into the details that we can find some differences between the two. Let's get straight into it. 


Under the hood

Let's look at some of the specs of the Arduino Uno and the Raspberry Pi B+ as they are the most common once used.



Except that the Raspberry Pi does not have analog pins. It looks as if Raspberry Pi has already won. But there are some differences that make the Arduino a good competitor. Read on to find out !


The Basic Differences

The Arduino is a micro controller which means that when it boots up, it just runs the code that is assigned to it, it has no Operating System. It is a part of a computer. But the Raspberry Pi is a full fledged computer. This may seem advantageous to the Pi in all ways, but it is not so.

Since the Raspberry Pi is a full fledged computer which runs on Linux distributions, it gives you more power and flexibility. But most advantages come with a disadvantage. In this case the disadvantage is complexity. 



 Since the Arduino has no Operating System, it runs the code assigned to it with no background processes to handle thus it is better in terms of reading real time input from sensors , etc.. But the Raspberry Pi might take a while as it runs on an OS and needs to process that extra bit more.

One major difference is that in order to program or use a Raspberry Pi you WILL need an SD card with the required OS ,  keyboard, mouse and and a HD display compatible with HDMI ports The Arduino requires a serial cable and a computer running Windows  XP or later .

Apart from these major differences, there are some other minor differences as well.


Input/ Output Pins 

The Raspberry Pi has a " 3.3 V " Logic where as an Arduino has a "5V" one.
This can be good or bad as some components have a 5V output where as some have 3.3 V. 




The Arduino having a 5V logic can handle 3.3V as well as 5V.But this is not true vice versa.




Do note that the  Raspberry Pi does not have a good history on  handling a  5V output for even a second ! That does put down the Raspberry Pi quiet a bit considering MOST DIY elements these days are powered by 5V.

DC Input

The Arduino and the Raspberry Pi can run on the usual 5V DC input (a.k.a from a USB phone charger.) The Raspberry Pi cannot handle anything above 5V. The Arduino Uno on the other hand is can handle anything from 5V to 20 V as it has an on board regulator.

Unlike Arduino the Raspberry Pi as a computer needs a steady supply of very good quality of 5V. If not there would be some lockups and problems.

Also, the Arduino can run straight of a 9 V battery as it saves the code from the previous session.

Analog Pins

Unlike the Raspberry Pi, the Arduino can directly read analog voltage as it already has an ADC( analog to digtal converter) on board which the Raspberry Pi does not have.

 This does mean that you have to take that extra step on converting it in the Raspberry Pi which might cause some hiccups during the process .

Audio/Video

The Raspberry PI is capable of playing back video files at FULL HD and audio files at a good quality while the Arduino is incapable of doing that.Although the Arduino can make tones using a Piezo element , it cannot play Audio straight off without a sound card / sound shield .

The Arduino also cannot play video as it does not have the video card/ Audio card. This is reasonably acceptable as the Arduino is only a Micro- Controller and is not built for Video/Audio output.

The Raspberry Pi can also RECORD video if you have a compatible webcam. Where as the Arduino Uno denies the opportunity .


Wireless Capabilities 


The Raspberry Pi is capable of connecting to the Wi Fi just by hooking it up to the attachment.
Where as the Arduino needs its more expensive Wi Fi shield . This might be a disadvantage .

The Rasperry Pi also can connect to bluetooth with the help of the bluetooth module. The same goes to the Arduino Uno .

Choosing the Right One

Choosing the right board heavily depends on your project that you will be doing. Here is the compiled list of some of the projects.

If you are doing with something which involves reading input from sensors, then Arduino would be your best bet as it has a good compatibility with most sensors whether it is Analog or digital.


If you are making a project that has a graphical user interface, then the Raspberry Pi would be the one for you as it can handle Video and Audio output whereas the Arduino cannot.

If you are a beginner to electronics, DIY , etc ... ,  then the Arduino would be you best bet as there is a big community out there which could help you to get up and running.

To Sum Up

Both these boards are really good when compared to each other but these both do different things.The choice is left upon the type of project that you will be working on.

These differences have  covered  all of what you need until you get fairly advanced. If you are that advanced person you can also combine them both to make a deadly combination ! For now
happy hacking !

_______________________________________________________________

If you want me to make any changes or if you want to do it , feel free to do so.

Sources = Images : Google Images . Specs : http://www.arduino.cchttps://www.raspberrypi.org/

9 Dec 2015

LMLE : How I created a compilation of "Invisible Man" notes

LMLE stands for "Linux Makes Life Easy". If you don't understand any of the commands used, please google them.

So today I was going through some websites looking for notes for "The Invisible Man" that I have to study as a part of out 12th standard syllabus. I found a good resource here http://thebestnotes.com/booknotes/Invisible_Man_Wells/The_Invisible_Man_Study_Guide01.html but realized that it had tons of different HTML pages each having distracting ads and stuff. I wanted a neat solution to read this stuff quickly without too much clicking.

Since I had 3 pre-boards left and I'd have to go through these notes at least 3 more times, I though it would be worth investing some time and get it formatted. But obviously, copy pasting 30+ times wasn't an option for me. I needed something much quicker.

So, Here goes.

I booted up Linux (sadly Windows is still my working OS), and opened up the terminal. I remembered Arjun telling me about wget a few weeks back, so I decided to give it a shot.

This is what I tried first

wget http://thebestnotes.com/booknotes/Invisible_Man_Wells/The_Invisible_Man_Study_Guide01.html"

Plain and simple, but it gave me only an offline version of the website itself. Then I tried this

wget -r

It gave me the same thing but inside a folder and it wasn't any use. Being the noob I still am, I tried man wget and tried figuring it out. But I didn't really have the time. So I consulted a programmers best friend - Stack Overflow!

I found this neat combination of options that helped me download all the files into one html file all at once.

wget -r -l1 -H -t1 -nd -N -np -A.html -erobots=off -O file.txt http://thebestnotes.com/booknotes/Invisible_Man_Wells/The_Invisible_Man_Study_Guide01.html

But guess what? It was no use because an extra "0" in "01,02,03" in the naming of the html links on the page ruined the ordering of the content in the output file.

So I just used the messy version of the previous command - download all html files separately and then parse them

wget -r -l1 -H -t1 -nd -N -np -A.html -erobots=off http://thebestnotes.com/booknotes/Invisible_Man_Wells/The_Invisible_Man_Study_Guide01.html

So now I had all the content locally. But they were all individual html files. I researched a little bit and found that there was a 3rd party utility available called "html2text" that did exactly what I wanted.

sudo apt-get install html2text

Boom. Installed. Just like that. Is it that easy on Windows? Definitely not. 

Only one step left.

html2text -utf8 -nobs -style pretty The_Invisible_Man_Study_Guide01.html > file.txt

But this gave me the output only for one file. So I just wrote a small script to automate it for all the files.

for x in 0{1,2,3,4,5,6,7,8,9} 10 11 12 13 14 15 16 17
      do
  html2text -utf8 -nobs -style pretty The_Invisible_Man_Study_Guide$x.html >> file.txt       done

After all this, I had perfectly readable content but the problem of some unnecessary text still remained. So I manually opened up the file and within 2 minutes, removed all the unnecessary stuff and it was finally perfectly formatted to my liking. (file.txt was the final output file.)

When I opened it up using gedit, the scrolling flicker was hurting my eyes, so I used a terminal based alternative.
To read it now, All I have to say is 

vi file.txt

If I'm looking for a particular section, I just use grep and read only that part. 
Works pretty well, worth spending half an hour.

Any questions? Leave a comment.

17 Sept 2015

Touchscreen-Tech

Have you ever wondered why your iPad does not respond to your finger? If you have wondered, then great, but if you have not, then, no problem. Anyways, in either case, it is worth knowing the answer!! To understand the answer to this question, we must first understand what “touchscreen technology” is, and how it works.

Technically ‘touchscreen’ is an input device layered on the visual display unit of an information processing system that enables you to operate the system using your finger, stylus or designed gloves.

In simpler words, it is the technology that helps your finger use your smartphone!

Nowadays, touchscreen technology is not limited to just tablets and smartphones but is instead creatively employed in almost everything from laptops to gaming consoles. It is used in hospitals, heavy machinery and even ATMs.

But, in order to be able to employ touchscreen technology as well as we do in the present, a lot of research and work has been done over the last five decades. And this work, can be traced down to scientist E.A. Johnson who first published his work on touchscreen technology in 1965. A decade later, at CERN the first transparent touchscreen was developed by Frank Beck and Bent Stumpe. In 1972, the University of Illinois filed a patent for the invention of an optical touchscreen, and consequently, further discoveries in the field led to what we possess today in our smartphones, tablets etc.

Now with this much of a background, we can now explore HOW touchscreen works.

There are essentially two main types of touchscreen technologies:

1.      Resistive Touchscreen Technology.
2.      Capacitive Touchscreen Technology

Resistive Touchscreen Technology:



In this technology, there are two layers separated by a very thin space. The front layer has an external hard plastic covering facing outside, and an inside conductive coating.

The layer behind, has a glass covering facing the outside, and a conductive coating on the inside of this layer.

When the front hard plastic coating is touched, the little pressure applied, causes the two internal conductive layers to touch. The device then recognizes which part of the screen the finger/stylus has touched, and accordingly performs its function. 

Capacitive Touchscreen Technology:

Here, unlike before, the pressure applied is not the determinant. Rather, it is the material with which the screen is handled with. 


There is an ITO (Indium Tin Oxide) conducting layer which is horizontally lined with electrodes and has electricity flowing through it. There is another ITO conducting layer beneath. This is vertically lined with sensing wires that monitors the flow of electric current in the first ITO layer.

The wires of these two ITO layer are now perpendicular to one another. These layers are separated only by a thin optical adhesive that helps them remain together intact.

So essentially when we touch the screen of the device with our finger, the electric field is distorted or altered from the first ITO conducting layer due to the conductivity of our finger. This alteration is sensed by the second ITO layer and then the point on the screen that our finger has touched, is identified. Accordingly the device performs its function.

So now the answer to our question is almost self-explanatory. Human nails are a poor conductor of electricity and iPads use capacitive touchscreen technology. So by nature, the nails do not alter the electric field, and so the iPad does not sense it!

I hope this article helps you understand how your tablet or phone responds to your touch!

Some of the references I have provided below can help you understand more about this subject. If you find anything interesting in the field and would like to share it, please post a comment.

References:

1. http://scienceline.org/2012/01/okay-but-how-do-touch-screens-actually-work/
2. https://www.youtube.com/watch?v=SzLoWDkBKXk
3. http://capacitive-resistive-touchscreens.articles.r-tt.com/

11 Sept 2015

International Linguistics Olympiad


Have you heard about the International Linguistics Olympiad (IOL)? If not, you’re not alone. A lot of students haven’t heard about this Olympiad, and that’s a pity — they’re missing out on an exciting opportunity.

Most people have heard about the International Olympiads in Physics, Chemistry and even Informatics (a.k.a. Programming). These are some of the the “International Science Olympiads”, and are recognized by colleges and teachers across the globe as the penultimate academic high school competitions. If you win a medal in one of these competitions, you’re considered the cream — the very highest outstanding achievement you could get.

[By the way, the olympiads that you write in school — NCO, NSO, IMO and IEO — are not truly international olympiads. They are actually competitive exams that are mostly restricted to India.]

The Linguistics Olympiad is one of the “International Science Olympiads”. Over 30 countries from across the globe send teams of their brightest high school students to solve challenging puzzles in Linguistics.

I’ve been to the Linguistics Olympiad. I went to Bulgaria in July 2015 as part of Team India. I forged new friendships, experienced new cultures, won an Honorable Mention and generally had a great time.

When I tell people about my experience, the first question I’m asked is, “How many languages do you know?”
That’s the thing: You don’t need to know multiple languages. ALL YOU NEED IS LOGIC!

That’s right. If you liked the logic puzzles posted on the Google+ site, then you’ll definitely enjoy solving Linguistics puzzles.

Here’s a sample.
And don’t be lazy. Spend some time on this and give it a try! (In fact, if you can, print this image out. At the very least, grab some rough sheets and write down your thoughts!)

Click the image to enlarge.

First off: Most of you don’t know Swahili. And that’s the point — no one’s supposed to be at an advantage here.

Let’s look at this problem analytically. If you haven’t printed it out, make sure you keep looking back at the question while reading my answer. You won’t understand it otherwise!
  • tarehe is repeating in every single Swahili date. It probably means “date” in English.

  • Disemba”, “Oktoba” and “Aprili” sound suspiciously like English months. In this case, they definitely are. You can check by counting the number of times each Swahili month appears, and comparing that with the number of times each English month appear.

  • Look at the English dates (B) and (D). They’re exactly the same, except for the number (2nd and 4th). The two Swahili translations should also be exactly identical except for those two numbers. Look at Swahili dates (3) and (5). They are identical except for the second words (“pili” and “nne”). Now we know that “Jumanne” means “Tuesday”. We also now know that the format for writing Swahili dates is:

tarehe” <number> <month> <day>


  • With this new information, compare (1) and (F). “tatu” is the number ‘3’. Make a list of all the Swahili number names, and try to find other correspondences. For instance, from (2), (4), (6) and (A), (C), (E), you can translate “tano” as the number ‘5’.

  • Did you notice that the day names in Swahili also appear to have the names for numbers? “Jumatatu”, “Jumatano”, “Jumapili”, “Jumanne”.
    We can guess that in Swahili, the days of the week are numbered (Day 1, Day 2… etc).

  • We know “tatu” means ‘3’. That means “Jumatatu” is “Day 3”. Look at sentence (4). “Day 3” could be either “Monday”, “Wednesday” or “Sunday”. (Those are the days in the English dates containing “October”.)
    Let’s assume that “Day 3” in (4) is “Wednesday”. Then, from sentence (6), “Jumatano” means “Day 5”, which should be “Friday”. However, none of (A), (C) and (E) contain the day “Friday”. That means the assumption is wrong.
    Try assuming “Sunday” as “Day 3”. Can you find out where this assumption goes wrong?
    Now try assuming “Monday” as “Day 3”. Does it work?

  •  If “Day 3” is “Monday”, then “Day 1” is “Saturday”. This means that the Swahili week begins on Saturday. (In contrast, we generally think of Sunday as the beginning of the week.)

  • From the translations of days and numbers you can work out all the other translations, match the dates, and complete the question.

To be fair, these problems aren’t exactly easy to solve. This problem, for example, would take anywhere between 10 minutes and an hour to solve.

However, no one said an International Olympiad was going to be easy. The actual IOL consists of 5 questions to be solved in 6 hours. Yes, 6 hours.

Interested in giving it a try? I strongly recommend that you do. To get selected, here’s what you have to do.
  • Write the Panini Linguistics Olympiad. It’s the national round of the Olympiad.
  • Be one of the 30 or so students from all over the country selected from that exam to attend a Training Camp. It’s sponsored by Microsoft and Xerox!
  • Be one of the top 8 (or 12) students in the camp!
For information about the IOL and past contests, visit: http://ioling.org/

The only way to get better at this is with some practice. If you’d like to solve some more questions on your own, start here: https://sites.google.com/site/paninilinguisticsolympiad/Resources/the-panini-junior-linguistics-olympiad

Do you dare to try some of the most challenging Linguistics puzzles ever designed? Choose from the past IOL problems over here: http://www.ioling.org/problems/

If you ever have any questions, or would like me to explain how to go about solving some question, feel free to email me, or post on Google+. I’ll make sure that all my answers are made available to everyone.

Finally, whether you plan to pursue this Olympiad or not, don’t keep this post to yourself. At the very least, let your friends know that something called the “Linguistics Olympiad” really exists, and send them the link to this blog post.