Monday, May 26, 2014

Learning Hadoop

Hello,

So me and my younger brother have started to tinker around with this new tool called "HADOOP".

Now, what's HADOOP:

"Hadoop was created by Doug Cutting and Mike Cafarella[5] in 2005. Cutting, who was working at Yahoo! at the time,[6] named it after his son's toy elephant.[7] It was originally developed to support distribution for the Nutch search engine project.[8]"

So what was the problem which gave birth to Hadoop?

"Doug Cutting, Cloudera's Chief Architect, helped create Apache Hadoop out of necessity as data from the web exploded, and grew far beyond the ability of traditional systems to handle it. Hadoop was initially inspired by papers published by Google outlining its approach to handling an avalanche of data, and has since become the de facto standard for storing, processing and analyzing hundreds of terabytes, and even petabytes of data."

 Hadoop is a software framework, which means it includes a number of components that were specifically designed to solve large-scale distributed data storage, analysis and retrieval tasks.

From the next post onwards, I will start posting on how to install hadoop, configure, what are the modes in which we can use it. 






Thursday, May 8, 2014

TVB gone circuit using Arduino Uno

Hello,

So finally, I successfully made the TVB gone circuit using Arduino UNO. I was trying to do this since week, and finally, was able to finish this yesterday.

A little bit introduction about the TVB gone

"TV-B-Gone is a type of simple universal remote control device for turning off a large majority of the current available brands of television sets. It was created to allow people in a public place to turn off nearby television sets. Its inventor has referred to it as "an environmental management device". The device is part of a key-chain, and, like other remote devices, is battery-powered. Although it can require up to 69 seconds for the device to find the proper code for a particular television receiver, the most popular televisions turn off in the first few seconds.

TV-B-Gone was invented by Mitch Altman, and is sold by his company Cornfield Electronics. Altman was one of the pioneers of Virtual Reality, working with Jaron Lanier at VPL Research, and it was during his research in this field that he started to believe in the hypnotic power of television programs.[citation needed] The standard model TV-B-Gone consists of an infra-red LED, two CR2032 cells and an integrated circuit containing the television power code database, in a plastic case."



Components needed:

Arduino UNO R3, used it because of the simplicity of the project, and besides, this board is readily available, you can place your order from this website: https://www.sparkfun.com/products/11021

Arduino is an open-source physical computing platform based on a simple i/o board and a development environment that implements theProcessing/Wiring language. Arduino can be used to develop stand-alone interactive objects or can be connected to software on your computer (e.g. Flash, Processing, MaxMSP). The open-source IDE can be downloaded for free (currently for Mac OS X, Windows, and Linux)




Push button:The pushbutton is a component that connects two points in a circuit when you press it.

5 mm Infrared LED

                           


An electroluminescent IR LED is a product which requires care in use. IR LEDs are fabricated from narrow band heterostructures with energy gap from 0.25 to 0.4 eV. Infra red transmitter emits IR rays in planar wave front manner.
Eventhough Infra red rays spreads in all directions, it propagates along straight line in forward direction. IR rays have the characteristics of producing secondary wavelets when it collides with any obstacles in its path. This property of IR is used here.

When IR rays gets emitted from LED, it moves in the direction it is angled. When any obstacle interferes in the path, the IR rays get cut and it produces secondary wavelets which propagates mostly in return direction or in a direction opposite to that of the primary waves, which produces the net result like reflection of IR rays


5 mm Light Emitting Diode:A Light emitting diode (LED) is essentially a pn junction diode. When
                                              carriers are injected across a forward-biased junction, it emits incoherent                                                 light. Most of the commercial LEDs are realized using a highly doped n                                                     and a p Junction. 





Circuit schematic:

I did attempt to make the circuit which Mitch Altman invented, but could not get it to work, hence, I changed the circuit, available at the fritzing.org:

http://fritzing.org/projects/tv-b-gone-with-arduino/




However, this schematic has a bug, kindly do not put the push button's wire to the trasnmitter  section of the arduino board because Digital Pins 0-1/Serial In/Out - TX/RX (dark green) - pins cannot be used for digital i/o (digitalRead and digitalWrite) if you are also using serial communication. Since, we are using Serial.begin function to communicate with the computer, hence, these two pins are dedicated to TX/RX, hence, we cannot use these two pins.

