Featured post

A reason to exercise.

It's been two years since I started going to the gym and this post is just a summary of my experience. Before going to the gym. Iv...

Friday, 25 September 2015

ADCOM 2015 final 25!!

The title of the post might seem confusing at first but it's the shortlisting pattern for the ADCOM 2015 event,conducted by ACCS(Advanced Computing and Communications Society).

One fine exam morning,my professor while walking into his room saw me frantically revising for the days examination.I wished him with a formal"Good Morning Sir".
He acknowledged with a nod and spoke to me saying that there was a contest on "SMART TRANSPORT SYSTEM" and would I be interested.
 I jumped to the opportunity.

When growing up, my locality had a very typical village ambiance.(Though much of it has changed now as everything has become more "modern").I grew up watching people ride on bullock carts and work in the fields.This memory of mine has had a deep impact on me.
For reason which I shall explain shortly, this "image" struck my mind on hearing "SMART TRANSPORT SYSTEM".
When you consider a scenario in which two bullock carts are travelling, you can tell with absolute confidence that they will not collide with each other.
This very clearly indicates that the "vehicle" is well aware of it's surroundings.
Also it is not necessary that the "drivers" of the carts maintain control all the time,the bulls can do it themselves.
The vehicles now turn out to be "smart enough" of taking independent decision without having to ask the "master".
Another beautiful feature in this system is that there is minimum "traffic" as such, and absolutely no emission.
A modern vehicle that is able to adapt to the surrounding traffic and be eco-friendly would be phenomenal.

A proposal had to be prepared and submitted to the ACCS society which I did.
My team and I came up with two proposal features that incorporated the above idea:
we called it as "SMART VEHICLE".
The proposals which were selected were called to IIT Madras,one of the premier engineering college in INDIA, to give a presentation and if possible a demo.
Though the shortlisted 115 teams had been posted well in advance,we got to know only 4 days before.
It was "all hands on deck" from then on.
The template on how the slides should be created and presented were already given on their website.
Even though presentation of the slides would have sufficed, there was something in me that kept telling me we can do it better.
So,with two days to go(two nights actually,as I have college in mornings),I sat down coding.More importantly was the task of finding the parts needed to build my project.I needed three ultrasonic sensors(HC-SR04 's).A few of my classmates had made use of this particular sensor in the "mini-project" that had to built and which would be graded by our college.
Contacting them overnight,ensured that the sensors were with me before noon of the following day.
On the evening of our departure is when I sat down to put together the components on the "PCB" and solder them into place.
I must say that the two nights that I spent working on this project has thought me a lot.
I have learnt how to work quickly,mange my time in the best possible manner ,and how to think on my feet.
Another lesson learnt is that when you truly believe and work towards something,none will stop you.In fact,they will support and encourage you as my friends did in my case.
There will be a few people who will want to, and will try to, pull you down(trust me,I have been through this stage too),but always think that you are a mighty ship sailing in the ocean.
You are bound to face trouble,overcome it.




















There I am along with my team!!




 Looks like a "supercar" with some "badass" exhausts doesn't it?
Cheers!! and see you soon on my next post.

Tuesday, 15 September 2015

Teacher indicator!!

I prefer to take a stroll out of campus during long breaks and stay indoors listening to music on shorter ones.Just the other day, a friend of mine decided to join me for a walk.As we walked, we spoke about the projects we were involved in.He said to me that he wanted to build a "clap detector".It's an easily doable project, (a half day's project infact starting from buying the components to fabricating on pcb).

"what's it used for,apart from the very obvious fact of detecting claps?" I asked.
This question of mine probably put him off, making him hit back with 
"Well,why don't you build one and show me other uses for it.".
Challenges are something that I relish.It helps keep me occupied ,move away from academics and also give me chance to learn.

"Challenge accepted",came the equally quick response.

A clap detector is a very simple device that makes use of an microphone(condenser type),a relay and a few other resistors,capacitors etc. to detect "claps" and turn on the relay.In this way, a light,radio or fan can be turned on by a clap.

While working on the project, my mother told me that she could actually make use of this device if it could record the "whistles" made by a rice cooker and display it in some manner.
GENIUS!
I ran to the nearby electronics store,bought some 7 segment displays which would be indicative of the number of whistles and also a small buzzer.The buzzer buzzes if the whistle count is 4,5 or 6.