So, wire the push button to the digital pin 2 of the arduino board.

Complete connection:

Breadboard's -ve rail: Connect to Arduino's GND

IR Led Negative or short leg: Connect the wire to the breadboard GND rail.

    Red LED Negative or Short leg: Connect the wire to the breadboard GND rail.

   One section of Push button leg: Connect to the GND rail of the bread board, push button's                                                 don't have polarity, hence, connect as per your wish.

   IR Led Long leg or +Ve: Connect to the digital Pin 3 of the Arduino Board, note that, these pins have ~ on their side,                                    it means that these pins can support analog functions also, but we don't require such                                             things for this project.

   Red Led Long leg or +ve: Connect to arduino's digital pin 13

   Push button's another side: Connect to arduino's digital pin 2

   Once the schematic is finished, upload the following sketches from this GITHUB:

     https://github.com/shirriff/Arduino-TV-B-Gone

    NOTE: Kindly do not create any library etc for this, either you can copy-paste the sketches individually, or extract the zip after downloading in the Arduino Sketchbook folder. If we create library, then, we get compile error:

o:(.progmem.data+0x0): multiple definition of `NApowerCodes'
/var/folders/sJ/sJhEJAz6HZiIGNVVaTTBwk+++TI/-Tmp-/build7674028882894173597.tmp/TVB/WORLDcodes.cpp.o:(.progmem.data+0x0): first defined here

o
o:(.progmem.data+0xe6): multiple definition of `EUpowerCodes'
/var/folders/sJ/sJhEJAz6HZiIGNVVaTTBwk+++TI/-Tmp-/build7674028882894173597.tmp/TVB/WORLDcodes.cpp.o:(.progmem.data+0x112): first defined here

o:(.data.num_NAcodes+0x0): multiple definition of `num_NAcodes'
/var/folders/sJ/sJhEJAz6HZiIGNVVaTTBwk+++TI/-Tmp-/build7674028882894173597.tmp/TVB/WORLDcodes.cpp.o:(.data.num_NAcodes+0x0): first defined here

o:(.data.num_EUcodes+0x0): multiple definition of `num_EUcodes'
/var/folders/sJ/sJhEJAz6HZiIGNVVaTTBwk+++TI/-Tmp-/build7674028882894173597.tmp/TVB/WORLDcodes.cpp.o:(.bss.num_EUcodes+0x0): first defined here
l
    Alos, i have used the Windows environment to compile the sketch. When using LINUX or Ubuntu, we have to add additional libraries.

    Once, we have the three files ready, TVB.pde, main.h and Windows.cpp, compile and upload the sketch. If you have received no errors, then, take the prototype near to your Television set, and have fun shutting down the Television which are running and annonying everyone ;).

PS: I stay in India, the code which has been provided has North American and European power codes, but while I designed this simple circuit, I did not have to worry about the power codes, as I was able to make this work successfully. However, while attempting  the circuit which Mr Mitch Altman had created, I have faced issues, may be, I may have to take care of power codes for that stuff. Will keep posting once I revive my work on that.




    







Wednesday, April 30, 2014

Wishing everyone BHAGWAN PARSHURAM JAYANTI






अग्रत: चतुरो वेदा: पृष्‍ठत: सशरं धनु: ।
इदं ब्राह्मं इदं क्षात्रं शापादपि शरादपि ।।


Parshuram who is well-versed with the four Vedas and sports the bow and arrow upon His back (that is the one who has the radiance of both the Brahman and the Kshatriya) will destroy evildoers either with a curse or with an arrow.


Today is AKSHAY TRITYA an auspicious day, as it is the day when BHAGWAN PARSHURAM JI THE GREAT took birth.


BHAGWAN PARSHURAM ji was son of RISHI JAMADAGNI and RENUKA maa and belongs to bhrigu gotr clan.



The  BHAGWAN was a perfect BRAHMAN, as brahman is supposed to be both, a scholar as well as a warrior. He possessed all the knowledge of the shashtra, and also, knew all the war fare techniques. 


Parashuram means RAM with an AXE, the LORD did tapasya of LORD SHIVA, who then blessed him with this divine weapon or DIVYA ASTRA.

                                                      
BHAGWAN PARASHURAM was the guide or guru of DRONA ACHARYA THE GREAT, aryan warlord BHISHMA, and taught krana also, even though he lied to the LORD that he is brahman.

In  the area konkan, udupi, kerala, or collectively, known as PARASHURAM KSHETRA, BHAGWAN installed brahmans there, these brahmans are known as namboodiri, konkanstha, and kota brahmins, who are rig vedi.

It is sad to see that now, akshay tritya in india is celebrated by selling gold, where as, BHAGWAN himself fought in order to restore VEDIC CIVLIZATION, and he held an axe made of iron, and wore a deer skin, which is totally unrelated to gold etc. This is the reason that why hinduism is falling down, as now, hindus have given ways to those life style which RISHIS have said no to.

Let all BRAHMANS TAKE A VOW THAT WE WILL FOLLOW THE FOOT STEP OF OUR BHAGWAN PARASHURAM and revive our glory and be the VISHWA GURU of this world.

With this, I will end by saying:

                                             II JAI BHAGWAN PARASHURAM II

                                                  Parashurama with axe.jpg


Wednesday, April 23, 2014

BMOSC's first PROTOTYPE - Short Range Motion Detector

Hello,




I am feeling proud to share a work with all of you, which manoj varma and me had made.

This can be considered as the first prototype of THE BMOSC, under the DIY category.

We tried to integrate a motion sensor PIR and an ultrasonic sensor HR-SC04.

Will be posting the schematics, sketch and test cases, which we had done.


Ideas Meet Makers - Maker Event hosted at BOSCH DIY SQUARE

Hello There,



The BMOSC hosted a maker day event at BOSCH DIY SQUARE, of which I was the in charge.

The goal of the event was to bring together the DIY enthusiast in the city of Bangalore,meet with each other,
brainstorm on the ideas, share the knowledge and most importantly, make something.

Even though, the total number of people who turned was not that great, as there were only five of us along with the host Deepak Mulajkar, which makes the tally as  six, the quality of the event is something which can be talked about.

This time, we decided that we will not go with slide deck,speakers or any talk sessions, as our goal was to promote the culture of MAKING. And I think, we were quite successful in this, even though, the full day of making was not achieved, but still, more than 50% of the time allotted for the event went into Making.

The positive point which I will take from this event was that, first and foremost, my own personality has shaped up a bit, I have learned quite a few number of things, I met wonderful people, and trust me, the world is filled with good people out there, who are really willing to help others, and they don't differentiate whether one knows English language ,how do they dress, or what their age. There main motive was to keep the spirit of the MAKER CULTURE alive, and all 6 of us just did that.

People brought and showcased robots made out of Lego blocks, which has a Raspberry PI and another microcontroller attached to it. We played with lot of other electronics times, hooked up motors, built an alarm with a speaker attached to it which irritates everyone and other stuff.

These are the pics of the event:


MakerDay Event, Starting from left: Mahesh Shivaraj S, Karimulla Naik, Radhakrishn Lambu, Mahesh Venkitachalam, Deepak Mulajkar, Raviprakash Jayaraman






Raviprakash Jayaraman, Radhakrishn Lambu, Karimulla Naik and Deepak at the maker event at Bosch Square.






Mahesh Shivaraj SRadhakrishn Lambu and Karimulla Naik at the Maker event at Bosch DIY square.


Mahesh Shivraj and Radhakrishn Rao Lambu








I would like to thanks Ms Kavita Arora, who is the founder and CEO  of THE BMOSC, Mr  Manoj Varma,Mr Bharadwaaj Ramarkishnan for their valuable contribution to curate this event, Mr Deepak Muljakar for providing us the wonderful venue,BOSCH DIY Square, Mr JayTirth Ahya, for making the poster of this event. 


I will conclude by saying that even though the total amount of MAKERS who turned up on this day was quite low, but overall, I am really satisfied that I did organize this event and and everyone had fun.

With this, I will end.

Thanks everyone and Have a nice day.























Tuesday, April 15, 2014

SHUBANSHI HANUMAN JAYANTI





Wishing everyone HANUMAN JAYANTI!!!

Today is HANUMAN JAYANTI. Hanuman is son of PAVAN and anjani maata, that's why he is also known as ANJANEYA.