USE 1: Now we know one more use for the clap detector and it is in detecting whistles made by rice cooker,a tea kettle or a milk boiler(those of  olden days wherein you will have fill it with water first before pouring in milk) .
Here is how its turned out to be.
It may look fussy,but with a single evening I had to build it, I think it's turned out "OK".

USE 2: Another situation in which I use this guy is at class.
When the teacher is not inside the class, there is constant noise made by chatter of the students, me being involved with my music.
A lot of the time what happens is that the teacher enters the class without me noticing at all, for which I am punished by being the target,the rest of the class.
The solution to this is just replacing the buzzer by a vibrator motor.
So now, whenever the teacher enters the class,everyone falls silent ,my device detects this change and turns on the motor giving me an indication.

USE 3:This could also be used to detect if your baby is awake.Once the baby is awake and cries,the wireless module on the system(this one doesn't,will have to add one) will send out an indication to the parents.

PS:BLURRED PHOTOS AHEAD!!

That's it folks.
Let me know if you found out a use for it.











Wednesday, 2 September 2015

Re-visiting binary subtraction, my way.

Just the other night, while revising my concepts on binary arithmetic ,came binary subtraction.
The way we do subtraction in binary is by taking the two's complement of the negative operand
(negate the bits and add '1'),and the result is added to the positive operand.
If we end up with a '1' at the MSB(most significant bit),then the result is negative and vice versa.
Let's better understand this with an example:
1.      Take 12-7;
        ANS=5.
We are all comfortable with arithmetic computation using numbers from 0-9; the "decimal" system.
The digital electronic circuitry(and not only computers) however understands only two bits;a '0'or a '1'.
This system is called as "binary" system.
The circuit "feels" the value '0' by the "ground potential" and '1' by "+5V or +3.3V".
Just like we have weights in decimal system, there are weights for binary too. In fact every number system has weights that are powers of the number base to a natural number.

                 (MSB)                                                                                 (LSB)
                     0 .............................................................................0 0 0 0 1
MSB = 0;
LSB  =  1;

Consider 12345;
 It can be written as 10000+2000+300+40+5;
                               =1*10000+2*1000+3*100+4*10+5*1;
                               =1*(10^4)+2*(10^3)+3*(10^2)+4*(10^1)+1*(10^0);
Notice here that we split the number into partial products of the respective place digit with the respective power ,and take their sum.
As the number system is decimal, base is 10.
In binary ,the place value are .......32,      16,     8,      4,       2,      1,       0.5, 0.25,0.125, ..................
                                         ............(2^5),(2^4),(2^3),(2^2),(2^1),(2^-1),(2^-2)....................
So, 12 in binary is 1100 and 7 is 0111. This is the 4-bit representation.
LETS SUBTRACT.
 
        decimal                          binary

          12                                  1 1 0 0
       -    7                              -  0 1 1 1

       =  5                                =     ?


We humans can easily do the subtraction in decimal format because we don't look for the "logic" or "feel" of the numbers, but that is not the case with digital electronics.They have only two "senses",and they need to "feel" each of the "sense" before doing any manipulation on them.

There is a law followed to perform binary addition.
(Trust me,you need to understand this if you want to do subtraction).
                                                              DECIMAL CORRELATION          BINARY EQUIVALENT
                                                                                                                            (2^1)  (2^0)
   0 '+' 0  = 00;                                       0 + 0 = 0;                                                 0          0
   0 '+' 1 =  01;                                       0 + 1 = 1;                                                 0          1
   1 '+' 0 = 01;                                        1 + 0 = 1;                                                 0          1
   1 '+' 1 = 10;                                        1 + 1 = 2;                                                1          0


We call it "addition".
"Addition" is performed in binary by making use of the "EXOR" operation.
Thats how the system feels "addition".
  12 - 7 is equivalent to (+12) + (-7);

Binary form has a method for representing negative numbers, the two's complement form.
The way to do this is to negate all the bits of the bit sequence and then add a '1' to the LSB.

The actual definition of complement is the result obtained by subtraction of a number by the greatest number that can be represented by the bit length( i.e. all 1's).

However as circuits are not able to do subtraction, we use the former method to calculate the complement.

2's complement of -7 = not( 0 1 1 1 ) + 1 to LSB.
                                   = ( 1 0 0 0 ) + 1 to LSB
                                   = (1 0 0 1);
                                   = -7;
Note here that the '1' at the MSB is not a decimal '8' but '-8',as the bits are in 2's complement form.

Also keep in mind: TWICE THE 2'S COMPLEMENT OF A NUMBER AND YOU GET BACK THE ORIGINAL NUMBER.

NOT => '0' becomes '1';
               '1' becomes '0';

Let's try:   2's complement of -7 = not(1 0 0 1) + 1 to LSB
                                                     = (0 1 1 0) + 1 to LSB
                                                     = (0 1 1 1)
                                                     = 7.

Therefore 2's complement of  7 = -7;
                 2's complement of -7 = 7;

Add this to 12;

                12                         1 1 0 0
                 -7                         1 0 0 1

                 5                        1 0 1 0 1
If there is an carry overflow of '1' ,ignore that '1' and use the rest of the bits.
The 1 at MSB is indicative of 2's complementation.
Neglect this 1 and take the answer as 0 1 0 1; i.e decimal 5 which is the answer.

2. -12 +7 = -5.

Fast forwarding the procedure....

      12 =  1 1 0 0                                  
not 12 = 0 0 1 1                              
     -12 = 0 1 0 0                                  

-12 + 7 =      0 1 0 0
                 +  0 1 1 1

                     1 0 1 1

Here ,the MSB is a '1' and answer is within the bit limit of 4 bits(unlike in the previous case wherein 5 bit answer is generated).So perform 2's complement to answer.

after 2's complement,we get (0 1 0 0) + 1
                                            =(0 1 0 1)
                                            = -5,as we did 2's complement twice,result is negative.

REMEMBER: After computation if we get an extra MSB as 1,ignore it and the rest form the answer.
                        If the extra MSB is 0,calculate 2's complement of answer and include a '-'.

                                                             MY WAY:

Everything up till now was great and smooth running,but hideously time consuming.

LET ME MAKE A POINT CLEAR:I DON'T KNOW IF THIS METHOD PROPOSED BY ME ALREADY EXISTS OR NOT,BUT IT STRUCK ME AND I'M TELLING YOU ABOUT IT..

What I feel is that instead of directly jumping to the generation of the 2's complement bit sequence,
feed the two numbers through a comparator.
(KEEP IN MIND: OPERAND 1 IS THE POSITIVE NUMBER, OPERAND 2 IS THE NEGATIVE NUMBER).
The output of the comparator will indicate which of the two numbers is "SMALLER" or "GREATER" or "EQUAL".
By making use of two UP-COUNTERS"
  counter 1.To keep track of the clock feed count
  counter 2.the smaller data is fed to it and incremented .
The output of the latter counter is fed back to the comparator.
The cycle is stopped when the "EQUAL" signal is generated by the comparator.
The count in the former counter is the result of the subtraction of the two numbers.

Let's elaborate with the same example as above:  12 - 7;

1. The bit pattern of the two numbers are fed into the comparator, and we will get the "LESSER THAN" output as 7.
2.Feed this number 7 to counter-2 and 0 to counter-1;
3.Output of counter-2 is fedback as input to the comparator,to the bit locations of 7.
4.With each successive clock cycle,the data in both counters increment with the comparator          generating "LESSER THAN" signal, and at one particular stage,the comparator outputs an      "EQUAL".
5.This suggests the end of the process,with the count in counter-1 as the result as the subtraction of
    the two numbers.

In this case, counter-1 will hold a value of 0 1 0 1;or decimal 5;

Now consider -12 and 7;
This can be re-written as 7 -12;
operand 1= 7;     operand 2= 12;
Since the comparator now outputs a "LESSER THAN" signal,the output of the final computation is negative,or we can take a 2's complement of it.

Last example is -12 -9;

This can simply be written as -(12+9)
Feed the two values to an adder, and the answer is negative of that number.
2's complement can be taken if demanded by the situation.      



PS: BAD HANDWRITING AHEAD.





Trial 1

trial 2,still not accurate

a=12;b=7;

values


trial for -12 +7

think i got it right


explanation