LORD HANUMAN plays a significant role in the RAMAYAN. He was friend of sugriva, king of the KISHKINDHA KINGDOM, and used to assist him in managing the kingdom. In the battle, he kills

LORD HANUMAN was an ardent bhakt of SREE RAM, and always helped him in his task. His devotion and loyalty to his MASTER LORD RAM is something which all of us must look upto, because, so much devoted was he to LORD RAM, that he once started piercing the necklace of MAA SITA, which she gave to him. When questioned by VIBHISHANA/SUGRIVA (AUTHENTICITY NEEDS TO BE CHECKED) that why are you breaking such costly affair, the MAHAVIR says that for him, all those objects are worthless in which HIS SHREE RAM does not reside. On hearing this, VIBHISHANA/SUGRIVA asks, what about your own body? Then he pierces his own heart, and everyone gets to see that HANUMAN IS PARAM BHAKT of SHREE RAM, and his devotion is unparalleled.

LORD RAM has kept HANUMAN CHIRANJEEVI, in order to fight the evil and make sure that PRITHVI is not completely sinful.

LORD HANUMAN IS EPITOME of Bal, Buddhi, Vidya. It is apparent, while he was on his way to lanka, he is stopped in between. The demon tries to test his charachter, on which, hanuman never lost his common sense. He resizes himself, steps inside the mouth of the demon, and comes back immediatly. Due to this act, the demon also becomes SHRAP MUKT.

Similarly, Ravan orders one of his soldier to set HANUMAN' Tail on fire, HANUMAN uses logic, and puts the entire lanka on fire, due to which, the city comes into inflration, and major infrastructure gets destroyed.

Another instance states about his selfless character.After the victory of Rama over Ravana, Hanuman went to the Himalayas to continue his worship of the Lord Rama. There he scripted a version of the Ramayana on the Himalayan mountains using his nails, recording every detail of Rama's deeds. When Maharishi Valmiki visited him to show him his own version of the Ramayana, he saw Hanuman's version and became very disappointed. When Hanuman asked Valmiki the cause of his sorrow, the sage said that his version, which he had created very laboriously, was no match for the splendour of Hanuman's, and would therefore go ignored. At this, Hanuman discarded his own version, which is called the Hanumad Ramayana. Maharishi Valmiki was so taken aback that he said he would take another birth to sing the glory of Hanuman which he had understated in his version.

Let us all chant together: JAI BAJRANG BALI

Sunday, April 13, 2014

My Simple HACK- Displaying fruit nutritional information using MAKEY MAKEY


Hello,

So I have been busy designing a simple hack, though I enjoyed it a lot and learned many things.

This hack will display the image of a fruit, when a fruit is touched.

Now, wait, I did not use any sensor and all, the only thing which I did is that I mapped the fruits with keys, using python, and when that fruit is touched, which is equivalent to a key press, the jpg format gets uploaded, which looks as if by touch the fruit, image of that fruit is getting displayed.

Full explanation:

Manolins MaKey MaKey HID Board Deluxe Kit Invention Toy Gift for Kids - Red + WhiteLet me explain, to begin with, What is MAKEY-MAKEY:




MaKey MaKey is an invention kit for the 21st century. Turn everyday objects into touchpads and combine them with the internet. It's a simple Invention Kit for Beginners and Experts doing art, engineering, and everything inbetween:


It comes ready to use out of the box with everything you see above: MaKey MaKey, Alligator Clips, USB Cable.




How Does it Work?

Alligator Clip two objects to the MaKey MaKey board. For example, you and an apple.








When you touch the apple, you make a connection, and MaKey MaKey sends the computer a keyboard message. The computer just thinks MaKey MaKey is a regular keyboard (or mouse). Therefore it works with all programs and webpages, because all programs and webpages take keyboard and mouse input. 
Make + Key = MaKey MaKey! 

Who is MaKey MaKey For?

Artists, Kids, Educators, Engineers, Designers, Inventors, Makers... Really it is for everyone.

What materials work with MaKey Makey?

Any material that can conduct at least a tiny bit of electricity will work (if it doesn't already work, just rub it with bananas, spray it with water, or apply copper tape). Here are some materials people have used in our workshops including Ketchup, Pencil Graphite, Finger Paint, Lemons, etc.:








Other materials that work great: Plants, Coins, Your Grandma, Silverware, Anything that is Wet, Most Foods, Cats and Dogs, Aluminum Foil, Rain, and hundreds more...

Wait... Is this thing an Arduino?

You could say this board is 2 for the price of 1. MaKey MaKey runs on top of Arduino. You can start using your MaKey MaKey board in "Arduino mode" at any time. This would allow you to spin motors, turn on LEDs, or anything else that an Arduino can do. If you want to learn to use Arduino or other electronics, but want to start without any programming or breadboarding, MaKey MaKey is a good starting point. There's no need to understand Arduino in order to use MaKey MaKey.

What is PYTHON:
Python is a widely used general-purpose, high-level programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than would be possible in languages such as C. The language provides constructs intended to enable clear programs on both a small and large scale.

Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive standard library.[21]

Like other dynamic languages, Python is often used as a scripting language, but is also used in a wide range of non-scripting contexts. Using third-party tools, such as Py2exe, or Pyinstaller,[22] Python code can be packaged into standalone executable programs. Python interpreters are available for many operating systems.

CPython, the reference implementation of Python, is free and open source software and has a community-based development model, as do nearly all of its alternative implementations. CPython is managed by the non-profit Python Software Foundation.

Python is a multi-paradigm programming language: object-oriented programming and structured programming are fully supported, and there are a number of language features which support functional programming and aspect-oriented programming (including by meta programming  and by magic methods). Many other paradigms are supported using extensions, including design by contract and logic programming.

Python uses dynamic typing and a combination of reference counting and a cycle-detecting garbage collector for memory management. An important feature of Python is dynamic name resolution (late binding), which binds method and variable names during program execution.

The design of Python offers only limited support for functional programming in the Lisp tradition. The language has map(), reduce() and filter() functions, comprehensions for lists, dictionaries, and sets, as well as generator expressions.The standard library has two modules (itertools and functools) that implement functional tools borrowed from Haskell and Standard ML.

Packages Used:

The python packages used to develop this interfaces are:

  • PySerial : A module which  encapsulates the access for the serial port. It provides backends for Python running on Windows, Linux, BSD (possibly any POSIX compliant system), Jython and IronPython (.NET and Mono). The module named “serial” automatically selects the appropriate backend.
Features:
    • Same class based interface on all supported platforms.
    • Access to the port settings through Python properties.
    • Support for different byte sizes, stop bits, parity and flow control with RTS/CTS and/or Xon/Xoff.
    • Working with or without receive timeout.
    • File like API with “read” and “write” (“readline” etc. also supported).
    • The files in this package are 100% pure Python.
    • The port is set up for binary transmission. No NULL byte stripping, CR-LF translation etc. (which are many times enabled for POSIX.) This makes this module universally useful.
    • Compatible with io library (Python 2.6+)
    • RFC 2217 client (experimental), server provided in the examples.

  • OpenCVPython is a library of Python bindings designed to solve computer vision problems.OpenCV-Python makes use of Numpy, which is a highly optimized library for numerical operations with a MATLAB-style syntax. All the OpenCV array structures are converted to and from Numpy arrays. This also makes it easier to integrate with other libraries that use Numpy such as SciPy and Matplotlib.

Other packages used are os and sys.

The important packages in this python script are serial and the opencv.

The code:







How this works:

The MaKey MaKey device is connected to the serial port. The function serial which is imported using the pyserial package reads and detect this device at a particular baud rate.  Bottom of Board Explained




The serial port at which the device is read is dependent on the operating system.

Currently, the python script captures the win32, linux2 and cygwin platform.

For win32, the serial port has to be configured  by using the serial instance 'COM%', for linux2, the '/dev/ttyACM0/' is the serial instance, and for cygwin, it is 'COM%+1'.

Python program reads the device at this serial port, and waits for the command by listening to the 'COM' port.

The MaKey MaKey device used in this case is a deluxe kit. The deluxe kit has 6 Keyboard, which acts as a normal computer keyboard.

Connect the fruit orange to the key 'W' , apple to 'A', and banana to 'S'. Connect any other fruit to 'D'

Here, the package opencv is used to display the image. This package comes with a method cv2.waitKey() which waits for the key press. Use 0 so that the program waits for the inifnite amount of time for the key to be pressed.

The file is kept in the directory, which is read using cv2.imread() function, if file is not found at that location, then it raises an error.

The opencv uses the ASCII character of the key which has been pressed, so, even if 'w' is pressed, the ascii value of 'w' which is 119,will be used to process further.

The image loaded using the cv2.imshow() function,in which image which has been read from the directory. 

In order to make the program in such a fashion, that each time, the image is loaded freshly, the cv2.destroyAllWindows() function is used, which destroys the previous loaded window and loads the window afresh. 

So when the fruit orange is pressed, which is connected to the key 'w', whose ascii value is ready by the serial port, the file orange.jpg which is present in the directory gets loaded, and the image of the orange with its nutritional value appears. In order to fit the image properly, the resize function is used.

To exit the program, the ascii value of space is used, touch the space key of the MaKey MaKey, which closes the serial device and the program gets terminated, returning the control back to the python interpreter.

The circuit:




Connect the Makey Makey to the circuit, if the device is not connected, then there is an exception raised which is: 




Now, after the circuit is connected, it will load a 'welcome.jpg' image,as in the program the imshow() function encounters this image: 




When we touch orange, it is equivalent to the key press 'w', the waitkey(0) function waits for the key, destroys the previous window, and the imshow window is set to show the orange.jpg file:





When we touch apple, it is equivalent to the key press 'a', the waitkey(0) function waits for the key, destroys the previous window, and the imshow window is set to show the apple.jpg file:





Similarly with the banana.

when we touch the space button, the program exits.


Potential issues faced:


  •  The program does not work on cygwin, until and unless the win32 does not read the device. Even if the device is connected, and program is executed using cygwin, it still raises an issue 'Device not found'. I researched on this further, and found that cygwin does not detect virtual COM ports, and despite, giving the mapping of the device, which is present in the serialposix.py, device is not being detected, if the program is not executed in win32. 
  • For linux 2, the port /dev/ttyACM0/ has to be configured using dmesg or gtkterm command. The baud rate mismatch also makes the device undetectable.
  • I found an interesting thing with python list. In a python list, an element can be accessed using the index, but if we try to access the element using a for loop, then it fails. The reason being that in a for loop, the python list elements or indexes have to be fetched in the sequential order, which means, that the elements will be fetched in the order at which they are placed in the list. Trying to access a list, which is not equal to it's index number, while the program is in for loop will raise an error 'Element referenced before an assignment' , though the same element can be accessed if the index number is known, without for loop, as in this case, order does not matter.
  • If the fruit is cold, then the response time when a fruit is pressed and image gets uploaded is very low, as if, it happens instantaneously. But, if the fruit is at room temperature, then, a bit of force has to be applied depending on the hardness of the fruit, in order to get the image uploaded. This happens especially with apple, which has to be pressed using the palm also, to get the image uploaded instantaneously.

  • The circuit must not be kept on a surface which is slippery, like floor marble, rather, use wooden table, so that, until and unless, person does not touch the fruit, the keys don't get detected.

Further Hacks:

  • One of the thing which I was trying to achieve was to display the image in a web browser, by pressing the keys. But the problem here is that the browser window and the window key press events of opencv2 are mutually exclusive, and hence, the key press event  waitKey(0)  is not being detected by the browser window. I am still trying to figure out a way to resolve this issue.

  •   Another thing which I need to sort out is that irrespective of which fruit is connected to a particular key, the image of that fruit must get uploaded. At present, I am hard coding the key values and also, the fruit images, and connecting the fruits to these keys. My intention is that, irrespective of any fruit  connected to any key, the keys must automatically detect the fruit which is connected, and image or information of that fruit must get displayed. This can be done by converting the physical information or property of a particular fruit into digital format, and getting this digital information read, and converting it into file. This is known as Physical Computing, where we turn 'THINGS' into 'DATA' and 'DATA' into 'THINGS'. Here, the physical fruit consists of atoms and its digital part or information, is bit. So we turn the physical property, atom, into bits, or data, which is digital information, and get the information out of it. Similarly, reverse approach can be take, means, using the digital information of bits, we can get that physical object which this digital file represents. Though, need to figure out, the role of keys here, as this hack is just for fun.