tag:blogger.com,1999:blog-54742682016677405732024-03-13T13:04:58.072+05:30Creat-Tricks: Beyond the Limit of ImaginationThe journey of a thousand miles begins with a single step and that step begins with a simple thought.Sagar Patelhttp://www.blogger.com/profile/06517990297047309532noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-5474268201667740573.post-72892728886304572572016-08-07T01:55:00.001+05:302016-08-07T01:56:50.919+05:30It was happiest birthday ever!<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">As
usual at 12, it started with birthday bumps from flatmates and white makeup
with cake! It was totally expected!!! Thanks dosto.. Dosti nibhane ke liye.. :p</span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">Morning
went with kids at orphanage. We played one game which I used to play while I
was a kid. People sit in circle and put their hands on ground and one person
goes around in circle from one hand to next saying "adko dadko dai
daduko!" It was fun! Few of them are wonderful dancers or Judo champions.
Just imagine, with a small support from people like us where they can reach!
They also showed me their handmade crafts and creations. It was fun time with
them!<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">When
I left for my office at around 9.30AM, I never knew that there is a shocking
surprise on my way! When I entered on floor and glanced at my cubical, my
heartbeats instantly doubled. I cannot explain the feeling in words. Although
my cubical is hardly 20 steps away from door, I almost took 2 minutes to reach
there. I was speechless while exploring that small villa! :p It was fun to see
that my friends and juniors decorated whole cubical (not only mine but also 3
other empty cubicles besides mine!). There was invitation card of my surprise
wedding. Desktop screen was covered with Hannah Montana pics! Cubical walls
were posted with glamorous pics from newspapers! And there were balloons
floating with messages. And one balloon with “Just Divorced” message! :)
Extraordinary prank! Hats off to all who put their precious time and effort
making my day! Thank you very very much friends!!<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">In
between many people wished me and explored that awesome work done by fantastic
people. Two close friends ordered my birthday sweets since I was jam-packed
with some work. After lunch, I met few friends and said good byes since I was
about to leave. Before I left office, one friend helped me make my cubical look
exactly same it was earlier. We wrapped up everything and I saved all nice decorations
in my drawer and kept balloons on my desk. I never expected a gift on that day.
However, I got one from a person to whom I used to scold a lot. Thanks a lot
everyone!<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">After
all this, it was time to meet my family 700 miles away. Without a due I left my
office at 3, took metro from Noida and headed towards airport. I was thinking
how my day is passing. All those late night bumps, cute little smiles of kids,
the most shocking surprise by friends and juniors (you people are really
awesome!) and of course good byes with close friends. I was also thinking what
will be the reaction when I'll meet my grandfather. What my mom and dad will
say. How I'll meet my uncle. With so many thoughts I reached to IGI T3.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">While
checking in my bag, I handed my ticket to crew member at check-in counter and
as-usually asked how is she doing? Her reaction was, "Thank you sir.. koi
to aaya jisne pu6a mai kaisi hun.. I am good. How are you? How's your day
going?" I smiled and replied while handing her my voter ID card, “I am
just doing fine.” She verified my details and was about to return it and
meanwhile I interrupted her and asked if she can verify my ID. She confusingly
asked "sorry?" I asked, "Can you please check my DOB?" She
looked inside and within a moment her smile came back. She wished me. There
were few chocolates I carried for my trip. I offered one to her. And her face
seemed so happy! While giving me a boarding pass, she asked me to wait for a
moment and she got me 3 chocolates from her purse!! I never expected that. I
asked her name and thanked her. Thank you very much Farha!<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">Now
it was time to eat. I wanted to start with something sweet and simple. So I
started with yummy donuts. After that, I gave a try to Premium Plaza lounge at
IGI T3. As a kid whenever I used to watch movies and see executive lounges, I
dreamed about being there, at-least for one time in entire life. It was in my
bucket list! Believe me guys, I lived that dream for the first time on this
fabulous day. It was leisure experience!<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">After
half an hour, it was time to get on board. So, I walked to gate where I found
people waiting in a long queue, although boarding was not yet started. In between,
I went to one silent place few meters away and looked at the sky. The sun was
playing hide and seek behind clouds. It was incredible to watch sunset! Within
10 minutes, the queue was gone and now it was final call. So, I crossed a gate
and went through a lobby connecting to flight. As soon as I took my first step
inside plane, I got warm welcome from a cabin crew members. I greeted them and
just after offered them chocolates telling "it’s my birthday". I
could see their smiling faces were now full of joy! The crew lead took my seat
number and told me "you brought us chocolate, we'll have surprise for you,
sir." Omg! Again it was totally unexpected! After a minute I reached my
seat, put my handbag and got comfortable on seat. On my right side there was a
person of my dad's age. After 2-3 minutes, a flight attendant came and greeted
him personally since he was "Platinum Member" of JetPrevilage
program. After that, I started a discussion with him asking what that program
is and then it kept going. I never knew that it was just a starting of an hour
long discussion; precisely one and a half hour with a man who is also an
engineer of 80’s batch and studied in electrical field; and keeps travelling
every month! In between, crew members gave all instructions.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">It
was just 10 minutes passed and plane suddenly started towards runway. At that
time, one of crew member came to my seat and asked me to join them in front
row. I went there and found that they had prepared an awesome pastry in such a
small time. On the plate, "Happy Birthday" was also written with
chocolate cream! WoW! We had a few pics altogether and then I started with cake
cutting. Although they were strangers to me, but this kind gesture of “Jet
Airways cabin crew” deeply penetrated me. Thank you so much! You people made my
day!<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">After
that moment I was walking past front rows and people were staring at me like I
did something terribly wrong! And one crew member told everyone, "We were
just celebrating his birthday. It's his birthday!” And everyone laughed,
“hahaha..”<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">I
comfortably set and put seat-belt on. Within a minute, we took off from Asia's
longest runway at IGI airport, New Delhi. It was indeed a best flight journey
ever!<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">After
almost one and half hour, when we landed in Ahmedabad it just started to
drizzle. I love rain and I think this was a gift from an almighty god to
welcome me in my hometown! Outside airport I met my dad. I didn't know where he
get the wind that it's going to rain, he carried two raincoats. So it was clear
signal from him that we'll not be waiting till rain stops. We put our raincoats
and started towards my home in Gandhinagar, which is around half an hour from
Ahmedabad. It was like an old days when I used to pedal cycle with my friends
in rain. :) Thanks dad for making my day!<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">When
I reached home at almost 11’o clock late night, I got another surprise from my
sister and Jiju, who lives almost 7000 miles away in Canada. They ordered cake
in advance and shipped at our home in afternoon itself. My mom made full
preparation with cake and background lighting. The whole family set down and
celebrated this day full of joy. Thank you rajja (Me and my grandpa call each
other by this name!!), mammy and my uncle. Special thanks to my Didi and Jiju!!<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">After
that my mom asked me if we should proceed for dinner. I was surprised that my
parents who usually takes dinner at 8.30PM, were still waiting for me at around
11.30PM!! It was my favorite dish, Daal Bati. :)<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">We
talked over dinner about my whole day, showed them pics of cubical and orphanage
home. In the end, while we were about to finish dinner, my sister called over
phone and told me what she sent me. My mom understood everything and suddenly
stood up and went to her room. When she returned she was carrying a bag. She
opened in front of us and there were two gifts inside. One was from a beautiful
couple waiting for my smile in Canada, my didi and Jiju. Thank you didi and
jiju. You really made my day! Sorry you made my evening! (Pun intended! :p) The
other from my mom and dad. I was really speechless. I couldn't thank my
parents. I just looked into their eyes and felt their simple smile.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">After
all this I went to my room, put my earbuds, closed my eyes and remembered whole
day and then went into the enigma of life thinking how far I have reached from
the inception of my life. It definitely seems philosophical but it’s true! We
mostly realize that we’ve just gained one year or we just aged one more year or
we are now one year older than the day before; all this on our birthdays!
Birthdays are the actual day when we measure our progress knowingly or
unknowingly. Because, many of us decide new goals; and also align ourselves on-track
for promises made to ourselves on past birthdays. That’s how life keeps moving.
Anyways, that’s all.. Few things should be kept personal. Haha.. :)<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">Last
but not the least, thank you so much everyone for putting their effort making
my day extra fabulous. I am so pleased to have people like you in my life. I
hope one day I can do some favor in any possible way to make your moment! I
love you all!<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<br /></div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
</div>
<div class="MsoNormal" style="background: white; mso-background-themecolor: background1;">
<span style="font-size: large;">It
was happiest birthday ever!</span><o:p></o:p></div>
Sagar Patelhttp://www.blogger.com/profile/06517990297047309532noreply@blogger.com0tag:blogger.com,1999:blog-5474268201667740573.post-9412285698079917232013-10-21T18:31:00.000+05:302018-10-31T11:52:50.308+05:30Strings less Guitar - LASER beam as string<div style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: justify;">
Hi Guys,</div>
<div style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: justify;">
I am a big fan of Metal music. I like to listen Iron maiden and Metallica. Iron maiden is being my favorite band. No one can deny that Guitar is the heart of metal music. Well I don't know how to play that. Even i don't have it. But but but... We can make it...</div>
<div style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: justify;">
So, for entertainment, i decided to build it by my own. Moreover, i am electronics lover. So, i also thought to make it in electronics domain. There are electric bass available. But, they have metal string, which i don't want in my Guitar. I need something creative, something innovative and something attractive!!! Here comes our design fundamental.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: justify;">
As light is being the most important part of our life, i thought to use light, more specifically LASER light as a string. You might have a question, how can one generate sound using LASER light... LOL!!!</div>
<div style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: justify;">
Guys, this is where electronics comes in the picture...</div>
<div style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: justify;">
Please check the picture of LASER beam guitar with 3 strings and 12 frets, which are invisible. </div>
<div style="background-color: white; color: #333333; line-height: 18px; text-align: justify;">
<div class="separator" style="clear: both; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; text-align: center;">
</div>
<div style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;">
<br />
<br /></div>
<div class="separator" style="clear: both; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; text-align: center;">
</div>
<div class="separator" style="clear: both; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5r_AQKn_Zv2jgwgH8vz_ZbBvZUWX1n7KCAHnFoVTCZHHySNmGs1KQVtJKw-66RDTrthVnHpXbGzfwxWiO3kQCd_SGaRNziBEu49VKhp2LvebBIq3S_dsGX950rO9MRsH6fVVVcv2wOD15/s1600/1395401_578017695580613_322785180_n.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="323" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5r_AQKn_Zv2jgwgH8vz_ZbBvZUWX1n7KCAHnFoVTCZHHySNmGs1KQVtJKw-66RDTrthVnHpXbGzfwxWiO3kQCd_SGaRNziBEu49VKhp2LvebBIq3S_dsGX950rO9MRsH6fVVVcv2wOD15/s400/1395401_578017695580613_322785180_n.jpg" width="400" /></a></div>
<div style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;">
<br /></div>
<div style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;">
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwtxdIzlViDqjYBTnBpzSyxYXF5jSRKtItHLRJH4f8hG1inu7BRYTQjYwpX6RaGDUnRfNxWDesdPu78cyA5uBQc8Vtxy3yDw3oi51WfJBcRG4Pfaspd-uhbxjrIhHKuCid9drL104oyk0x/s1600/Screenshot_2014-10-24-21-50-13-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwtxdIzlViDqjYBTnBpzSyxYXF5jSRKtItHLRJH4f8hG1inu7BRYTQjYwpX6RaGDUnRfNxWDesdPu78cyA5uBQc8Vtxy3yDw3oi51WfJBcRG4Pfaspd-uhbxjrIhHKuCid9drL104oyk0x/s1600/Screenshot_2014-10-24-21-50-13-1.png" width="340" /></a></div>
Finally, the entire setup is kept in guitar wooden box and LASER lights has been arranged in such a way that they make the real guitar string. It was one of the attraction at India's first </div>
<div style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;">
<br /></div>
<span style="font-family: "times" , "times new roman" , serif; font-size: x-large;"><u><b><a href="http://www.ahmedabadmakerfaire.org/" target="_blank">Maker Fest</a></b></u></span><br />
<div style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;">
<br /></div>
<div style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;">
<b><span style="font-size: medium;"><br /></span></b>
<b><span style="font-size: medium;">Coming Soon</span></b></div>
<div style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;">
<br /></div>
<div style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;">
I hope you would check this again. Right now i am making video of LASER guitar. I'll post entire procedure, when i'll complete it. Thank you. Enjoy the day. And dream about playing yourself a LASER guitar in the most influential band.<br />
<br />
Meanwhile you can keep hardware ready to make this project. One Arduino Uno R3 will be required for this project.<br />
<span style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; text-align: start;">You can buy Arduino Uno R3 from below link</span><br style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; text-align: start;" /><a href="https://amzn.to/2QRr2IW" style="color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; text-align: start; text-decoration-line: none;">https://amzn.to/2QRr2IW</a><br />
<br />
<br />
<br />
<br /></div>
</div>
Sagar Patelhttp://www.blogger.com/profile/06517990297047309532noreply@blogger.com1tag:blogger.com,1999:blog-5474268201667740573.post-76347941570275764152013-01-05T14:05:00.002+05:302018-10-14T17:21:35.148+05:30Arduino and MATLAB GUIHello Guys,<br />
I hope you are enjoying there...<br />
Last month, i was doing small project based on Arduino and Matlab GUI. I was wondering how to handle Arduino with MATLAB GUI. I have searched over the net. And finally got it.<br />
So, let's build our own...<br />
Tools you need is following:<br />
<b><br /></b>
<b><span style="font-size: large;">Software</span></b><br />
Arduino Environment<br />
MATLAB<br />
<br />
<a name='more'></a><br />
<b><span style="font-size: large;">Hardware</span></b><br />
Arduino Board (Arduino UNO Rev3)<br />
Breadboard<br />
LED<br />
Register (1 k ohm)<br />
Jumper Wires<br />
<br />
You can buy Arduino Uno R3 from below link<br />
<a href="https://amzn.to/2QRr2IW">https://amzn.to/2QRr2IW</a><br />
<br />
<br />
<b><span style="font-size: large;">Circuit Diagram</span></b><br />
Connect the Components as shown in following circuit...<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7JIhGFXOmC74va5mMGgZm-6MPPClPZ-A7K7Ku4gf5niv3TzOvrruYtRIN7kYiYWSHfLdp03G0t0EZpQWoCrGG_FNtoq3c2i1kEljfo_gCjUy0wK162BM_l2Zabq6yfAPA-3eWmsSbWZZX/s1600/Capture.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="390" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7JIhGFXOmC74va5mMGgZm-6MPPClPZ-A7K7Ku4gf5niv3TzOvrruYtRIN7kYiYWSHfLdp03G0t0EZpQWoCrGG_FNtoq3c2i1kEljfo_gCjUy0wK162BM_l2Zabq6yfAPA-3eWmsSbWZZX/s400/Capture.PNG" width="400" /></a></div>
<br />
<br />
Now, Go to following link and download MATLAB to ARDUINO integration...<br />
<br />
<a href="https://docs.google.com/file/d/0B5uLbDqa8uuxaDV4ZHJvdl9MbzA/edit">https://docs.google.com/file/d/0B5uLbDqa8uuxaDV4ZHJvdl9MbzA/edit</a><br />
<br />
It is in .rar or .zip format. Extract it to the desktop (or any comfortable location like my documents). Rename that folder with Matduino. so it's easy to find out.<br />
<div>
<br /></div>
<br />
<b><span style="font-size: large;"><br /></span></b>
<b><span style="font-size: large;">Arduino Environment:</span></b><br />
<br />
Now, open Arduino Environment... Go to <b>FILE->OPEN</b><br />
Locate to extracted files. Go to desktop and open Matduino.<br />
There will be some folders. Just follow the following path<br />
<b>pde\adosrv\</b><br />
Now there will be one file name with <b>adiosrv.pde. </b>Open that file in Arduino Environment.<br />
Connect the board with PC via USB cable...<br />
<br />
If you are new to Ardunio follow this link how to connect board with PC and upload driver.<br />
<a href="http://arduino.cc/en/Guide/Windows#toc4" target="_blank">http://arduino.cc/en/Guide/Windows#toc4</a><br />
<br />
Upload to your board by <b>FILE->UPLOAD </b>or<b> Ctrl+U.</b><br />
Now close the Arduino Environment window.<br />
<br />
<b><span style="font-size: large;"><br /></span></b>
<b><span style="font-size: large;">MATLAB:</span></b><br />
<b><span style="font-size: large;"><br /></span></b>
Open MATLAB. Locate to Matduino folder on Desktop which you have extracted earlier. Now In matlab command window, write a command<br />
GUIDE<br />
and press enter. This will open new window as shown in following figure.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5DI42F0kG1OgsKoJO-_F4MpMW5SYczmK1x9jNgeP3PUNsCpFC9F_lLQupt0_G8WGahtaTM5odjhjQlfUB_NJaAmP_aaqTwRBBnKj7XruJDvtYikmcRjQ4HAR3J2eg-qCaY3fqPOYxWSbV/s1600/Capture2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="241" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5DI42F0kG1OgsKoJO-_F4MpMW5SYczmK1x9jNgeP3PUNsCpFC9F_lLQupt0_G8WGahtaTM5odjhjQlfUB_NJaAmP_aaqTwRBBnKj7XruJDvtYikmcRjQ4HAR3J2eg-qCaY3fqPOYxWSbV/s400/Capture2.PNG" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRNgn5IMPyFHikVnRaU4b0cgaC0BH0l37pHpPIUlxmxR3Y2v-VXW-X4ulT6HWofHb4zMFC57VD67A9agYTVZv5lFQJ7cBfy6pQ9bo5SxyKzDtD6EfZlsGKUGJkGsGw4uvSWVGI55tQjCYh/s1600/Capture3.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="265" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRNgn5IMPyFHikVnRaU4b0cgaC0BH0l37pHpPIUlxmxR3Y2v-VXW-X4ulT6HWofHb4zMFC57VD67A9agYTVZv5lFQJ7cBfy6pQ9bo5SxyKzDtD6EfZlsGKUGJkGsGw4uvSWVGI55tQjCYh/s400/Capture3.PNG" width="400" /></a></div>
<br />
Click on <b>Blank GUI(Default)</b> in <b>Create New GUI</b> Tab as shown in Above figure. And Click on <b>OK</b>. This will led to another window.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSgMt1B5J7cYMTb4l7GGa6pMvbAkCZ_gc1MfgKNmZU0MQmdDiNSqW0XHq5owSPKRJZGmAxpSyzSm8DX3mRgvBx5dq2CdFWeuZBFZPdXvdhNONlLZkCEYLSAJRoQ3LMbTXQaF6VQO7dezfO/s1600/Capture4.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="338" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSgMt1B5J7cYMTb4l7GGa6pMvbAkCZ_gc1MfgKNmZU0MQmdDiNSqW0XHq5owSPKRJZGmAxpSyzSm8DX3mRgvBx5dq2CdFWeuZBFZPdXvdhNONlLZkCEYLSAJRoQ3LMbTXQaF6VQO7dezfO/s400/Capture4.PNG" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjlM9Vz6unh0a7Ol_HbG2zGuMxsCYCSjVivqxzGTtJO2EIKuE0euIEMgBdtm0Um0V9RdqLbk8RCqkjHvn_uUKND2fSrYprnJnDHBRaJMXF-MBE3SUMW0iRmGtpC2I0d7fpMIdUiSc4fO6n/s1600/Capture5.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="356" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjlM9Vz6unh0a7Ol_HbG2zGuMxsCYCSjVivqxzGTtJO2EIKuE0euIEMgBdtm0Um0V9RdqLbk8RCqkjHvn_uUKND2fSrYprnJnDHBRaJMXF-MBE3SUMW0iRmGtpC2I0d7fpMIdUiSc4fO6n/s400/Capture5.PNG" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Now Click on Push Button as shown in above figure. And draw a button. It is shown in following figure.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaiT_zeuAGvJtuLSyJAdPt8PnUkOsZ1siS3wUuy1QyTBkKVqGkWOTFU0WbTHs_r9bqR8AIrXefQUWLIP8ANhlCFOBOCb4oQuOZab_P2CT2WKirtK7qbMH3AfjLTflZFwQ-7UvK5nz1oZ7u/s1600/Capture6.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="340" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaiT_zeuAGvJtuLSyJAdPt8PnUkOsZ1siS3wUuy1QyTBkKVqGkWOTFU0WbTHs_r9bqR8AIrXefQUWLIP8ANhlCFOBOCb4oQuOZab_P2CT2WKirtK7qbMH3AfjLTflZFwQ-7UvK5nz1oZ7u/s400/Capture6.PNG" width="400" /></a></div>
<br />
Double click on that button. So in new window you can find out the properties. Goto background colour. And Change to Green. Follow the figures...<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAfBP8F2SpC0NagGn5RLhyYCePB0XGRhWgxzKzHodD1wQpxKWgTEzFLA4oerTgVBF9QabbxnbHDh8pxESoTGPevSrSIt4KgiZzmeU7mxcn7sxBrOf9kfqx7h0LSIONKvMNr7kA8ZGh-XRA/s1600/Capture7.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAfBP8F2SpC0NagGn5RLhyYCePB0XGRhWgxzKzHodD1wQpxKWgTEzFLA4oerTgVBF9QabbxnbHDh8pxESoTGPevSrSIt4KgiZzmeU7mxcn7sxBrOf9kfqx7h0LSIONKvMNr7kA8ZGh-XRA/s400/Capture7.PNG" width="392" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Choose color as '<b>Green</b>' and Hit <b>OK</b>.</div>
<div class="separator" style="clear: both; text-align: left;">
Now scroll down and find the field '<b>FontSize</b>'.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_w5U_22IsUML2LNNXJIvHjsDIw2uTYws5Ek2erz66GriKdJH2n7EirLUtEaLIXJ-FSSkG_FzUNrQOkBXKGvpPZKrsA7GrEl4zCkp2wS0N95G8yTRVzVGL_c1H7deBjloXaoXQWg_MgxQa/s1600/Capture8.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_w5U_22IsUML2LNNXJIvHjsDIw2uTYws5Ek2erz66GriKdJH2n7EirLUtEaLIXJ-FSSkG_FzUNrQOkBXKGvpPZKrsA7GrEl4zCkp2wS0N95G8yTRVzVGL_c1H7deBjloXaoXQWg_MgxQa/s640/Capture8.PNG" width="418" /></a></div>
<br />
Change <b>FontSize</b> value to <b>40 </b>as shown in following figure. Scroll down to <b>String</b> tab.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFSB7PDAWqN15j7molRZwGlNS6ySaZ1ujNEj5BiY6rq2-KG33ZkUh9uBZf9Zsp8C9qdurg4hg_Uh81aw5YfZUc7l_zL9QcwqhVIFpDrpA3VuLaPvEqnBL_fdL75OdsKh8OTdYYwjrtz9WE/s1600/Capture9.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFSB7PDAWqN15j7molRZwGlNS6ySaZ1ujNEj5BiY6rq2-KG33ZkUh9uBZf9Zsp8C9qdurg4hg_Uh81aw5YfZUc7l_zL9QcwqhVIFpDrpA3VuLaPvEqnBL_fdL75OdsKh8OTdYYwjrtz9WE/s640/Capture9.PNG" width="418" /></a></div>
<br />
Change <b>'String'</b> value to <b>ON</b><br />
Close this Window. And check out the GUI window. This will look exactly following if you have make same changes as mine.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWQADU1UItxnY32yFeC5wBByzmGNlVWAvvbiUvcv1DfBno6cvDexhnhKoICs8Pnc1d_CgepYWEZOYimsN-7GpEV_lf6VItAS0Y1kqdyUJIWh2wH67Vkt42wSX_vKnh7u5Ar7udkPjq2QK/s1600/Capture10.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="338" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWQADU1UItxnY32yFeC5wBByzmGNlVWAvvbiUvcv1DfBno6cvDexhnhKoICs8Pnc1d_CgepYWEZOYimsN-7GpEV_lf6VItAS0Y1kqdyUJIWh2wH67Vkt42wSX_vKnh7u5Ar7udkPjq2QK/s400/Capture10.PNG" width="400" /></a></div>
<br />
<br />
Same way make new button named OFF in Red Color by same procedure. So the GUI will look as shown below.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiuprqW8YZghMh-bVz0NaUiM8ef2ge4ugYML5-wamrc4t87h-tMe0rEwIp2NwpIIJUQRavliiXV_1xS9jCJuuyLdMeBPHKGcr9u-E6aD0Ml7jnbmrhjkiWdcr25syRQ9L6z6mDesf6fqrP/s1600/Capture11.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="341" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiuprqW8YZghMh-bVz0NaUiM8ef2ge4ugYML5-wamrc4t87h-tMe0rEwIp2NwpIIJUQRavliiXV_1xS9jCJuuyLdMeBPHKGcr9u-E6aD0Ml7jnbmrhjkiWdcr25syRQ9L6z6mDesf6fqrP/s400/Capture11.PNG" width="400" /></a></div>
<br />
Go to <b>FILE->SAVE AS</b> and save the file in Matduino folder with <b>LED_MATGUI.fig.</b><br />
It will open an Editor window which may have some inbuilt code.<br />
Press<b> Ctrl+F </b>and find the code<br />
<pre class="brush:matlab">function LED_MATGUI_OpeningFcn(hObject, eventdata, handles, varargin)
</pre>
<br />
In that function you can find the line<br />
<br />
<pre class="brush:matlab">guidata(hObject, handles);
</pre>
<br />
On next line write 4 line of code. In my case Arduino board is in 'COM3' port. So in 3rd line it is written as a= arduino ('COM3'); For your configuration, find out where arduino board connected as shown in link at <a href="http://arduino.cc/en/Guide/windows#toc8" target="_blank">http://arduino.cc/en/Guide/windows#toc8</a><br />
<br />
<pre class="brush:matlab">clear all;
global a;
a = arduino('COM3');
a.pinMode(4,'output');
</pre>
<br />
Now again press <b>Ctrl+F</b> and find the code<br />
<pre class="brush:matlab">function pushbutton1_Callback(hObject, eventdata, handles)
</pre>
<br />
Within that Function Write following code
<br />
<pre class="brush:matlab">global a;
a.digitalWrite(4,1);
</pre>
<br />
Again Press <b>Ctrl+F</b> and find the code
<br />
<pre class="brush:matlab">function pushbutton2_Callback(hObject, eventdata, handles)
</pre>
<br />
Now within this function Write this 2 line of code
<br />
<pre class="brush:matlab">global a;
a.digitalWrite(4,0);
</pre>
<br />
Save this file by <b>Ctrl+S.</b> And Run the file by pressing <b>F5.</b> So the figure window will open which will have same look as GUI window. Make sure you have done exactly same thing which i have done. Now Click on ON button, this will glow LED. And same way Press OFF button. This will make LED off. If this works perfect skip the Error part. Otherwise go through it.<br />
<b><span style="font-size: large;"><br /></span></b>
<b><span style="font-size: large;">For Errors</span></b><br />
If you get Error, do it again. Still if you are getting Error follow the steps.<br />
In matlab command window write<br />
edit LED_MATGUI_export<br />
which will open new editer window. Copy the following code and paste it in this editor window.
<br />
<div style="height: 500px; overflow-y: scroll;">
<pre class="brush:matlab">function varargout = LED_MATGUI_export(varargin)
% LED_MATGUI_export MATLAB code for LED_MATGUI_export.fig
% LED_MATGUI_export, by itself, creates a new LED_MATGUI_export or raises the existing
% singleton*.
%
% H = LED_MATGUI_export returns the handle to a new LED_MATGUI_export or the handle to
% the existing singleton*.
%
% LED_MATGUI_export('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in LED_MATGUI_export.M with the given input arguments.
%
% LED_MATGUI_export('Property','Value',...) creates a new LED_MATGUI_export or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before LED_MATGUI_export_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to LED_MATGUI_export_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help LED_MATGUI_export
% Last Modified by GUIDE v2.5 05-Jan-2013 13:38:01
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @LED_MATGUI_export_OpeningFcn, ...
'gui_OutputFcn', @LED_MATGUI_export_OutputFcn, ...
'gui_LayoutFcn', @LED_MATGUI_export_LayoutFcn, ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before LED_MATGUI_export is made visible.
function LED_MATGUI_export_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to LED_MATGUI_export (see VARARGIN)
% Choose default command line output for LED_MATGUI_export
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes LED_MATGUI_export wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = LED_MATGUI_export_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Creates and returns a handle to the GUI figure.
function h1 = LED_MATGUI_export_LayoutFcn(policy)
% policy - create a new figure or use a singleton. 'new' or 'reuse'.
persistent hsingleton;
if strcmpi(policy, 'reuse') & ishandle(hsingleton)
h1 = hsingleton;
return;
end
appdata = [];
appdata.GUIDEOptions = struct(...
'active_h', [], ...
'taginfo', struct(...
'figure', 2, ...
'pushbutton', 7), ...
'override', 0, ...
'release', 13, ...
'resize', 'none', ...
'accessibility', 'callback', ...
'mfile', 1, ...
'callbacks', 1, ...
'singleton', 1, ...
'syscolorfig', 1, ...
'blocking', 0, ...
'lastSavedFile', 'C:\Users\Sagar\Documents\MATLAB\Matuino\LED_MATGUI_export.m', ...
'lastFilename', 'C:\Users\Sagar\Documents\MATLAB\Matuino\LED_MATGUI.fig');
appdata.lastValidTag = 'figure1';
appdata.GUIDELayoutEditor = [];
appdata.initTags = struct(...
'handle', [], ...
'tag', 'figure1');
h1 = figure(...
'Units','characters',...
'PaperUnits',get(0,'defaultfigurePaperUnits'),...
'Color',[0.941176470588235 0.941176470588235 0.941176470588235],...
'Colormap',[0 0 0.5625;0 0 0.625;0 0 0.6875;0 0 0.75;0 0 0.8125;0 0 0.875;0 0 0.9375;0 0 1;0 0.0625 1;0 0.125 1;0 0.1875 1;0 0.25 1;0 0.3125 1;0 0.375 1;0 0.4375 1;0 0.5 1;0 0.5625 1;0 0.625 1;0 0.6875 1;0 0.75 1;0 0.8125 1;0 0.875 1;0 0.9375 1;0 1 1;0.0625 1 1;0.125 1 0.9375;0.1875 1 0.875;0.25 1 0.8125;0.3125 1 0.75;0.375 1 0.6875;0.4375 1 0.625;0.5 1 0.5625;0.5625 1 0.5;0.625 1 0.4375;0.6875 1 0.375;0.75 1 0.3125;0.8125 1 0.25;0.875 1 0.1875;0.9375 1 0.125;1 1 0.0625;1 1 0;1 0.9375 0;1 0.875 0;1 0.8125 0;1 0.75 0;1 0.6875 0;1 0.625 0;1 0.5625 0;1 0.5 0;1 0.4375 0;1 0.375 0;1 0.3125 0;1 0.25 0;1 0.1875 0;1 0.125 0;1 0.0625 0;1 0 0;0.9375 0 0;0.875 0 0;0.8125 0 0;0.75 0 0;0.6875 0 0;0.625 0 0;0.5625 0 0],...
'IntegerHandle','off',...
'InvertHardcopy',get(0,'defaultfigureInvertHardcopy'),...
'MenuBar','none',...
'Name','LED_MATGUI',...
'NumberTitle','off',...
'PaperPosition',get(0,'defaultfigurePaperPosition'),...
'PaperSize',get(0,'defaultfigurePaperSize'),...
'PaperType',get(0,'defaultfigurePaperType'),...
'Position',[103.8 29.3076923076923 112 32.1538461538462],...
'Resize','off',...
'HandleVisibility','callback',...
'UserData',[],...
'Tag','figure1',...
'Visible','on',...
'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
appdata = [];
appdata.lastValidTag = 'pushbutton5';
h2 = uicontrol(...
'Parent',h1,...
'Units','characters',...
'FontUnits','pixels',...
'BackgroundColor',[0 1 0],...
'Callback',@(hObject,eventdata)LED_MATGUI_export('pushbutton5_Callback',hObject,eventdata,guidata(hObject)),...
'FontSize',40,...
'Position',[11.8 22.3076923076923 25.8 4.23076923076923],...
'String','ON',...
'Tag','pushbutton5',...
'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
appdata = [];
appdata.lastValidTag = 'pushbutton6';
h3 = uicontrol(...
'Parent',h1,...
'Units','characters',...
'FontUnits','pixels',...
'BackgroundColor',[1 0 0],...
'Callback',@(hObject,eventdata)LED_MATGUI_export('pushbutton6_Callback',hObject,eventdata,guidata(hObject)),...
'FontSize',40,...
'Position',[53 22.2307692307692 27 4],...
'String','OFF',...
'Tag','pushbutton6',...
'CreateFcn', {@local_CreateFcn, blanks(0), appdata} );
hsingleton = h1;
% --- Set application data first then calling the CreateFcn.
function local_CreateFcn(hObject, eventdata, createfcn, appdata)
if ~isempty(appdata)
names = fieldnames(appdata);
for i=1:length(names)
name = char(names(i));
setappdata(hObject, name, getfield(appdata,name));
end
end
if ~isempty(createfcn)
if isa(createfcn,'function_handle')
createfcn(hObject, eventdata);
else
eval(createfcn);
end
end
% --- Handles default GUIDE GUI creation and callback dispatch
function varargout = gui_mainfcn(gui_State, varargin)
gui_StateFields = {'gui_Name'
'gui_Singleton'
'gui_OpeningFcn'
'gui_OutputFcn'
'gui_LayoutFcn'
'gui_Callback'};
gui_Mfile = '';
for i=1:length(gui_StateFields)
if ~isfield(gui_State, gui_StateFields{i})
error('MATLAB:gui_mainfcn:FieldNotFound', 'Could not find field %s in the gui_State struct in GUI M-file %s', gui_StateFields{i}, gui_Mfile);
elseif isequal(gui_StateFields{i}, 'gui_Name')
gui_Mfile = [gui_State.(gui_StateFields{i}), '.m'];
end
end
numargin = length(varargin);
if numargin == 0
% LED_MATGUI_EXPORT
% create the GUI only if we are not in the process of loading it
% already
gui_Create = true;
elseif local_isInvokeActiveXCallback(gui_State, varargin{:})
% LED_MATGUI_EXPORT(ACTIVEX,...)
vin{1} = gui_State.gui_Name;
vin{2} = [get(varargin{1}.Peer, 'Tag'), '_', varargin{end}];
vin{3} = varargin{1};
vin{4} = varargin{end-1};
vin{5} = guidata(varargin{1}.Peer);
feval(vin{:});
return;
elseif local_isInvokeHGCallback(gui_State, varargin{:})
% LED_MATGUI_EXPORT('CALLBACK',hObject,eventData,handles,...)
gui_Create = false;
else
% LED_MATGUI_EXPORT(...)
% create the GUI and hand varargin to the openingfcn
gui_Create = true;
end
if ~gui_Create
% In design time, we need to mark all components possibly created in
% the coming callback evaluation as non-serializable. This way, they
% will not be brought into GUIDE and not be saved in the figure file
% when running/saving the GUI from GUIDE.
designEval = false;
if (numargin>1 && ishghandle(varargin{2}))
fig = varargin{2};
while ~isempty(fig) && ~ishghandle(fig,'figure')
fig = get(fig,'parent');
end
designEval = isappdata(0,'CreatingGUIDEFigure') || isprop(fig,'__GUIDEFigure');
end
if designEval
beforeChildren = findall(fig);
end
% evaluate the callback now
varargin{1} = gui_State.gui_Callback;
if nargout
[varargout{1:nargout}] = feval(varargin{:});
else
feval(varargin{:});
end
% Set serializable of objects created in the above callback to off in
% design time. Need to check whether figure handle is still valid in
% case the figure is deleted during the callback dispatching.
if designEval && ishghandle(fig)
set(setdiff(findall(fig),beforeChildren), 'Serializable','off');
end
else
if gui_State.gui_Singleton
gui_SingletonOpt = 'reuse';
else
gui_SingletonOpt = 'new';
end
% Check user passing 'visible' P/V pair first so that its value can be
% used by oepnfig to prevent flickering
gui_Visible = 'auto';
gui_VisibleInput = '';
for index=1:2:length(varargin)
if length(varargin) == index || ~ischar(varargin{index})
break;
end
% Recognize 'visible' P/V pair
len1 = min(length('visible'),length(varargin{index}));
len2 = min(length('off'),length(varargin{index+1}));
if ischar(varargin{index+1}) && strncmpi(varargin{index},'visible',len1) && len2 > 1
if strncmpi(varargin{index+1},'off',len2)
gui_Visible = 'invisible';
gui_VisibleInput = 'off';
elseif strncmpi(varargin{index+1},'on',len2)
gui_Visible = 'visible';
gui_VisibleInput = 'on';
end
end
end
% Open fig file with stored settings. Note: This executes all component
% specific CreateFunctions with an empty HANDLES structure.
% Do feval on layout code in m-file if it exists
gui_Exported = ~isempty(gui_State.gui_LayoutFcn);
% this application data is used to indicate the running mode of a GUIDE
% GUI to distinguish it from the design mode of the GUI in GUIDE. it is
% only used by actxproxy at this time.
setappdata(0,genvarname(['OpenGuiWhenRunning_', gui_State.gui_Name]),1);
if gui_Exported
gui_hFigure = feval(gui_State.gui_LayoutFcn, gui_SingletonOpt);
% make figure invisible here so that the visibility of figure is
% consistent in OpeningFcn in the exported GUI case
if isempty(gui_VisibleInput)
gui_VisibleInput = get(gui_hFigure,'Visible');
end
set(gui_hFigure,'Visible','off')
% openfig (called by local_openfig below) does this for guis without
% the LayoutFcn. Be sure to do it here so guis show up on screen.
movegui(gui_hFigure,'onscreen');
else
gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt, gui_Visible);
% If the figure has InGUIInitialization it was not completely created
% on the last pass. Delete this handle and try again.
if isappdata(gui_hFigure, 'InGUIInitialization')
delete(gui_hFigure);
gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt, gui_Visible);
end
end
if isappdata(0, genvarname(['OpenGuiWhenRunning_', gui_State.gui_Name]))
rmappdata(0,genvarname(['OpenGuiWhenRunning_', gui_State.gui_Name]));
end
% Set flag to indicate starting GUI initialization
setappdata(gui_hFigure,'InGUIInitialization',1);
% Fetch GUIDE Application options
gui_Options = getappdata(gui_hFigure,'GUIDEOptions');
% Singleton setting in the GUI M-file takes priority if different
gui_Options.singleton = gui_State.gui_Singleton;
if ~isappdata(gui_hFigure,'GUIOnScreen')
% Adjust background color
if gui_Options.syscolorfig
set(gui_hFigure,'Color', get(0,'DefaultUicontrolBackgroundColor'));
end
% Generate HANDLES structure and store with GUIDATA. If there is
% user set GUI data already, keep that also.
data = guidata(gui_hFigure);
handles = guihandles(gui_hFigure);
if ~isempty(handles)
if isempty(data)
data = handles;
else
names = fieldnames(handles);
for k=1:length(names)
data.(char(names(k)))=handles.(char(names(k)));
end
end
end
guidata(gui_hFigure, data);
end
% Apply input P/V pairs other than 'visible'
for index=1:2:length(varargin)
if length(varargin) == index || ~ischar(varargin{index})
break;
end
len1 = min(length('visible'),length(varargin{index}));
if ~strncmpi(varargin{index},'visible',len1)
try set(gui_hFigure, varargin{index}, varargin{index+1}), catch break, end
end
end
% If handle visibility is set to 'callback', turn it on until finished
% with OpeningFcn
gui_HandleVisibility = get(gui_hFigure,'HandleVisibility');
if strcmp(gui_HandleVisibility, 'callback')
set(gui_hFigure,'HandleVisibility', 'on');
end
feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});
if isscalar(gui_hFigure) && ishghandle(gui_hFigure)
% Handle the default callbacks of predefined toolbar tools in this
% GUI, if any
guidemfile('restoreToolbarToolPredefinedCallback',gui_hFigure);
% Update handle visibility
set(gui_hFigure,'HandleVisibility', gui_HandleVisibility);
% Call openfig again to pick up the saved visibility or apply the
% one passed in from the P/V pairs
if ~gui_Exported
gui_hFigure = local_openfig(gui_State.gui_Name, 'reuse',gui_Visible);
elseif ~isempty(gui_VisibleInput)
set(gui_hFigure,'Visible',gui_VisibleInput);
end
if strcmpi(get(gui_hFigure, 'Visible'), 'on')
figure(gui_hFigure);
if gui_Options.singleton
setappdata(gui_hFigure,'GUIOnScreen', 1);
end
end
% Done with GUI initialization
if isappdata(gui_hFigure,'InGUIInitialization')
rmappdata(gui_hFigure,'InGUIInitialization');
end
% If handle visibility is set to 'callback', turn it on until
% finished with OutputFcn
gui_HandleVisibility = get(gui_hFigure,'HandleVisibility');
if strcmp(gui_HandleVisibility, 'callback')
set(gui_hFigure,'HandleVisibility', 'on');
end
gui_Handles = guidata(gui_hFigure);
else
gui_Handles = [];
end
if nargout
[varargout{1:nargout}] = feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles);
else
feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles);
end
if isscalar(gui_hFigure) && ishghandle(gui_hFigure)
set(gui_hFigure,'HandleVisibility', gui_HandleVisibility);
end
end
function gui_hFigure = local_openfig(name, singleton, visible)
% openfig with three arguments was new from R13. Try to call that first, if
% failed, try the old openfig.
if nargin('openfig') == 2
% OPENFIG did not accept 3rd input argument until R13,
% toggle default figure visible to prevent the figure
% from showing up too soon.
gui_OldDefaultVisible = get(0,'defaultFigureVisible');
set(0,'defaultFigureVisible','off');
gui_hFigure = openfig(name, singleton);
set(0,'defaultFigureVisible',gui_OldDefaultVisible);
else
gui_hFigure = openfig(name, singleton, visible);
end
function result = local_isInvokeActiveXCallback(gui_State, varargin)
try
result = ispc && iscom(varargin{1}) ...
&& isequal(varargin{1},gcbo);
catch
result = false;
end
function result = local_isInvokeHGCallback(gui_State, varargin)
try
fhandle = functions(gui_State.gui_Callback);
result = ~isempty(findstr(gui_State.gui_Name,fhandle.file)) || ...
(ischar(varargin{1}) ...
&& isequal(ishghandle(varargin{2}), 1) ...
&& (~isempty(strfind(varargin{1},[get(varargin{2}, 'Tag'), '_'])) || ...
~isempty(strfind(varargin{1}, '_CreateFcn'))) );
catch
result = false;
end
</pre>
</div>
<br />
Save this file by <b>Ctrl+S</b>. And run by pressing <b>F5</b>. This time it will surely run.
<br />
If still you are getting errors. Make sure you have connected Arduino in correct port.<br />
<br />
<b><span style="font-size: large;">Demo:</span></b><br />
You can see this project in progress. Here is the video.<br />
<b><span style="font-size: large;"><br /></span></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dyf1EumXWccS_ez6mq_6LvHWb7rE9Rw4Qm6Q6NWUP4daolWY0fqDpI_dfkwPIBngEcqiQMDKDZ9A1MSzuLQ_w' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<br />
<br />Sagar Patelhttp://www.blogger.com/profile/06517990297047309532noreply@blogger.com6tag:blogger.com,1999:blog-5474268201667740573.post-8952412123724468202012-12-26T15:38:00.002+05:302018-10-31T11:53:29.609+05:30Virtual Guitar String with Arduino and Max/MSPHello Guys,<br />
It's been a long time since i am writing this blog. I was having a dream to generate music with hand gesture. I was looking for it. But finally i got an idea. Using Light Dependent Resistor (LDR) as a sensor, Arduino UNO as a PC interface and MAX/MSP as a Music Generator, finally i build a very basic hand movement music controller. And it sounds great....<br />
<i>The name behind Virtual Guitar String is that there is no string though we can change the tone of music...</i><br />
<b><br /></b>
<b>Let's build it...</b><br />
<b><br /></b>
<br />
<a name='more'></a>If you don't have an arduino, buy new arduino UNO R3 or any other product from<br />
<a href="https://amzn.to/2QRr2IW" style="background-color: white; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; text-decoration-line: none;">https://amzn.to/2QRr2IW</a><br />
If you are new to Arduino, first download the Arduino environment from following link.<br />
<a href="http://arduino.cc/en/Main/Software" target="_blank">http://arduino.cc/en/Main/Software</a><br />
For the first time users, install the driver as shown on this link,<br />
<a href="http://arduino.cc/en/Guide/Windows#toc4" target="_blank">http://arduino.cc/en/Guide/Windows#toc4</a><br />
<br />
<br />
<b><span style="font-size: large;">Software:</span></b><br />
(1) Arduino Environment - http://arduino.cc/en/Main/Software<br />
(2) Max/MSP - http://cycling74.com/products/max/ (Trial verson can work perfect)<br />
<b><br /></b>
<b><span style="font-size: large;"><br /></span></b>
<b><span style="font-size: large;">Hardware :</span></b><br />
(1) 100k ohm register (one)<br />
<br />
(2) LDR (one)<br />
(3) Bread board (one)<br />
(4) wires (4 to 5)<br />
<div>
Connect the componets as shown in the schematic.</div>
<br />
<br />
<b><span style="font-size: large;">Diagram 1:</span></b><br />
<b><span style="font-size: large;"><br /></span></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiddPWes_-WtTXmz8JkZRKYHVum39jI75XcAzBI5Y5qsIEmltnntPZjGDhTkk0V_r4jasBzXdjp3m-VGAZI3B80zBzTpRwrzFQ5tva_eyO5ylTRjWjFYl1Rh_PaMv0hgggDePGi5kS76K10/s1600/Schemetic.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiddPWes_-WtTXmz8JkZRKYHVum39jI75XcAzBI5Y5qsIEmltnntPZjGDhTkk0V_r4jasBzXdjp3m-VGAZI3B80zBzTpRwrzFQ5tva_eyO5ylTRjWjFYl1Rh_PaMv0hgggDePGi5kS76K10/s400/Schemetic.JPG" width="400" /></a></div>
<div style="text-align: left;">
</div>
<br />
<b><span style="font-size: large;"><br /></span></b>
<b><span style="font-size: large;">Diagram 2:</span></b><br />
<b><br /></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid4HlFgxm-CVZIZ63fvEbjZJhL5oGtCg3oEjh9P0MF5sgCi2P5KrsWBAnaRowexcedGJaDUOAN6OJxw6ATHahWypKFhpsUJNdHxdRRqTJAjJ9TjHBa3rDUhhDfE4om5OKOg16G_6j5mttO/s1600/Schemetic1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="241" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid4HlFgxm-CVZIZ63fvEbjZJhL5oGtCg3oEjh9P0MF5sgCi2P5KrsWBAnaRowexcedGJaDUOAN6OJxw6ATHahWypKFhpsUJNdHxdRRqTJAjJ9TjHBa3rDUhhDfE4om5OKOg16G_6j5mttO/s400/Schemetic1.JPG" width="400" /></a></div>
<br />
<b><br /></b>
<b><span style="font-size: large;">Diagram 3:</span></b><br />
<b><br /></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEXTLjaEd1ijecMBDn9d5Tmeool8ggYcQHFX_P_Tl5o2N8wz1REM2PfJOGNMB90hFWoG7ansoSjW_W4tMWBN5Hbs2sHET2PXGRIwEXmVsY2eziz3pKdbr8TBxlULPrOlc4mWRb1Q6Eyo0-/s1600/Schemetic2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="332" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEXTLjaEd1ijecMBDn9d5Tmeool8ggYcQHFX_P_Tl5o2N8wz1REM2PfJOGNMB90hFWoG7ansoSjW_W4tMWBN5Hbs2sHET2PXGRIwEXmVsY2eziz3pKdbr8TBxlULPrOlc4mWRb1Q6Eyo0-/s400/Schemetic2.JPG" width="400" /></a></div>
<b><br /></b>
<b><br /></b>
<b><span style="font-size: large;"><br /></span></b>
<b><span style="font-size: large;">Arduino Environment:</span></b><br />
<b><span style="font-size: large;"><br /></span></b>
For sketch, open Arduino Environment, and go to<br />
<b>File->Examples->Firmata->StandardFirmata</b><br />
So, standard Firmata sketch will open. Now Upload the sketch by pressing <b>Ctrl+U </b>or <b>File->Upload </b>option. So sketch will upload on Arduino UNO board.<br />
Now, close the Arduino Environment.<br />
<br />
<b><span style="font-size: large;">Maxuino:</span></b><br />
Now go to following link and download Maxuino 007. you can download latest version Maxuino014, but i prefere to download Maxuino007, because in my case latest version was not working properly. So, download Maxuino007.zip<br />
<a href="http://www.maxuino.org/archives/category/updates" target="_blank">http://www.maxuino.org/archives/category/updates</a><br />
or directly go to<br />
<a href="http://maxuino.org/media/maxuino-007.zip" target="_blank">http://maxuino.org/media/maxuino-007.zip</a><br />
<br />
<br />
<b><span style="font-size: large;">Max/MSP:</span></b><br />
Download the Max/MSP from this link (Trial verson works perfect) and install it...<br />
<a href="http://cycling74.com/products/max/" target="_blank"> http://cycling74.com/products/max/</a><br />
<div>
<br /></div>
<div>
Now, extract the file maxuino-007.zip and open the folder maxuino-007.</div>
<div>
Open the file<b> Arduino_test </b>in<b> Max.</b></div>
<div>
So it will look as shown in following figure.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKWYYUSFc77XjcPm-A80GoBEv3C5tA50i1HerONwPGksIXJrEoHmWH0sBdTltfWFeY0fRjx3gZpcSc9kHVx1GJKy3KYtn36L7JmcOSvP71cWPrEEMPcfhGRHqerDSY6RJKVtKpFLK7aQTd/s1600/Capture1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="368" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKWYYUSFc77XjcPm-A80GoBEv3C5tA50i1HerONwPGksIXJrEoHmWH0sBdTltfWFeY0fRjx3gZpcSc9kHVx1GJKy3KYtn36L7JmcOSvP71cWPrEEMPcfhGRHqerDSY6RJKVtKpFLK7aQTd/s400/Capture1.JPG" width="400" /></a></div>
<br />
Now, go to <b>FILE->SAVE AS. </b>Save the file as <b>arduino_test_guitar </b>in the same folder.<br />
Follow the steps shown in figure. Make sure you have connected Arduino Board with PC.<br />
<b>Step 1: </b>Select Appropriate port. In my case it is <b>COM5.</b><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<b>Step 2: </b>In <b>analog pins On/Off</b> block there is first trigger button. Check that button to check it as shown in following figure.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwkwCWZ5IZLGbzf5L0U71RX_ByxwlT7LaKsnhY87uRu03Q3HZLfHrn9rUfyKjUCQMC0kWr3LZI9ECNfRSF57DOeva1jAwa1sYDCRrphp64V3Tt_WmxsRWXDgMNhwrTsIUmaN-n-2hA0UL2/s1600/Capture2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwkwCWZ5IZLGbzf5L0U71RX_ByxwlT7LaKsnhY87uRu03Q3HZLfHrn9rUfyKjUCQMC0kWr3LZI9ECNfRSF57DOeva1jAwa1sYDCRrphp64V3Tt_WmxsRWXDgMNhwrTsIUmaN-n-2hA0UL2/s400/Capture2.JPG" width="400" /></a></div>
<br />
<br />
<b>Step 3: </b>In this step you don't need to do anything. You can see the value in analog Pins Input block, first value will take place the same value as the analog pin 0 will havem the value will be in between 0 to 1. As shown in figure 3.<br />
<b>Step 4: </b>Make new object by pressing<b> 'n' </b>or by <b>double clicking</b> in free space. Give the name <b>"s trig". </b>And connect it as shown in following figure. The output of analog pin 0 to input of created object <b>"s trig". </b>Save the patch by just pressing C<b>trl+S</b>.<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwA_ou0bFzg4p7g_aB3_GWLWjJF_hwEwcYdw8lECQBjg2LoivtQtJ0532hp5v_4uwVrQEmAyZ8r8fJOkFqjpRsRm_DEbzd0j0aOzwNm236d32yqFNafSn2PxS5LwstrbQhMkHx2Rsyqvjh/s1600/Capture3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwA_ou0bFzg4p7g_aB3_GWLWjJF_hwEwcYdw8lECQBjg2LoivtQtJ0532hp5v_4uwVrQEmAyZ8r8fJOkFqjpRsRm_DEbzd0j0aOzwNm236d32yqFNafSn2PxS5LwstrbQhMkHx2Rsyqvjh/s400/Capture3.JPG" width="400" /></a></div>
<div>
<br /></div>
<div>
Now onward all the processing is done in new patch. This patch must remain open. Go to<b> FILE->New Patcher </b>or pressing <b>Ctrl+N,</b> new patch will open. </div>
<div>
Make new patch as shown in follwing figure.<br />
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifkV0U_-8BwQE3JrdpIU2jwUh12uDiVounQVz27-atyTlE6pYCSw-GO1vMIUmzNpUIQXaMaq3OJKyqywtgnqy8HG6rmNO-fqtLdG1rLUP_4XvdR-BPBH01hqpll3zul8WpYtj03sOcgfGF/s1600/Capture4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="359" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifkV0U_-8BwQE3JrdpIU2jwUh12uDiVounQVz27-atyTlE6pYCSw-GO1vMIUmzNpUIQXaMaq3OJKyqywtgnqy8HG6rmNO-fqtLdG1rLUP_4XvdR-BPBH01hqpll3zul8WpYtj03sOcgfGF/s400/Capture4.JPG" width="400" /></a></div>
<div>
<br /></div>
<div>
If you don't know how to generate this block, don't worry. just copy following code, and paste in <b>New Patcher</b> window of <b>Max.</b><br />
<b><br /></b>
<b><span style="font-size: large;">CODE:</span></b><br />
<b><span style="font-size: large;"><br /></span></b></div>
<div style="height: 500px; overflow-y: scroll;">
<pre class="brush:cpp">{
"boxes" : [ {
"box" : {
"maxclass" : "ezdac~",
"id" : "obj-3",
"numinlets" : 2,
"numoutlets" : 0,
"patching_rect" : [ 86.154442, 202.691116, 45.0, 45.0 ]
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "* 1000.",
"id" : "obj-241",
"numinlets" : 2,
"fontsize" : 12.0,
"numoutlets" : 1,
"patching_rect" : [ 86.102966, 110.455551, 49.0, 20.0 ],
"outlettype" : [ "float" ],
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "saw~",
"id" : "obj-252",
"numinlets" : 2,
"fontsize" : 12.0,
"numoutlets" : 1,
"patching_rect" : [ 86.154442, 147.918884, 39.0, 20.0 ],
"outlettype" : [ "signal" ],
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "r trig",
"id" : "obj-185",
"numinlets" : 0,
"fontsize" : 12.0,
"numoutlets" : 1,
"patching_rect" : [ 86.102966, 69.837769, 34.0, 20.0 ],
"outlettype" : [ "" ],
"fontname" : "Arial"
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-252", 0 ],
"destination" : [ "obj-3", 1 ],
"hidden" : 0,
"midpoints" : [ 95.654442, 187.959442, 121.654442, 187.959442 ]
}
}
, {
"patchline" : {
"source" : [ "obj-252", 0 ],
"destination" : [ "obj-3", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-241", 0 ],
"destination" : [ "obj-252", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-185", 0 ],
"destination" : [ "obj-241", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
]
}
</pre>
</div>
<div>
<b><span style="font-size: large;"><br /></span></b>
<b><span style="font-size: large;"><br /></span></b>
Now, save this patch. And check out the circuit in progress. I am sure, this will work. This is done,<br />
<b>Check out my video of Virtual Guitar String by Arduino and LDR...</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dxQJQHR68wUn57tsDDWwDzoQf4BE1SpHG5Tvkdp5o3VAaQ7vjW_lfXUDVv1FkjFD-IGW3dUA-8aXDaeUQDk3A' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<br />
<br />
For Song controlled using Hand Gesture make New Patcher as shown below...<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEoIXT4CXtf-6_LESL9YLdOtrnZOKBXJZTonWMK-FZAMbmX2mnfEX5onOhFlHwlVne1Dx4DOrck_Be6-oQFi_TXEiC_Oq99DAwetfwjeEWV7SgGD1MrmXhX60x06ZIZJX4FMaGNtvEsZQ8/s1600/Capture5.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEoIXT4CXtf-6_LESL9YLdOtrnZOKBXJZTonWMK-FZAMbmX2mnfEX5onOhFlHwlVne1Dx4DOrck_Be6-oQFi_TXEiC_Oq99DAwetfwjeEWV7SgGD1MrmXhX60x06ZIZJX4FMaGNtvEsZQ8/s400/Capture5.JPG" width="366" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
If you don't want to build this, just copy and paste the following code...</div>
<div class="separator" style="clear: both; text-align: left;">
<b><span style="font-size: large;"><br /></span></b></div>
<div class="separator" style="clear: both; text-align: left;">
<b><span style="font-size: large;">CODE:</span></b></div>
<div style="height: 500px; overflow-y: scroll;">
<pre class="brush:cpp">{
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "- 200.",
"outlettype" : [ "float" ],
"patching_rect" : [ 134.879517, 72.621559, 41.0, 20.0 ],
"fontname" : "Arial",
"id" : "obj-16",
"numinlets" : 2,
"fontsize" : 12.0,
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "freqshift~",
"outlettype" : [ "signal", "signal" ],
"patching_rect" : [ 59.093952, 111.469749, 60.0, 20.0 ],
"fontname" : "Arial",
"id" : "obj-15",
"numinlets" : 2,
"fontsize" : 12.0,
"numoutlets" : 2
}
}
, {
"box" : {
"maxclass" : "ezdac~",
"patching_rect" : [ 65.633759, 153.987793, 45.0, 45.0 ],
"id" : "obj-14",
"numinlets" : 2,
"numoutlets" : 0
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "* 800.",
"outlettype" : [ "float" ],
"patching_rect" : [ 134.727707, 40.554146, 42.0, 20.0 ],
"fontname" : "Arial",
"id" : "obj-241",
"numinlets" : 2,
"fontsize" : 12.0,
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "r trig",
"outlettype" : [ "" ],
"patching_rect" : [ 135.0, 9.0, 34.0, 20.0 ],
"fontname" : "Arial",
"id" : "obj-185",
"numinlets" : 0,
"fontsize" : 12.0,
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "sfplay~ 1",
"outlettype" : [ "signal", "bang" ],
"patching_rect" : [ 11.0, 60.0, 59.0, 20.0 ],
"fontname" : "Arial",
"id" : "obj-11",
"numinlets" : 2,
"fontsize" : 12.0,
"numoutlets" : 2,
"save" : [ "#N", "sfplay~", "", 1, 120960, 0, "", ";" ]
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "open",
"outlettype" : [ "" ],
"patching_rect" : [ 69.0, 9.0, 37.0, 18.0 ],
"fontname" : "Arial",
"id" : "obj-10",
"numinlets" : 2,
"fontsize" : 12.0,
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "toggle",
"outlettype" : [ "int" ],
"patching_rect" : [ 11.0, 8.0, 35.0, 35.0 ],
"id" : "obj-8",
"numinlets" : 1,
"numoutlets" : 1
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-241", 0 ],
"destination" : [ "obj-16", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-185", 0 ],
"destination" : [ "obj-241", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-8", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-10", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 0,
"midpoints" : [ 78.5, 53.5, 20.5, 53.5 ]
}
}
, {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-15", 0 ],
"hidden" : 0,
"midpoints" : [ 20.5, 90.357758, 68.593948, 90.357758 ]
}
}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-14", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-16", 0 ],
"destination" : [ "obj-15", 1 ],
"hidden" : 0,
"midpoints" : [ 144.379517, 103.666145, 109.593948, 103.666145 ]
}
}
]
}
</pre>
</div>
<div class="separator" style="clear: both; text-align: left;">
<b><span style="font-size: large;"><br /></span></b></div>
<div class="separator" style="clear: both; text-align: left;">
<b>Check out my video of Hand Gesture Music Control Demo 1 and Demo 2...</b></div>
<div class="separator" style="clear: both; text-align: left;">
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: center;">
<b><span style="font-size: large;">Demo 1.</span></b></div>
<div class="separator" style="clear: both; text-align: left;">
<b><span style="font-size: large;"><br /></span></b></div>
<div style="text-align: center;">
<b><span style="font-size: large;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dzcHrJeZfG7HZBaqAJL0Ce40GcN7SS93dNU-A01DtUV0b6uaUA6z1RcMuD27lzGbbhF2d9TLAiCfxxS1EKxPQ' class='b-hbp-video b-uploaded' frameborder='0'></iframe></span></b></div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: center;">
<b><span style="font-size: large;"><br /></span></b></div>
<div class="separator" style="clear: both; text-align: center;">
<b><span style="font-size: large;">Demo 2.</span></b></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dwZPbOSKG6slHR4_TGJUTZJd8vxmp_iCkL8zMVe3hpuWTMpaqVHcAxY8BphtCNQVSfUkwrauk1Zp6kwbUeMLA' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Thank you for visiting my blog....</div>
<div class="separator" style="clear: both; text-align: left;">
I hope you understood the process very well...</div>
<div class="separator" style="clear: both; text-align: left;">
I am sure you will make your own Hand Gesture Control Music System... </div>
<div class="separator" style="clear: both; text-align: left;">
See you later...</div>
</div>
Sagar Patelhttp://www.blogger.com/profile/06517990297047309532noreply@blogger.com5tag:blogger.com,1999:blog-5474268201667740573.post-51435323806285864152012-11-16T00:25:00.001+05:302012-12-26T15:12:27.184+05:30Max/MSP with Arduino: Multiplexing 8 inputs using 4051Hi guys,<br />
This post explains about interfacing Max/MSP with multiplexer 4051 using Arduino. Following is the patch code. Just copy and paste in Max window. It will automatically generate the block diagram. You will need Maxuino Patch for Arduino. And follow the comments shown in the block diagram patch.<br />
<br />
<!--SYNTAX HIGHLIGHTER BEGINS-->
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css"></link>
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css"></link>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js" type="text/javascript"></script>
<script language="javascript">
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf';
SyntaxHighlighter.all();
</script>
<!--SYNTAX HIGHLIGHTER ENDS-->
<b><span style="font-size: large;">CODE:</span></b><br />
<div style="height: 500px; overflow-y: scroll;">
<pre class="brush:cpp">{
"boxes" : [ {
"box" : {
"maxclass" : "comment",
"text" : "conncet the actions to be performed. Like If you are making Pizo Drum, Create bang object to each of these output followed by a togedge object. And then make a patch with different sound of drum set like kick, Snare, Cymbal, Tom, etc... And trigger them from here.",
"linecount" : 4,
"fontsize" : 12.0,
"patching_rect" : [ 395.0, 318.0, 453.0, 62.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 0,
"id" : "obj-36"
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "The Output of 4051 is connected to Analog pin of arduino that is A0. So from Maxduino Patch connect the output of analog pin A0 to the input of float number shown below.",
"linecount" : 4,
"fontsize" : 12.0,
"patching_rect" : [ 216.0, 17.0, 242.0, 62.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 0,
"id" : "obj-2"
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Connect these three LED to Arduino Patch having digital input pin 2,3,4. Connect these 2,3,4 Pin to the selection pin of 4051 Multiplexer. The Input of multiplexrs are 8 analog inputs may be coming from Pizos or Potentiomener.",
"linecount" : 6,
"fontsize" : 12.0,
"patching_rect" : [ 98.0, 263.0, 232.0, 89.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 0,
"id" : "obj-1"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "s num",
"fontsize" : 12.0,
"patching_rect" : [ 18.0, 269.0, 43.0, 20.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 0,
"id" : "obj-55"
}
}
, {
"box" : {
"maxclass" : "flonum",
"outlettype" : [ "float", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 18.0, 241.0, 50.0, 20.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 2,
"id" : "obj-54"
}
}
, {
"box" : {
"maxclass" : "flonum",
"outlettype" : [ "float", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 829.0, 292.0, 50.0, 20.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 2,
"id" : "obj-52"
}
}
, {
"box" : {
"maxclass" : "flonum",
"outlettype" : [ "float", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 767.0, 292.0, 50.0, 20.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 2,
"id" : "obj-50"
}
}
, {
"box" : {
"maxclass" : "flonum",
"outlettype" : [ "float", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 427.0, 292.0, 50.0, 20.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 2,
"id" : "obj-48"
}
}
, {
"box" : {
"maxclass" : "flonum",
"outlettype" : [ "float", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 489.0, 292.0, 50.0, 20.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 2,
"id" : "obj-46"
}
}
, {
"box" : {
"maxclass" : "flonum",
"outlettype" : [ "float", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 700.0, 292.0, 50.0, 20.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 2,
"id" : "obj-44"
}
}
, {
"box" : {
"maxclass" : "flonum",
"outlettype" : [ "float", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 623.0, 292.0, 50.0, 20.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 2,
"id" : "obj-42"
}
}
, {
"box" : {
"maxclass" : "flonum",
"outlettype" : [ "float", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 547.0, 292.0, 50.0, 20.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 2,
"id" : "obj-40"
}
}
, {
"box" : {
"maxclass" : "flonum",
"outlettype" : [ "float", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 358.0, 292.0, 50.0, 20.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 2,
"id" : "obj-38"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "r anlg",
"outlettype" : [ "" ],
"fontsize" : 12.0,
"patching_rect" : [ 590.0, 189.0, 41.0, 20.0 ],
"numinlets" : 0,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-35"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "*",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 489.0, 248.0, 32.5, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-34"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "*",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 824.0, 242.0, 32.5, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-33"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "*",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 764.0, 245.0, 32.5, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-32"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "*",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 699.0, 245.0, 32.5, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-31"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "*",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 624.0, 248.0, 32.5, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-30"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "*",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 548.0, 248.0, 32.5, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-29"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "*",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 429.0, 248.0, 32.5, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-28"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "*",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 358.0, 248.0, 32.5, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-27"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "s anlg",
"fontsize" : 12.0,
"patching_rect" : [ 291.0, 120.0, 43.0, 20.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 0,
"id" : "obj-26"
}
}
, {
"box" : {
"maxclass" : "flonum",
"outlettype" : [ "float", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 291.0, 84.0, 50.0, 20.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 2,
"id" : "obj-25"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "== 7.",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 792.0, 123.0, 38.0, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-23"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "== 6.",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 735.0, 123.0, 38.0, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-22"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "== 5.",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 680.0, 123.0, 38.0, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-21"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "== 4.",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 622.0, 123.0, 38.0, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-20"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "== 3.",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 563.0, 123.0, 38.0, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-19"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "== 2.",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 502.0, 123.0, 38.0, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-18"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "== 1.",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 443.0, 123.0, 38.0, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-17"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "== 0.",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 387.0, 123.0, 38.0, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-16"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "r num",
"outlettype" : [ "" ],
"fontsize" : 12.0,
"patching_rect" : [ 590.0, 62.0, 41.0, 20.0 ],
"numinlets" : 0,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-15"
}
}
, {
"box" : {
"maxclass" : "led",
"outlettype" : [ "int" ],
"patching_rect" : [ 231.0, 229.0, 20.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"id" : "obj-13"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "% 2",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 231.0, 196.0, 32.5, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-12"
}
}
, {
"box" : {
"maxclass" : "led",
"outlettype" : [ "int" ],
"patching_rect" : [ 188.0, 228.0, 20.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"id" : "obj-11"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "% 2",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 188.0, 196.0, 32.5, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-10"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "/ 2",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 188.0, 167.0, 32.5, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-9"
}
}
, {
"box" : {
"maxclass" : "led",
"outlettype" : [ "int" ],
"patching_rect" : [ 145.0, 228.0, 20.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"id" : "obj-8"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : ">= 4",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 144.0, 195.0, 35.0, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-7"
}
}
, {
"box" : {
"maxclass" : "number",
"outlettype" : [ "int", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 19.0, 204.0, 50.0, 20.0 ],
"numinlets" : 1,
"fontname" : "Arial",
"numoutlets" : 2,
"id" : "obj-6"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "counter 0 0 7",
"outlettype" : [ "int", "", "", "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 74.0, 95.0, 81.0, 20.0 ],
"numinlets" : 5,
"fontname" : "Arial",
"numoutlets" : 4,
"id" : "obj-5"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "metro 100",
"outlettype" : [ "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 74.0, 66.0, 65.0, 20.0 ],
"numinlets" : 2,
"fontname" : "Arial",
"numoutlets" : 1,
"id" : "obj-4"
}
}
, {
"box" : {
"maxclass" : "toggle",
"outlettype" : [ "int" ],
"patching_rect" : [ 74.0, 34.0, 20.0, 20.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"id" : "obj-3"
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-6", 0 ],
"hidden" : 0,
"midpoints" : [ 83.5, 159.0, 28.5, 159.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"midpoints" : [ 83.5, 155.0, 153.5, 155.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-7", 0 ],
"destination" : [ "obj-8", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-9", 0 ],
"destination" : [ "obj-10", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-9", 0 ],
"hidden" : 0,
"midpoints" : [ 83.5, 141.0, 197.5, 141.0 ]
}
}
, {
"patchline" : {
"source" : [ "obj-10", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-12", 0 ],
"hidden" : 0,
"midpoints" : [ 83.5, 132.5, 240.5, 132.5 ]
}
}
, {
"patchline" : {
"source" : [ "obj-12", 0 ],
"destination" : [ "obj-13", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-25", 0 ],
"destination" : [ "obj-26", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-35", 0 ],
"destination" : [ "obj-29", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-35", 0 ],
"destination" : [ "obj-30", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-35", 0 ],
"destination" : [ "obj-33", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-35", 0 ],
"destination" : [ "obj-34", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-35", 0 ],
"destination" : [ "obj-28", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-35", 0 ],
"destination" : [ "obj-31", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-35", 0 ],
"destination" : [ "obj-32", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-28", 0 ],
"destination" : [ "obj-48", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-34", 0 ],
"destination" : [ "obj-46", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-29", 0 ],
"destination" : [ "obj-40", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-30", 0 ],
"destination" : [ "obj-42", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-31", 0 ],
"destination" : [ "obj-44", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-32", 0 ],
"destination" : [ "obj-50", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-33", 0 ],
"destination" : [ "obj-52", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-16", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-17", 0 ],
"destination" : [ "obj-28", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-17", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-18", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-18", 0 ],
"destination" : [ "obj-34", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-19", 0 ],
"destination" : [ "obj-29", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-19", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-20", 0 ],
"destination" : [ "obj-30", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-20", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-21", 0 ],
"destination" : [ "obj-31", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-21", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-22", 0 ],
"destination" : [ "obj-32", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-22", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-23", 0 ],
"destination" : [ "obj-33", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-23", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-54", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-54", 0 ],
"destination" : [ "obj-55", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-35", 0 ],
"destination" : [ "obj-27", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-27", 0 ],
"destination" : [ "obj-38", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-16", 0 ],
"destination" : [ "obj-27", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-3", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-4", 0 ],
"destination" : [ "obj-5", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
]
}
</pre>
</div>
<b><span style="font-size: large;"><br /></span></b>Sagar Patelhttp://www.blogger.com/profile/06517990297047309532noreply@blogger.com0tag:blogger.com,1999:blog-5474268201667740573.post-44908337006974087722012-11-06T20:40:00.002+05:302018-10-31T11:56:23.011+05:30Arduino: LED blinking with variable speed<!--SYNTAX HIGHLIGHTER BEGINS-->
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css"></link>
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css"></link>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js" type="text/javascript"></script>
<script language="javascript">
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf';
SyntaxHighlighter.all();
</script>
<!--SYNTAX HIGHLIGHTER ENDS-->
<br />
<div style="margin-bottom: .0001pt; margin: 0in;">
Hello guys,<o:p></o:p></div>
<div style="margin: 0in 0in 0.0001pt; text-indent: 0.5in;">
<span style="text-indent: 0.5in;">Today we are going to make an Arduino project. This
project was done in 4</span><sup style="text-indent: 0.5in;">th</sup><span style="text-indent: 0.5in;"> semester by me and my friend, Sagar. Well,
his name is also Sagar and mine too!!! </span></div>
<div style="margin: 0in 0in 0.0001pt; text-indent: 0.5in;">
Let’s discuss about the project aim.
We are going to make a circuit which contains 3 LED. And we will write an
arduino sketch to control the speed of LED Blinking. Here, we are going to make
LED blinking with variable the speed. That means, LED blinking process will
initially start with slow speed, then it will increase the blinking speed. And,
Then again it will slow down the speed...<span style="color: #222222; font-family: arial, sans-serif;"><span style="font-size: 12px;"> </span></span><span style="text-indent: 0.5in;">You will need Arduino Uno R3 for this project. If you don't have one, buy it from below link.</span><br />
<a href="https://amzn.to/2QRr2IW" style="background-color: white; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; text-decoration-line: none; text-indent: 0px;">https://amzn.to/2QRr2IW</a></div>
<div style="margin: 0in 0in 0.0001pt; text-indent: 0.5in;">
<span style="font-size: 13.5pt;"></span><br />
<a name='more'></a><br /></div>
<div style="margin: 0in 0in 0.0001pt; text-align: start; text-indent: 0.5in;">
<span style="background-color: white; color: #222222; font-size: 18pt; font-weight: bold; text-align: justify; text-indent: 0.5in;"><br /></span>
<span style="background-color: white; color: #222222; font-size: 18pt; font-weight: bold; text-align: justify; text-indent: 0.5in;">Circuit Diagram</span></div>
<div style="margin: 0in 0in 0.0001pt; text-indent: 0.5in;">
</div>
<div style="margin-bottom: .0001pt; margin: 0in; text-align: justify;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0in; text-align: justify; text-indent: .5in;">
<span style="background-color: white; color: #222222;">So, for circuit, make
the connection shown in the figure with arduino board. Connect<span class="apple-converted-space"> </span></span><b>digital pin 3, 4 and 5</b><span class="apple-converted-space"> to LED via<span class="apple-converted-space"> </span></span><b>1k register. H</b>ere make sure you connect LEDs via register. If you will not
connect register, there may be possibility of high current through
LED, which may result in short circuit the board.<o:p></o:p></div>
<div style="margin-bottom: .0001pt; margin: 0in; text-align: justify; text-indent: .5in;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uB7Vv8edcKWg_PKOFs0eDyv3tWimHF_SE0O5ryxof_lH4yyqb70Cng87Gujnaqi1ZLnmULxtev2rOHi_3_Ig6VfT9JyTJ66g_yqoytfSqk004Bshpolj46Zvx1Bvblle_QSfyh54cinE/s1600/Arduino+variable+speed+of+blinking+LED.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uB7Vv8edcKWg_PKOFs0eDyv3tWimHF_SE0O5ryxof_lH4yyqb70Cng87Gujnaqi1ZLnmULxtev2rOHi_3_Ig6VfT9JyTJ66g_yqoytfSqk004Bshpolj46Zvx1Bvblle_QSfyh54cinE/s400/Arduino+variable+speed+of+blinking+LED.PNG" width="386" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div align="center" style="margin: 0in 0in 0.0001pt; text-indent: 0.5in;">
<b><span style="background: white; color: #222222; font-family: "arial" , "sans-serif"; font-size: 9.0pt;">Schematics of Arduino UNO R3 connected
with LEDs<o:p></o:p></span></b></div>
<div align="center" style="margin: 0in 0in 0.0001pt; text-indent: 0.5in;">
<b><span style="background: white; color: #222222; font-family: "arial" , "sans-serif"; font-size: 9.0pt;"><br /></span></b></div>
<div align="center" style="margin: 0in 0in 0.0001pt; text-indent: 0.5in;">
</div>
<div style="margin-bottom: .0001pt; margin: 0in; text-align: justify; text-indent: .5in;">
<span style="background-color: white; color: #222222;">To write a sketch, open a new sketch by clicking the new in file menu. <o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0in; text-align: justify; text-indent: .5in;">
<span style="background-color: white; color: #222222;">Let’s understand the algorithm first, and then we will write the code. So
starting with an algorithm…<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0in; text-align: justify; text-indent: .5in;">
<span style="background: white; color: #222222; font-size: 13.5pt;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0in; text-align: justify; text-indent: .5in;">
<span style="background: white; color: #222222; font-size: 13.5pt;"></span></div>
<div style="margin: 0in 0in 0.0001pt;">
</div>
<div style="margin: 0in 0in 0.0001pt; text-indent: 0.5in;">
<b style="text-align: justify; text-indent: 0.5in;"><span style="background-position: initial initial; background-repeat: initial initial; font-size: 18pt;"><br /></span></b>
<b style="text-align: justify; text-indent: 0.5in;"><span style="background-position: initial initial; background-repeat: initial initial; font-size: 18pt;">Algorithm</span></b></div>
<div style="margin: 0in 0in 0.0001pt; text-indent: 0.5in;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0in; text-align: justify; text-indent: .5in;">
<span style="background-color: white; color: #222222;">To get the LED on and off, we are sure that it needs some time to stay
either ON or OFF. In other words, we can say that if LED is ON for certain
time, let’s say 2 seconds and then it will be in OFF position. So to do this,
Arduino sketch provides inbuilt function called<b> delay.</b> Delay is pauses
the circuit performance and waits for some time. When the delay is called the
argument is passed to that function is time in milliseconds. So, for our case,
an algorithm of glowing LED for 2 seconds and then LED goes to OFF stat is
below:<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0in; text-align: justify; text-indent: .5in;">
<span style="background-color: white; color: #222222;"></span></div>
<div style="margin-bottom: .0001pt; margin: 0in; text-indent: .5in;">
<b>LED ON<o:p></o:p></b></div>
<div style="margin-bottom: .0001pt; margin: 0in; text-indent: .5in;">
<b>Delay(2000)<o:p></o:p></b></div>
<div style="margin-bottom: .0001pt; margin: 0in; text-indent: .5in;">
<b>LED OFF<span style="font-size: medium;"><o:p></o:p></span></b></div>
<div style="margin-bottom: .0001pt; margin: 0in; text-indent: .5in;">
<b><br /></b></div>
<div style="margin-bottom: .0001pt; margin: 0in; text-indent: .5in;">
</div>
<div style="margin: 0in 0in 0.0001pt; text-indent: 0.5in;">
Now, to perform LED blinking in varying speed, we are sure, that we need
to somehow change the delay time of an LED to remain in ON and OFF stat. So the
main funda is to change the argument to function delay with change in time…
that’s it.<o:p></o:p></div>
<div style="margin: 0in 0in 0.0001pt; text-indent: 0.5in;">
So, let’s look at the code…<o:p></o:p></div>
<div style="margin: 0in 0in 0.0001pt; text-indent: 0.5in;">
Here, first we initialize the variable <b>j=1</b>. Then, we are going in the
loop. And in loop we will check the condition for variable <b>j</b> to be less
than <b>20</b>. If, <b>j</b> is greater or equal to <b>20</b>, then it will be
initialize to <b>1.</b> Now, we will define <b>int l=abs(10-j).</b> which will
give the absolute value of <b>(10-j). </b>This is important thing if you want
to design decreasing and increasing speed both by one loop. Then, we will
write, <b>int k=1000-(100*l). </b>So, variable <b>k </b>will be in decreasing
value function with time till <b>j=10</b>. Then, it will start increasing up to
<b>j=20</b>. Now, write the statement to glow LED with calling the delay
function with passing variable <b>k</b> as an argument. And the code is done…<o:p></o:p></div>
<div style="margin: 0in 0in 0.0001pt; text-indent: 0.5in;">
<br /></div>
<div style="margin: 0in 0in 0.0001pt; text-indent: 0.5in;">
Following is the code. <o:p></o:p></div>
<div style="margin: 0in 0in 0.0001pt; text-indent: 0.5in;">
</div>
<div style="margin-bottom: .0001pt; margin: 0in; text-align: justify; text-indent: .5in;">
<span style="background-color: white; color: #222222; text-indent: 0.5in;">Check it…</span></div>
<div style="margin-bottom: .0001pt; margin: 0in; text-align: justify; text-indent: .5in;">
<span style="background-color: white; color: #222222; font-size: 13.5pt; text-indent: 0.5in;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<b><span style="background-color: white; color: #222222;"><span style="font-size: x-large;"><br /></span></span></b>
<b><span style="background-color: white; color: #222222;"><span style="font-size: x-large;">CODE</span></span></b></div>
<pre class="brush:cpp">int ledPin1=3; //Initialize ledpin1 = digital pin 3 of arduino board.
int ledPin2=4;
int ledPin3=5;
void setup()
{
pinMode(ledPin1,OUTPUT); // Set ledpin1 (i.e. digital pin 3) as output pin
pinMode(ledPin2,OUTPUT);
pinMode(ledPin3,OUTPUT);
}
int j=1;
void loop()
{
if(j==20) // Check if j==20
{
j=1; // if j==20, set j=1. So that the circuit will start again
}
int l=abs(10-j); // Absolute value of (10-j) = l.
int k=1000-(100*l); // Setting the delay function argument
digitalWrite(ledPin1,HIGH); // ledpin1 is set to high i.e. ledpin1 is ON.
delay(k); // Delay of k milliseconds
digitalWrite(ledPin1,LOW); //ledpin1 is set to low i.e. ledpin1 is OFF.
digitalWrite(ledPin2,HIGH);
delay(k);
digitalWrite(ledPin2,LOW);
digitalWrite(ledPin3,HIGH);
delay(k);
digitalWrite(ledPin3,LOW);
delay(k);
j=j+1; // incrementing the value of j
}
</pre>
<div style="margin-bottom: .0001pt; margin: 0in; text-indent: .5in;">
<span style="background-color: white; color: #222222;"><br /></span>
<span style="background-color: white; color: #222222;"><br /></span>
<span style="background-color: white; color: #222222;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0in; text-indent: .5in;">
<span style="color: #222222; text-indent: 0.5in;">Check out this circuit in progress in following video.</span><br />
<span style="color: #222222; font-size: medium; text-indent: 0.5in;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dyfd6jiMJWiRFhmEh7LxvUjTvISCNu0KgraPgj7DcukeOxn-epUbn_8j2CfwnTlYXWblHTPqMtg31PuIfBJqw' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<span style="color: #222222; font-size: medium; text-indent: 0.5in;"><br /></span>
<span style="color: #222222; font-size: medium; text-indent: 0.5in;"><br /></span>
<span style="color: #222222; text-indent: 0.5in;">That's it buddy. I hope you will do this little project. And make some innovations like first decreasing and then increasing functions, exactly opposite to mine. </span></div>
<div style="margin-bottom: .0001pt; margin: 0in; text-indent: .5in;">
<span style="color: #222222;">Thank you. Good bye...</span></div>
<br />
<br />Sagar Patelhttp://www.blogger.com/profile/06517990297047309532noreply@blogger.com0tag:blogger.com,1999:blog-5474268201667740573.post-91242296929057653842012-11-06T00:41:00.003+05:302012-11-21T12:04:13.444+05:30MATLAB: Analog QAM with Stereo Signals<w:sdt contentlocked="t" id="89512093" sdtgroup="t"><span style="font-family: "Calibri","sans-serif"; font-size: 1.0pt; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;"><w:sdtpr></w:sdtpr><w:sdt docpart="D87B2C0C45AE42FCBBEC0E0ACBB64682" id="89512082" storeitemid="X_94B7F3E3-D9CE-4346-8E64-33AA01C4C1A0" text="t" title="Post Title" xpath="/ns0:BlogPostInfo/ns0:PostTitle"></w:sdt></span>
</w:sdt><br />
<div class="Publishwithline">
<span style="font-size: 11.5pt; text-align: justify;">Hello Guys,</span></div>
<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;">
<span style="font-size: 11.5pt;">I hope you are enjoying there. Today, I am having a
lot of work esp. final projects for semester end. My college is off from next
week due to Diwali Vacation. So, having a lot of work…<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;">
<span style="font-size: 11.5pt;">Anyway, I am taking some rest. So, wanna get back to
MATLAB.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;">
<span style="font-size: 11.5pt;">We are starting with DSB-SC scheme for modulation and
demodulation. And then we will discuss Analog Qudrature Amplitude modulation
scheme for sending two different signals at the same frequency band modulated
with sinusoid carrier. For one signal to be modulated, we are using cosine and,
for another is modulated by Sine. And we will also write a code in MATLAB to do
the analysis.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;">
<span style="font-size: 11.5pt;">Let’s look at the simple modulation scheme.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-size: 18.0pt;"></span></b><br />
<a name='more'></a><b><span style="font-size: 18.0pt;"><br /></span></b>
<b><span style="font-size: 18.0pt;"><br /></span></b>
<b><span style="font-size: 18.0pt;">DSB-SC<o:p></o:p></span></b></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW7LUpWhJ8DOHKZDup_-uPBBUSa5ucpqY_AVRTXgWJDn5hKw59Ebovjz8H20i-a_zjwDFXvetNjmBwd5AaJ9Q0TjjEJTp-UbIvIznl96wUpv_s8LW54lze0x34huy0zZFCyAwTPNeM7H5h/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW7LUpWhJ8DOHKZDup_-uPBBUSa5ucpqY_AVRTXgWJDn5hKw59Ebovjz8H20i-a_zjwDFXvetNjmBwd5AaJ9Q0TjjEJTp-UbIvIznl96wUpv_s8LW54lze0x34huy0zZFCyAwTPNeM7H5h/s1600/1.png" /></a></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br /></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none;">
<b><span style="font-size: 10.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Figure
1. </span></b><span style="font-size: 10.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Schematic representations of the amplitude
modulation and demodulation schemes: (a)<o:p></o:p></span></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<span style="font-size: 10.0pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">modulator
and (b) demodulator.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;">
<span style="font-size: 11.5pt;">Here n is time domain representing variable
(continuous time). And Acosw<sub>o</sub>n
is carrier wave. And mixer multiplies these two signals in time domain and
generates the output y[n].<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;">
<span style="font-size: 11.5pt;">Looking the time domain representation of signals…<o:p></o:p></span></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwN1w3eCGMe41O-hajqhqoR5mvbhyphenhyphenwFHnxyAQ-Hf69LTySA-Lc5ba-Qr2tTPZUgSJmPmadDMFPBgXEGz0oR9HURstm9Gc4mmyvu1SKfnvHxRyhPITZYsz5dqwnoEcSFsIvI_X1pZgBbUgB/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="386" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwN1w3eCGMe41O-hajqhqoR5mvbhyphenhyphenwFHnxyAQ-Hf69LTySA-Lc5ba-Qr2tTPZUgSJmPmadDMFPBgXEGz0oR9HURstm9Gc4mmyvu1SKfnvHxRyhPITZYsz5dqwnoEcSFsIvI_X1pZgBbUgB/s400/2.png" width="400" /></a></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br /></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b><span style="font-size: 10.0pt;">Figure 2:</span></b><span style="font-size: 10.0pt;"> (a) Message signal = m(t) = x[n]. (b) Carrier Signal
= c(t) = c[n] =Acosw<sub>o</sub>n. (c) Modulated Signal = y[n]<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;">
<span style="font-size: 11.5pt;">From Figure 2, Modulated signal is having carrier varing
in the amplitude with reference to the message signal. This scheme is also
called <b>DSB-SC (Double Side Band
Suppressed Carrier). <o:p></o:p></b></span></div>
<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;">
<span style="font-size: 11.5pt;">DSB-Sc in frequency domain is shown in following
figure.<o:p></o:p></span></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<span style="font-size: 11.5pt; mso-no-proof: yes;"><!--[if gte vml 1]><v:shape id="_x0000_i1042"
type="#_x0000_t75" style='width:380.25pt;height:168pt;visibility:visible;
mso-wrap-style:square'>
<v:imagedata src="file:///C:\Users\Sagar\AppData\Local\Temp\msohtmlclip1\01\clip_image005.jpg"
o:title="hv17"/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span><span style="font-size: 11.5pt;"><o:p></o:p></span></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZCy-nghYI4iPEPwOCI0BkiDJVKkt469xJgXHG0-S8vAglh7CowSknYot8U8TB0aTdDrfPQpicr2arok02NZFm-eeKZjqqJsrdlKvdlLtAkIY5WUvf04TdkC2FjuDrBVck1X1k1oP_KSyd/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="166" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZCy-nghYI4iPEPwOCI0BkiDJVKkt469xJgXHG0-S8vAglh7CowSknYot8U8TB0aTdDrfPQpicr2arok02NZFm-eeKZjqqJsrdlKvdlLtAkIY5WUvf04TdkC2FjuDrBVck1X1k1oP_KSyd/s400/3.png" width="400" /></a></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b><span style="font-size: 10.0pt;">Figure 3. </span></b><span style="font-size: 10.0pt;">|X(F)| = Magnitude spectrum of message signal and |Y(F)|
is Magnitude Spectrum of modulated signal<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;">
<span style="font-size: 11.5pt;">From the frequency domain representation, message
signal is of bandwidth F<sub>M</sub> and frequency of carrier is F<sub>c</sub>.
The Modulated signal is shifted to + and - F<sub>c</sub>. And the bandwidth of
modulated signal is doubled i.e. 2F<sub>M</sub> than the modulating signal. <o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;">
<span style="font-size: 11.5pt;">To demodulate the signal at the receiver end, we will
multiply the received signal i.e. y[n] with locally generated carrier (can be
extracted from received signal) and then Low Pass filtering of the signal will
give the original signal back… This way we can send a signal over the channel
i.e. wireless or wired.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;">
<b><span style="font-family: "Arial","sans-serif"; font-size: 18.0pt; mso-fareast-language: ZH-CN;"><br /></span></b>
<b><span style="font-family: "Arial","sans-serif"; font-size: 18.0pt; mso-fareast-language: ZH-CN;"><br /></span></b>
<b><span style="font-family: "Arial","sans-serif"; font-size: 18.0pt; mso-fareast-language: ZH-CN;">Analog QAM<o:p></o:p></span></b></div>
<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;">
<span style="font-size: 11.5pt;">It is possible to modulated one signal by sine wave
and other by cosine and add them together to get the modulated signal. By using
this, we can save the requirement of different frequency band for other signal.
This is also called <b>Analog Quadrature
Amplitude modulation (Analog QAM).</b> <o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;">
<span style="font-size: 11.5pt;">Let’s look at the model of QAM.<o:p></o:p></span></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<span style="font-size: 11.5pt; mso-no-proof: yes;"><!--[if gte vml 1]><v:shape id="_x0000_i1041"
type="#_x0000_t75" style='width:192pt;height:87pt;visibility:visible;
mso-wrap-style:square'>
<v:imagedata src="file:///C:\Users\Sagar\AppData\Local\Temp\msohtmlclip1\01\clip_image007.png"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span><span style="font-size: 11.5pt;"><o:p></o:p></span></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3Pv-fESkf3LbtIoZ0toWgetsCPSLU6i2VWzYEw_FwMOoRrrLGMWzW7XcM-DlKtqE38sB1gc_9T8XnTT4GA9uRXyXwnvHc9dKpcvKv37BvbsMWwypVpPtF3bMPJoTJ5vFLBUfIaIRV4Ueb/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3Pv-fESkf3LbtIoZ0toWgetsCPSLU6i2VWzYEw_FwMOoRrrLGMWzW7XcM-DlKtqE38sB1gc_9T8XnTT4GA9uRXyXwnvHc9dKpcvKv37BvbsMWwypVpPtF3bMPJoTJ5vFLBUfIaIRV4Ueb/s1600/4.png" /></a></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 10.0pt;">Figure 4. </span></b><span style="font-family: "Times New Roman","serif"; font-size: 10.0pt;">Schematic
representations of the quadrature amplitude modulation<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-justify: inter-ideograph;">
<span style="font-family: "Times New Roman","serif"; font-size: 11.5pt;">Here,
two different signals x<sub>1</sub>[n] and x<sub>2</sub>[n] are being modulated
by Acosw<sub>o</sub>n and Asinw<sub>o</sub>n (i.e. 90<sup>o</sup> shifted of
Acosw<sub>o</sub>n) respectively. So, the output of two mixer will be Ax<sub>1</sub>[n]cosw<sub>o</sub>n
and Ax<sub>2</sub>[n]sinw<sub>o</sub>n. Now the next stage is to add these two
signals to get the modulated signal y[n].<o:p></o:p></span></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-no-proof: yes;"><!--[if gte vml 1]><v:shape id="_x0000_i1040"
type="#_x0000_t75" style='width:324.75pt;height:165.75pt;visibility:visible;
mso-wrap-style:square'>
<v:imagedata src="file:///C:\Users\Sagar\AppData\Local\Temp\msohtmlclip1\01\clip_image009.png"
o:title="Capture"/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span></b><b><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt;"><o:p></o:p></span></b></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0swcW4_CqG81uijKTItiWGSuz0j2PAzko5WPjlPz0Yvwy1tHWZM8oBDWavg6WudL_gQYec2cbTIfeP_mxOJmkXS79KpXdFTfppuQgGrqVmuhBY9VB4aLnzd6wFarBf3Q_Xy1lJf0yVnKZ/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0swcW4_CqG81uijKTItiWGSuz0j2PAzko5WPjlPz0Yvwy1tHWZM8oBDWavg6WudL_gQYec2cbTIfeP_mxOJmkXS79KpXdFTfppuQgGrqVmuhBY9VB4aLnzd6wFarBf3Q_Xy1lJf0yVnKZ/s320/5.png" width="320" /></a></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 10.0pt;">Figure 5. </span></b><span style="font-family: "Times New Roman","serif"; font-size: 10.0pt;">Carrier wave (a)
Asinw<sub>o</sub>t (b) Acosw<sub>o</sub>t<o:p></o:p></span></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<br /></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGU-PspYVMvNr5lvSzSyvKNiiVXfhnG-yaNX-zMGJ7yN7H10QMrPzuLPNUCh12OowKPECmlZq-4xsWiSOM01wcY0qBjGRbMP2Qxcrj5DoPqM6eAu86xCKkD4nI8djN2eEaYyUaClE_gQSy/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="140" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGU-PspYVMvNr5lvSzSyvKNiiVXfhnG-yaNX-zMGJ7yN7H10QMrPzuLPNUCh12OowKPECmlZq-4xsWiSOM01wcY0qBjGRbMP2Qxcrj5DoPqM6eAu86xCKkD4nI8djN2eEaYyUaClE_gQSy/s320/6.png" width="320" /></a></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<br /></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<br /></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 10.0pt;">Figure 6.</span></b><span style="font-family: "Times New Roman","serif"; font-size: 10.0pt;"> Message Signal
(a) x<sub>2</sub>[n] (b) x1[n]<o:p></o:p></span></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<br /></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVoPoUUWLbkFJIpVF3vQ33YEmgUaxqR3GR_9w3PfU-cOlsuGa_yJDB3QCTnzyxGddyGzPOpJ5rQvujM2_LFEGTu-FZmfiDh0MQ6agsDlvc8wRZLMq-DPjoqLs-0J1auxYyq5chiB_QZmKK/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="149" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVoPoUUWLbkFJIpVF3vQ33YEmgUaxqR3GR_9w3PfU-cOlsuGa_yJDB3QCTnzyxGddyGzPOpJ5rQvujM2_LFEGTu-FZmfiDh0MQ6agsDlvc8wRZLMq-DPjoqLs-0J1auxYyq5chiB_QZmKK/s320/7.png" width="320" /></a></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<br /></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 10.0pt;">Figure 7. </span></b><span style="font-family: "Times New Roman","serif"; font-size: 10.0pt;">Modulated
Results (a) Ax<sub>2</sub>[n]sinw<sub>o</sub>n (b) Ax<sub>1</sub>[n]cosw<sub>o</sub>n<b><o:p></o:p></b></span></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEJML2Xncxw6W3nyHNGOe6qSlu1BgaK8trG88rMYdid_BB6dyt6WC9Z0VI_HC8aBCrEz5wbiab10RCiwyJRhf2SJVc4QBGeeTuKQcHjFelio3fKfeQRA1ZtZHmH834Vk389Are4hmUcISx/s1600/8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="109" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEJML2Xncxw6W3nyHNGOe6qSlu1BgaK8trG88rMYdid_BB6dyt6WC9Z0VI_HC8aBCrEz5wbiab10RCiwyJRhf2SJVc4QBGeeTuKQcHjFelio3fKfeQRA1ZtZHmH834Vk389Are4hmUcISx/s320/8.png" width="320" /></a></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<br /></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 10.0pt;">Figure 8.</span></b><span style="font-family: "Times New Roman","serif"; font-size: 10.0pt;"> Combined signal
for transmission i.e. final modulated signal = y[n]<o:p></o:p></span></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none; text-indent: .5in;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Times New Roman","serif"; font-size: 11.5pt;">Writing
the equation of y[n],<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none; text-indent: .5in;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none; text-indent: .5in;">
<span style="font-family: "Times New Roman","serif"; font-size: 10.0pt;"> </span><b><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt;">y[n] = Ax<sub>1</sub>[n] cos(ω<sub>o</sub>n) + Ax<sub>2</sub>[n]
sin(ω<sub>o</sub>n)<o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none; text-indent: .5in;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-justify: inter-ideograph;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt;">Note
that the two carrier signals have the same carrier frequency ωo but have a
phase difference of 90o. In general, the carrier A cos(ωon) is called the
in-phase component and the carrier A in(ωon) is called the quadrature
component. The spectrum Y (ejω) of the composite signal y[n] is now given by,<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-indent: .5in; text-justify: inter-ideograph;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-indent: .5in; text-justify: inter-ideograph;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 12.0pt;">Y (e<sup>jω</sup>)
= A/2 {X<sub>1</sub>(e<sup>j(w-wo)</sup>) + X<sub>1</sub>(<sup>j(w+wo)</sup>)}
+ A/2j {X<sub>2</sub>(e<sup>j(w-wo)</sup>) - X<sub>2</sub>(<sup>j(w+wo)</sup>)}<o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-indent: .5in; text-justify: inter-ideograph;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-justify: inter-ideograph;">
<span style="font-family: "Times New Roman","serif"; font-size: 11.5pt;">This
signal y[n] is transmitted through channel and it is received by the receiver.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-indent: .5in; text-justify: inter-ideograph;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-justify: inter-ideograph;">
<span style="font-family: "Times New Roman","serif"; font-size: 11.5pt;">To
recover the original modulating signals, the composite signal is multiplied by
both the in-phase (cosw<sub>o</sub>n) and the quadrature (sinw<sub>o</sub>n)
components of the carrier separately resulting in two signals:<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-justify: inter-ideograph;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIO5DMq6ejKYFbQG07_fyigJggQJdutfdnT9H5NUNZjF925epFLLhzd2iD1C7c_v89OUJFHvpui-brhh2dHNl4d_YuxHwOcNVHCAXzfFk8e1Rw_2mLGQOf5471Vsh2X4E99a46xIwqc58G/s1600/9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="198" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIO5DMq6ejKYFbQG07_fyigJggQJdutfdnT9H5NUNZjF925epFLLhzd2iD1C7c_v89OUJFHvpui-brhh2dHNl4d_YuxHwOcNVHCAXzfFk8e1Rw_2mLGQOf5471Vsh2X4E99a46xIwqc58G/s400/9.png" width="400" /></a></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none;">
<br /></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 11.5pt;">Figure 9. Demodulator of QAM<o:p></o:p></span></b></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-justify: inter-ideograph;">
<span style="font-family: "Times New Roman","serif"; font-size: 11.5pt;">The demodulation
process requires the carrier locally generated. Here also, the process is same
as DSB-SC demodulation. But in upper path, the carrier which is multiplying
with signal is cosw<sub>o</sub>n and for lower path it is sinw<sub>o</sub>n.
So, at the output of mixer is something like,<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-justify: inter-ideograph;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 11.5pt;"> r<sub>1</sub>[n]
= y[n] cos(ω<sub>o</sub>n) and r<sub>2</sub>[n] = y[n] sin(ω<sub>o</sub>n)<o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 11.5pt;">So,<o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none; text-indent: .5in;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 11.5pt;">r<sub>1</sub>
[n] = A/2 x<sub>1</sub>[n] + A/2 x<sub>1</sub>[n] cos (2w<sub>o</sub>n) + A/2 x<sub>2</sub>[n]
sin (2w<sub>o</sub>n) and<o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none; text-indent: .5in;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 11.5pt;">r2[n] = A/2 x<sub>2</sub>[n]
+ A/2 x<sub>1</sub>[n] sin (2w<sub>o</sub>n) - A/2 x<sub>2</sub>[n] cos (2w<sub>o</sub>n).<o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-justify: inter-ideograph;">
<span style="font-family: "Times New Roman","serif"; font-size: 11.5pt;">Now
to get both the signals back, we will pass these signals with low-pass filter
with cut-off frequency = w<sub>m</sub>. So the output of low-pass filter will
be A/2 x<sub>1</sub>[n] and A/2 x<sub>2</sub>[n] respectively. And hence, we
will get both the signals at the receiver end by transmitting in the same
frequency band.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-justify: inter-ideograph;">
<span style="font-family: "Times New Roman","serif"; font-size: 11.5pt;">Now
this is the time to implement this scheme in MATLAB.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-justify: inter-ideograph;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-justify: inter-ideograph;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-justify: inter-ideograph;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 18.0pt;">MATLAB Implementation<o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-justify: inter-ideograph;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-justify: inter-ideograph;">
<span style="font-family: "Times New Roman","serif"; font-size: 11.5pt;">For
doing this, we will use an audio file (in wav format). This file have two audio
component i.e. left and right audio. So, we will get two different signal like <b>x<sub>1</sub>[n]=left signal</b> and <b>x<sub>2</sub>[n]=right signal</b>. Now, we
will modulate these signals with sinusoid signals of freq w<sub>o </sub>=
16kHz. But t do that, first we need to understand the problem with matlab to do
modulation. Matlab works with signal in terms of matrix. All matrix are
discrete quantities. So, to get the perfect (not perfect but somewhat more)
glimpse of analog signal we will up-sample the signal by <b>10. </b>And then we will modulate it add it and transmit it. To
understand the modulation and demodulation only we are not considering the noise
(In practice, the noise will always be present). Now, at the other end,
received signal is same as transmitted signal because, noise is not considered.
So, to get the original signal back, we will multiply the signal with in-phase
and quadrature-phase component of w<sub>o</sub> frequency. Then for low-pass
filter we will design Butterworth low-pass filter having pass band frequency
4kHz and stop band = 10kHz. The next thing is to down sample the signal to
remove the extra samples which we have added at the modulation time. Now we
will get the left and right signal back. To get the original audio signal back
i.e. stereo signal, we will structure the matrix of received left and right
file. And then we will listen the audio.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: justify; text-autospace: none; text-justify: inter-ideograph;">
<span style="font-family: "Times New Roman","serif"; font-size: 11.5pt;">Following
are the figures, which will help to learn in better way with graphical
representation.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<br /></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<br /></div>
<div align="center" class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-align: center; text-autospace: none; text-indent: .5in;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOEHw7y2MjPsDjyz9V8Rzcr_2sMji1KiSSpJt-huJWGdusoZcLfEhTtviYEkjHqKeBjeBIsOstzQ-hbEUXW0qznvB8DBKLID0j-rY4KntK17yTwj9F_eEjBYZf3Oz1Y45OS4HRkGbWL7bs/s1600/10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOEHw7y2MjPsDjyz9V8Rzcr_2sMji1KiSSpJt-huJWGdusoZcLfEhTtviYEkjHqKeBjeBIsOstzQ-hbEUXW0qznvB8DBKLID0j-rY4KntK17yTwj9F_eEjBYZf3Oz1Y45OS4HRkGbWL7bs/s400/10.png" width="400" /></a></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br />
<!--[endif]--></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b>Figure 10.</b> Stereo signal with left and Right channel signal and
their zooming version</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAuJB21OEhx76MSf86OwefpRbvNhBg-qM4Rtd7QC5FPifSAE1gFIZg9v4t2drUmPv3bihUvebBcsHpPjSRcIM-1PSCisyrxrVuyQoleTbwCJN6btiASSyRdymO9TTnLtW-VmqZH-WCwFWR/s1600/11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAuJB21OEhx76MSf86OwefpRbvNhBg-qM4Rtd7QC5FPifSAE1gFIZg9v4t2drUmPv3bihUvebBcsHpPjSRcIM-1PSCisyrxrVuyQoleTbwCJN6btiASSyRdymO9TTnLtW-VmqZH-WCwFWR/s400/11.png" width="400" /></a></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br />
<!--[endif]--></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b>Figure 11.</b> Left signal and Up-Sampled with interpolation (Zooming
Version)</div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPBb2nFLQMroxme0ngbLvkU6ALvqC_IjuAWKQiYCGUYiYViq4yzNHZ3VO6Fd94sWAR_wfVZwvDBvYCC1fUedLMpHHRnm0xPCHK3SU7PZnjVuJOwyymDBU8wG0LB1ZVGE2JXKFat8UlQ3wp/s1600/12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPBb2nFLQMroxme0ngbLvkU6ALvqC_IjuAWKQiYCGUYiYViq4yzNHZ3VO6Fd94sWAR_wfVZwvDBvYCC1fUedLMpHHRnm0xPCHK3SU7PZnjVuJOwyymDBU8wG0LB1ZVGE2JXKFat8UlQ3wp/s400/12.png" width="400" /></a></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br />
<!--[endif]--></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b>Figure 12.</b> Frequency Response of Cosine wave</div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMQjWipzrh_JbUUDZiC4Af2vhigXDVqu_BZzlL5VHAs54_8NNX_1qrTF-DNfXDnfNBlcFjtRmmv7eSS0Xl1gAJb4rz_1Jsy2vedPH4f5mOpPkCCu06TI0Tjs0_T-UQYyEDpAIEpybFjqiX/s1600/13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMQjWipzrh_JbUUDZiC4Af2vhigXDVqu_BZzlL5VHAs54_8NNX_1qrTF-DNfXDnfNBlcFjtRmmv7eSS0Xl1gAJb4rz_1Jsy2vedPH4f5mOpPkCCu06TI0Tjs0_T-UQYyEDpAIEpybFjqiX/s400/13.png" width="400" /></a></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br />
<!--[endif]--></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b>Figure 13.</b> Frequency Response of Sine wave</div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWyUKk772TwqdNG_JenES9LCTBbXAlbTX26PETkzR4QEDT5Es0P-CSlmyJclL2pzCRmmPwc3v5b4o6Z1Hfo2zawfTNIIyKXvGM09YHOiUKVg8ZhYY073J8Y35LDVuKEtnbvn_K43ImIDae/s1600/14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWyUKk772TwqdNG_JenES9LCTBbXAlbTX26PETkzR4QEDT5Es0P-CSlmyJclL2pzCRmmPwc3v5b4o6Z1Hfo2zawfTNIIyKXvGM09YHOiUKVg8ZhYY073J8Y35LDVuKEtnbvn_K43ImIDae/s400/14.png" width="400" /></a></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br />
<!--[endif]--></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b>Figure 14.</b> Left and Right wave with carrier and modulated wave</div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhte4Bl3RoOvYVeVGqnZwZT5pr7uOV1ZWhbtBERPRGKN-DFskperHF0zsknYxTshCvUircfCXHZNfkFfPSqeCJJ_Mku-eAYjyDwLR4rBgDUpRz0cEa8NwsxsT3kuZE_DoODpAJJzRp6WENs/s1600/15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhte4Bl3RoOvYVeVGqnZwZT5pr7uOV1ZWhbtBERPRGKN-DFskperHF0zsknYxTshCvUircfCXHZNfkFfPSqeCJJ_Mku-eAYjyDwLR4rBgDUpRz0cEa8NwsxsT3kuZE_DoODpAJJzRp6WENs/s400/15.png" width="400" /></a></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br />
<!--[endif]--></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b>Figure 15.</b> Separately Modulated wave and their addition i.e. final
transmitted wave</div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-eLwSFxQAh2DGL44G2YwEZbo_wQg_g0yNxBRpR5LdaTLVQ-P4OLQEw5hSQFbpJq8TAClls0I6J7cKx36skADVcRf6k4nO4EplAIUeMP-hFZc-Y7DYM7EwxkJ4B6u77QbtExgh5-qV7I0g/s1600/16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-eLwSFxQAh2DGL44G2YwEZbo_wQg_g0yNxBRpR5LdaTLVQ-P4OLQEw5hSQFbpJq8TAClls0I6J7cKx36skADVcRf6k4nO4EplAIUeMP-hFZc-Y7DYM7EwxkJ4B6u77QbtExgh5-qV7I0g/s400/16.png" width="400" /></a></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br />
<!--[endif]--></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b>Figure 16.</b> Frequency Spectrum of Message signal, Carrier and
Modulated wave.</div>
<div align="center" class="MsoNormal" style="text-align: center;">
</div>
<div align="center" class="MsoNormal">
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJmFgvz40JNyGBes6OfHYKKdPoR3WL1CX4hrcHbYHHd753rm4wFImUOabM0NGIlds47sHiLoY7BPTpaHC6s2pXGt07uzswVS9xmlQ4wzqhFAnsOrDTaqZUqBLRDpwMM3i8HshqC7WplSD9/s1600/17.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJmFgvz40JNyGBes6OfHYKKdPoR3WL1CX4hrcHbYHHd753rm4wFImUOabM0NGIlds47sHiLoY7BPTpaHC6s2pXGt07uzswVS9xmlQ4wzqhFAnsOrDTaqZUqBLRDpwMM3i8HshqC7WplSD9/s400/17.png" width="400" /></a></div>
<div align="center" class="MsoNormal">
<b><br /></b></div>
<div align="center" class="MsoNormal">
<b>Figure 17.</b> Spectra of Received signal and their multiplication with in-phase and quadrature component of frequency w<sub>o</sub>.(Here for rec1 and rec2 the higher freq component is overwriting. i.e. actually higher freq. component is at 3.2kHz. But due to insufficient FFT samples it is showing ar 1.2kHz)</div>
<div align="center" class="MsoNormal">
<o:p> </o:p> </div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-PQ9fMCOIFlvVRR2Z5bh49MdntUWmAgj7028FK7oDlA8ESxix6iVOF2MuwAWUDlUMXBEwQIWjwwoNth6Z7Y-15l3VUdo2fYRZ-fSZdznAhVesE-z4La7jFsWbwSOITT1DtkSztk28o6MI/s1600/18.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-PQ9fMCOIFlvVRR2Z5bh49MdntUWmAgj7028FK7oDlA8ESxix6iVOF2MuwAWUDlUMXBEwQIWjwwoNth6Z7Y-15l3VUdo2fYRZ-fSZdznAhVesE-z4La7jFsWbwSOITT1DtkSztk28o6MI/s400/18.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: center;">
<b>Figure 18.</b> Butterworth Low-Pass Filter Response <b>(F<sub>p</sub>=4kHz and F<sub>s </sub>= 10kHz)</b></div>
<div class="separator" style="clear: both; text-align: center;">
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGJOm59B8ThZ1zvF9dzHud9HF4JtyhxrNtdgxcQ-XPkny1u2qMkj96LJhSqkvP-bBiRoqjLOsTQYc1Lq0nyfXLO25rYPGKKswe6w44FYbMICOMtIWQ8Dw_aQuH9gN5-IeoRfpHdzt6ywKo/s1600/19.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGJOm59B8ThZ1zvF9dzHud9HF4JtyhxrNtdgxcQ-XPkny1u2qMkj96LJhSqkvP-bBiRoqjLOsTQYc1Lq0nyfXLO25rYPGKKswe6w44FYbMICOMtIWQ8Dw_aQuH9gN5-IeoRfpHdzt6ywKo/s400/19.png" width="400" /></a></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b>Figure 19.</b> Frequency Spectrum of Received signal, Multiplied
received signal with carrier overlaying the bandpass response and low pass
filtered signal.</div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgS_hFTW2Z4SSgVUOsn8NyoC8riBlsaWdU2w_LTbhAcfD6JnV_-3ZiIpMYf0W9V4VCwAt4bswwf3tz6eitemyH1jWSfRtSVKDlK_DWmBfMEoecXFKYe0qah1Q0Pju4Wsgx0ruCzraxx1Mn9/s1600/20.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgS_hFTW2Z4SSgVUOsn8NyoC8riBlsaWdU2w_LTbhAcfD6JnV_-3ZiIpMYf0W9V4VCwAt4bswwf3tz6eitemyH1jWSfRtSVKDlK_DWmBfMEoecXFKYe0qah1Q0Pju4Wsgx0ruCzraxx1Mn9/s400/20.png" width="400" /></a></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<o:p><br /></o:p></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<!--[if gte vml 1]><v:shape id="Picture_x0020_11"
o:spid="_x0000_i1025" type="#_x0000_t75" style='width:420pt;height:315pt;
visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file:///C:\Users\Sagar\AppData\Local\Temp\msohtmlclip1\01\clip_image039.emz"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b>Figure 20.</b> Received Signal 1 = Left (Upper one), Received signal 2
= Right (Middle One) and Generated Stereo Signal (Lower one)</div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br /></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br /></div>
<div class="MsoNormal">
The code for this program is </div>
<div class="MsoNormal">
<br />
<div style="height: 500px; overflow-y: scroll;">
<pre class="brush:matlab">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Project
% Aim : To implement the analog Quadrature amlitude modultaion scheme on stereo.
% Here we approch, modulating two signals i.e. left and right channel signal of stereo
% signal, with same frequency of sinusoid. But one of the signal will get
% modulated by sine and other with cosine. As the sine and cosine are of
% pi/2 phase, the corelation (i.e. integreation over a period) is zero. So
% to use this phenomena, both the modulated signal is added with
% each-other and then we will transmit them. Here to give the glimps of
% analog signal we are using audio in wav file format, which is loss-less
% format among the all audio compression standard. Though, now-a-days the
% audio becomes digital. So one more thing to do is upsample the signal, so
% that it will look like upsampled(20-20kHz upsampled by 10. so 2-2kHz)
% analog singnal. And then we will modulate both the singal by 16kHz
% sinusiod wave. Then add it. And transmitting the modulated singal.
% On the other hand, we receive the signal which is sent through the
% channel, maybe wireless or wired depeding upon the choice w.r.t economy or
% environment(beheaviour). So there will be some noise received at the
% receiver end. But for simplicity, to understand the modulation and
% demodulation process, assuming the nosie on the receiver end is zero i.e.
% ideal condition. Now, To demodulate the signal, we pass the received
% signal in two parallel circuits. In which, one mixes the sine wave and
% other mixes the cosine wave by mixer. Here also assumed that the carreir
% at the receiver side is in sync. with the received signal carreir. We can
% extract carrier from the received signal also. Now the next thing is to
% get the left and right channel signal back by passing the output of
% mixer into low-pass filter at the receiver end. Here we are using
% ButterWorth Low-Pass Filter. Then we will downsample the signals and we
% will get both the singal. If we are modulating stereo, then at the other
% end we need to get the stereo sound back by formating the two signals at
% the received end.
%% Detalis about Author
% Author : Sagar Patel
% Email ID : sagarpatel.9556@gmail.com
%% Initilizing and Reading the data
clear all;
clc;
close all;
clf;
[signal fs]=wavread('sample.wav');
Time=length(signal)/fs; % In Seconds
%% Left and Right Audio Signals
s_l=signal(:,1)';
s_r=signal(:,2)';
%% Plotting the Data
figure(1);
t=0:1/fs:Time-(1/fs);
subplot(321);
plot(t',signal);
title('Stereo Signal');
xlabel('Time (seconds)');ylabel('Amplitude');
subplot(322);
plot((50000:51000)/fs,signal(50000:51000,:));
title('Stereo Signal (ZOOM UP) <50000-51000>');
xlabel('Time (seconds)');ylabel('Amplitude');
subplot(323);
plot(t',s_l);
title('Left Signal');
xlabel('Time (seconds)');ylabel('Amplitude');
subplot(324);
plot((50000:51000)/fs,s_l(50000:51000));
title('Left Signal (ZOOM UP) <50000-51000>');
xlabel('Time (seconds)');ylabel('Amplitude');
subplot(325);
plot(t',s_r);
title('Right channel Signal');
xlabel('Time (seconds)');ylabel('Amplitude');
subplot(326);
plot((50000:51000)/fs,s_r(50000:51000));
title('Right Signal (ZOOM UP) <50000-51000>');
xlabel('Time (seconds)');ylabel('Amplitude');
%% Listening the Sound
display('Lets listen to the stereo Sound <press any="any" key="key">');
pause;
sound(signal,fs);
display('Stereo Sound');
pause;
display('Lets listen to left channel signal <press any="any" key="key">');
pause;
sound([s_l',zeros(length(s_l),1)],fs);
display('Left sound');
pause;
display('Lets listen to right channel signal <press any="any" key="key">');
pause;
sound([zeros(length(s_r),1),s_r'],fs);
display('Right sound');
pause;
%% Up Sampling to Modulate the Signal
L = 10; % Up-Sampling Co-Efficient
x1 = s_l;
x2 = s_r;
% Generating the interpolated output sequence
y1 = interp(x1,L);
y2 = interp(x2,L);
% Ploting the input (left) and the output (upsampled left) sequences
figure(2);
subplot(2,1,1);
n=10000:10100;
stem(n,x1(n(1):n(length(n))));
title('Left Sequence <zoom up="up">');
xlabel('Time index n'); ylabel('Amplitude');
subplot(2,1,2);
m = L*n(1):(n(length(n))*L)-1;
stem(m,y1(m(1):m(length(m))));
title('Up Sampled Left Sequence <zoom up="up">');
xlabel('Time index n'); ylabel('Amplitude');
s_l_up = y1;
s_r_up = y2;
%% Generating a carrier
fc = 16000;
A = 1;
t = 0:1/fs:(length(s_l_up)-1)/fs;
carrier = A*cos(2*pi*fc*t);
carrier2 = A*sin(2*pi*fc*t);
figure(3);
subplot(221);
plot(t,carrier);
title('Carrier Wave - Cosine (16 kHz)');
xlabel('Time (seconds)');
ylabel('Amplitude (seconds)');
subplot(222);
plot(t(100:150),carrier(100:150));
title('Carrier Wave - Cosine <zoom up="up">');
xlabel('Time (seconds)');
ylabel('Amplitude (seconds)');
subplot(223);
plot(t,carrier2);
title('Carrier Wave - Sine (16 kHz)');
xlabel('Time (seconds)');
ylabel('Amplitude (seconds)');
subplot(224);
plot(t(100:150),carrier2(100:150));
title('Carrier Wave - Sine <zoom up="up">');
xlabel('Time (seconds)');
ylabel('Amplitude (seconds)');
figure(4);
freqz(carrier,1,512,fs);
title('Frequency Response of Carrier - Cosine');
figure(5);
freqz(carrier2,1,512,fs);
title('Frequency Response of Carrier - Sine');
%% Modulation the Snare signal with Carrier
mod1 = s_l_up.* carrier;
mod2 = s_r_up.* carrier2;
mod = mod1 + mod2;
%% Plotting in Time domain
figure(6);
subplot(311);
plot(s_l_up(104000:105000));
hold on;
plot(s_r_up(104000:105000),'-g');
title('Left(B) and Right(G) in time domain');
subplot(312);
plot(carrier(104000:105000));
title('Carrier in time domain');
subplot(313);
plot(mod1(104000:105000));
hold on;
plot(mod2(104000:105000),'-g');
title('Modulated - Left(B) Right(G) - in time domain');
figure(7);
subplot(311);
plot(mod1(104000:105000));
title('Left Modulated in time domain');
subplot(312);
plot(mod2(104000:105000));
title('Right Modulated in time domain');
subplot(313);
plot(mod(104000:105000));
title('Modulated signal in time domain');
%% Plotting the FFT of Signals
figure(8);
NFFT = 65536*2*2;
wd = [-pi:2*pi/(NFFT-1):pi]; %digital frequency in rad/s
fd = [-pi:2*pi/(NFFT-1):pi]/(2*pi); %digital frequency in hz
Fa = fd * fs; %analog freq in hz
subplot(321);
plot(Fa,abs(fftshift(fft(s_l_up,NFFT))));
title('FFT of Up-Sampled of Left signal');
subplot(322);
plot(Fa,abs(fftshift(fft(s_r_up,NFFT))));
title('FFT of Up-Sampled of Right signal');
subplot(323);
plot(Fa,abs(fftshift(fft(carrier,NFFT))));
title('FFT of Carrier Signal - Cosine');
subplot(324);
plot(Fa,abs(fftshift(fft(carrier2,NFFT))));
title('FFT of Carrier Signal - Sine');
subplot(325);
plot(Fa,abs(fftshift(fft(mod1,NFFT))));
title('FFT of modulated signal');
subplot(326);
plot(Fa,abs(fftshift(fft(mod2,NFFT))));
title('FFT of modulated signal');
%% Demodulation
rec=mod;
%Here we can generate carrier locally or by extracting from signal
%So using the transmitted carreir to co-relate
rec1 = rec.*carrier;
rec2 = rec.*carrier2;
%% Plotting the FFt of Demodulated rec1 and rec2
figure(9);
subplot(311);
plot(Fa,abs(fftshift(fft(rec,NFFT))));
title('Received Signal Spectrum');
subplot(312);
plot(Fa,abs(fftshift(fft(rec1,NFFT))));
title('rec1 Signal Spectrum');
subplot(313);
plot(Fa,abs(fftshift(fft(rec2,NFFT))));
title('rec2 Signal Spectrum');
%% Generating a Low Pass Filter
F_Pass= 4000; %PassBand Freq = 4kHz
F_Stop= 10000; %StopBand Freq = 10kHz
F_s=fs;
fd_p = F_Pass / F_s;
fd_s = F_Stop / F_s;
Rp = 0.5;
Rs = 30;
[Order, Cut_off] = BUTTORD(fd_p, fd_s, Rp, Rs);
[num,den] = BUTTER(Order,Cut_off);
%% Demodulating the signal by extracting the carrier
clear mod1 mod2;
rec_1_Filtrd = filter(num,den,rec1);
rec_2_Filtrd = filter(num,den,rec2);
figure(10);
[H,F] = FREQZ(num,den,512,F_s*2);
plot(F,abs(H));
title('Frequency Respose of LowPass Filter');
%% Plotting the FFT
figure(11);
subplot(311);
plot(Fa,abs(fftshift(fft(rec,NFFT))));
title('Received Signal Spectrum');
subplot(312);
plot(Fa,abs(fftshift(fft(rec1,NFFT))));
hold on;
f_vary = [-flipud(F); F];
h_vary = [flipud(abs(H)); abs(H)];
plot(f_vary,2000*h_vary,'r');
title('Received 1 Signal Spectrum and LowPass Response');
subplot(313);
plot(Fa,abs(fftshift(fft(rec_1_Filtrd,NFFT))));
title('Low Pass Filtered Signal Spectrum');
%% Downsampling Data
lft_dwn = rec_1_Filtrd(1:L:end);
rht_dwn = rec_2_Filtrd(1:L:end);
%% Generating Stereo
final = [lft_dwn' rht_dwn'];
%% Plotting Received Downsampled signals in Time domain
figure(12);
t=0:1/fs:Time-(1/fs);
subplot(311);
plot(t,lft_dwn);
title('Left Signal in Time Domain');
xlabel('Time (Seconds)');ylabel('Amplitude');
subplot(312);
plot(t,rht_dwn);
title('Right Signal in Time Domain');
xlabel('Time (Seconds)');ylabel('Amplitude');
subplot(313);
plot(t',final);
title('Stereo Signal (Left = B and Right = G) in Time Domain');
xlabel('Time (Seconds)');ylabel('Amplitude');
%% Plotting Error Signal (We have not included AWGN. So Error = 0)
E_l = s_l - lft_dwn;
E_r = s_r - rht_dwn;
E_str = signal - final;
figure(13);
t=0:1/fs:Time-(1/fs);
subplot(311);
plot(t,E_l);
title('Error in Left Signal in Time Domain');
xlabel('Time (Seconds)');ylabel('Amplitude');
subplot(312);
plot(t,E_r);
title('Error in Right Signal in Time Domain');
xlabel('Time (Seconds)');ylabel('Amplitude');
subplot(313);
plot(t',E_str);
title('Error in Stereo Signal (Left = B and Right = G) in Time Domain');
xlabel('Time (Seconds)');ylabel('Amplitude');
%% Listening to the Saperate channels
display('Left Received and Down-sampled Signal <press any="any" key="key">');
pause;
sound([lft_dwn' zeros(length(lft_dwn),1)],fs);
display('Left Signal');
pause;
display('Right Received and Down-sampled Signal <press any="any" key="key">');
pause;
sound([zeros(length(rht_dwn),1) rht_dwn'],fs);
display('Right Signal');
pause;
%% Playing a stereo Signal
display('Received Stereo Signal <press any="any" key="key">');
pause;
sound(final,fs);
display('Received Signal');
pause;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
</press></press></press></zoom></zoom></zoom></zoom></press></press></press><!--50000-51000--><!--50000-51000--><!--50000-51000--></pre>
</div>
<br />
<br />
Guys, I hope that you will run this code and I am pretty
sure that you will enjoy…</div>
<div class="MsoNormal">
If you would like to do some innovation like adding an
additive white Gaussian noise, changing the filter type i.e. chebysev,
Elliptic, Bessel,etc.</div>
<div class="MsoNormal">
Thank you buddy… Bye…</div>
Sagar Patelhttp://www.blogger.com/profile/06517990297047309532noreply@blogger.com1tag:blogger.com,1999:blog-5474268201667740573.post-61165970558723191872012-10-26T23:55:00.000+05:302018-10-31T11:58:11.146+05:30Arduino 3 Bit Counter with code and schemeticsHi guys,<br />
<br />
<div style="text-align: justify;">
In this blog, I am going to show how to make 3 Bit counter using Arduino with Code and Schematics.<br />
For this you'll need Arduino Uno R3. If you don't have one, you can buy it from below link.<br /><a href="https://amzn.to/2QRr2IW" style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; text-align: start; text-decoration-line: none;"><span style="color: red;">https://amzn.to/2QRr2IW</span></a><br />
<br />
<br /></div>
<div style="text-align: justify;">
For making 3 bit up counter we need to first understand desired outputs.</div>
<div style="text-align: justify;">
The output for 3 bit up counter will start from 000 to 111.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
000 -->> 001 -->> 010 -->> 011 -->> 100 -->> 101 -->> 110 -->> 111 -->> 000.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
So for circuit, make the connection shown in the figure with arduino board. Connect <b>digital pin 3,4 and 5</b> to LED via <b>1k register. H</b>ere make sure you connect LEDs via register. If you will not connect register, there may be possibility of high current through LED, which may result in short circuit the board.</div>
<div style="text-align: justify;">
<br />
<a name='more'></a><br /></div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1NxOrDz6j0pfPOlKhyIYZQtQJFfGPAQ1kqnvrOvWiMJ-KQ5QCgPBoXyDVFdYnvAECyUS0EbQW3C4p20U1dUamF-kdXgkJg2Zn759HfpsjpN9HeAbSV2tCEWoIfDXRjP2BnJDaYCQEPcvA/s1600/Arduino+3+Bit+Counter.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1NxOrDz6j0pfPOlKhyIYZQtQJFfGPAQ1kqnvrOvWiMJ-KQ5QCgPBoXyDVFdYnvAECyUS0EbQW3C4p20U1dUamF-kdXgkJg2Zn759HfpsjpN9HeAbSV2tCEWoIfDXRjP2BnJDaYCQEPcvA/s400/Arduino+3+Bit+Counter.PNG" width="384" /></a></div>
<div style="text-align: center;">
<b>Schematics of Arduino UNO R3 connected with LEDs</b></div>
<div style="text-align: left;">
<b><br /></b></div>
<div style="text-align: left;">
Open an arduino sketch from clicking new in file menu. To write code for 3 Bit up-Counter first, understand the algorithm.</div>
<div style="text-align: left;">
We are sure that we must need to use for loop which will start from 0 and it will go in loop for 8 times. Because for 3 bit maximum possible way for counter = 2^3 = 8.</div>
<div style="text-align: left;">
So for loop will go from 0 to 7 i.e. 8 times.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: justify;">
Now MSB is yellow LED in schematics. That is Pin 5 is MSB and pin 3 is LSB. </div>
<div style="text-align: justify;">
For up counter when the number is odd (i.e. 1,3,5 and 7) LSB will be 1. otherwise LSB = 0.</div>
<div style="text-align: justify;">
Same way we can design for MSB and middle bit also. The stat of pin is shown for each </div>
<div style="text-align: justify;">
value of possible output.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Pin 5 Pin 4 Pin 3</div>
<div style="text-align: justify;">
0 - 000 - 0 0 0</div>
<div style="text-align: justify;">
1 - 001 - 0 0 1</div>
<div style="text-align: justify;">
2 - 010 - 0 1 0</div>
<div style="text-align: justify;">
3 - 011 - 0 1 1</div>
<div style="text-align: justify;">
4 - 100 - 1 0 0</div>
<div style="text-align: justify;">
5 - 101 - 1 0 1</div>
<div style="text-align: justify;">
6 - 110 - 1 1 0</div>
<div style="text-align: justify;">
7 - 111 - 1 1 1</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
So we should put if and else statements by seeing in table.</div>
<div style="text-align: justify;">
From above table it is easy to say that Pin 5 is 1 if value is 4,5,6,7 (i.e. value>=4)</div>
<div style="text-align: justify;">
Pin 4 is 1 if value is 2,3,6,7</div>
<div style="text-align: justify;">
Pin 3 is 1 if value is 1,3,5,7 (i.e. odd values)</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
So final code will be like:</div>
<div style="text-align: justify;">
<br />
<br /></div>
<div style="height: 500px; overflow-y: scroll;">
<pre class="brush:cpp">int ledPin1=3; // IC Pin no 3
int ledPin2=4;
int ledPin3=5;
void setup() // For initial Setup
{
pinMode(ledPin1,OUTPUT); // Select the pin as output pin
pinMode(ledPin2,OUTPUT);
pinMode(ledPin3,OUTPUT);
}
void loop()
{
for(int i=0;i<=7;i++)
{
if(i==2 || i==4 || i==6 || i==0)
{
digitalWrite(ledPin1,LOW); // Pin no 3 or led 1 low when even, not glow
}
else
{
digitalWrite(ledPin1,HIGH);
}
if(i==2 || i==3 || i==6 || i==7)
{
digitalWrite(ledPin2,HIGH); //Pin no 4 or LED 2 High -> Glow
}
else
{
digitalWrite(ledPin2,LOW);
}
if(i>3)
{
digitalWrite(ledPin3,HIGH); //Pin 5 or LED 3 HIGH -> Glow
}
else
{
digitalWrite(ledPin3,LOW);
}
delay(1500); // to wait for 1500 milliseconds
}
}
</pre>
</div>
<div>
<br />
Here you can see the circuit in progress. MSB is upper most LED. And LSB islower most LED.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dx_OCTdpZ1gSnuxAw8WEeQgoMacOD_gMT_7ltLf_iS7hw7M8Li7lj9KTSEJoP2O1NZleIb9YtVbGzDrOG9g0A' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<br />
I hope you will try this... Enjoy guys...<br />
Thank you...</div>
Sagar Patelhttp://www.blogger.com/profile/06517990297047309532noreply@blogger.com0tag:blogger.com,1999:blog-5474268201667740573.post-92081172932147442002012-10-26T22:59:00.001+05:302020-12-23T23:02:33.953+05:30Practical Design of “The Time Machine”<br />
<div class="MsoNormal" style="text-align: justify;">
<span style="font-family: "Times New Roman","serif";"><span style="font-size: 15pt; line-height: 115%;">Hello <b>Time </b></span><span style="font-size: 20px; line-height: 22.727272033691406px;"><b>Travelers</b></span><span style="font-size: 15pt; line-height: 115%;">,<o:p></o:p></span></span></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> This blog is going to give an idea about travelling at
Light Speed. In the climate we have designed The Time-Machine which can travel
in future only. <o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> For understanding the possible ways to travel at the light speed
(<b>c)</b>, first we need to understand <b>“Theory of Relativity”. </b>It was given by
famous scientist <b>“Albert Einstein”</b>. The
Relativity had been distinguished in two parts.</span><br />
<br />
<div class="MsoNormal">
<b><span style="font-family: "Times New Roman","serif"; font-size: 18.0pt; line-height: 115%;"></span></b><br />
<a name='more'></a><b><span style="font-family: "Times New Roman","serif"; font-size: 18.0pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoNormal">
<b><span style="font-family: "Times New Roman","serif"; font-size: 18.0pt; line-height: 115%;">(1)Special
Relativity:</span></b><span style="font-family: "Times New Roman","serif"; font-size: 18.0pt; line-height: 115%;"> <b><o:p></o:p></b></span></div>
<div class="MsoNormal">
<b><span style="font-family: "Times New Roman","serif"; font-size: 18.0pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoListParagraphCxSpFirst" style="margin-left: 0in; text-indent: 33.85pt;">
<i><span style="font-family: "Times New Roman","serif"; font-size: 13.5pt; line-height: 115%;">“Light
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial;">in vacuum propagates with the speed<span class="apple-converted-space"> </span>c<span class="apple-converted-space"> </span>(a fixed constant, independent of
direction) in at least one system of inertial coordinates (the "stationary
system"), regardless of the state of motion of the light source.</span> <span style="background-color: white; background-position: initial initial; background-repeat: initial initial;">The assumptions relativity and light speed
invariance are compatible if relations of a new type transformation
("Lorentz transformation - for the transition from one inertial system to
any other </span></span></i><i style="text-indent: 33.85pt;"><span style="font-family: "Times New Roman","serif"; font-size: 13.5pt; line-height: 115%;"><span style="background-color: white; background-position: initial initial; background-repeat: initial initial;">arbitrarily chosen inertial system ") are postulated for the
conversion of coordinates for space and times of events.</span>“</span></i></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 0in; text-indent: 33.85pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">It Talks about the
relative speed of one Inertial Frame with respect to other Inertial Frame moving
in a space. It states that the speed of light in any inertial frame is constant
and it will never change with respect to any reference inertial frame, i.e. <b>299,792,458 m/s</b>. And it also states
that the Light speed is the <b>Last Limit</b>
<b>of Speed</b> in entire universe. <b>(CERN experiment’s scientists have claimed
about the speed of neutrino observed beyond the light speed in October 2011. But
in March 2012, they found out the mistakes in their measurements. So,
Einstein’s statement, “The speed limit in space is light speed and no object
having mass at rest can cross the limit” remains correct).<o:p></o:p></b></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 0in; text-indent: 33.85pt;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 0in; text-indent: 33.85pt;">
<br /></div>
<div class="MsoListParagraphCxSpLast" style="margin-left: 0in; text-indent: 33.85pt;">
<br /></div>
<div class="MsoNormal">
<b><span style="font-family: "Times New Roman","serif"; font-size: 18.0pt; line-height: 115%;">(2)
General Relativity: </span></b><b><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><o:p></o:p></span></b></div>
<div class="MsoNormal">
<b><span style="font-family: "Times New Roman","serif"; font-size: 18.0pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoNormal" style="text-indent: 0.25in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">It
talks about the medium in which gravitational and electromagnetic waves flows.
According to General Relativity, the entire universe is 4-Dimentional model in
which of 3-Dimentions are of Space (x, y, z) and other is time (t). So, any
point in universe can be shown by 4 co-ordinates i.e. (x, y, z, t).<b><o:p></o:p></b></span></div>
<div class="MsoListParagraph" style="margin-left: 0in; text-indent: 0.25in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">Space time is curved Geometry the
curvature of space-time is directly related to the energy or momentum of whatever
matter and radiation are present. The relation is specified by the Einstein
field equations, a system of partial differential equations.<o:p></o:p></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNd-h4VPb5rPZoHii5dLypUg4jCOqfPr-N3QznvY0swTBEExcwQ_Q5Lgv9XwKapKjc9DeCgtFEq8VNDMJ9oe7yfVkBpSZ9X2S1_B0cfO2rs2rsGwjBXh63GNU5-_xjBaxYLzALlQO_ytNO/s1600/Spacetime_curvature.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="281" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNd-h4VPb5rPZoHii5dLypUg4jCOqfPr-N3QznvY0swTBEExcwQ_Q5Lgv9XwKapKjc9DeCgtFEq8VNDMJ9oe7yfVkBpSZ9X2S1_B0cfO2rs2rsGwjBXh63GNU5-_xjBaxYLzALlQO_ytNO/s640/Spacetime_curvature.png" width="640" /></a></div>
<div class="MsoListParagraph" style="margin-left: 0in; text-indent: 0.25in;">
</div>
<div align="center" class="MsoListParagraph" style="margin-left: .25in; mso-add-space: auto; text-align: center;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 13.5pt; line-height: 115%;">Space-Time
Geometry Curved by Earth</span></b></div>
<div align="center" class="MsoListParagraph" style="margin-left: .25in; mso-add-space: auto; text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 15pt; line-height: 115%; text-align: justify; text-indent: 0.25in;"><br /></span></div>
<div class="MsoListParagraph" style="margin-left: 0.25in; text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 15pt; line-height: 115%; text-align: justify; text-indent: 0.25in;"> This theory also explains the phenomena
called Gravitational Lansing. In which, the star exactly beyond the sun can be
seen near to Sun by Rays coming out of the Star, which </span><span style="font-family: 'Times New Roman', serif; font-size: 15pt; line-height: 115%; text-align: justify; text-indent: 0.25in;"> </span><span style="font-family: 'Times New Roman', serif; font-size: 15pt; line-height: 115%; text-align: justify; text-indent: 0.25in;">is bent by Curved Geometry created by Mass of
Sun.</span><span style="text-align: justify;"> </span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH02OzboCt-bGBIOQkGuJFCE36L0LOupuC2RW87NEpntMJ41bb5EIZkE9iIcZRR9oOdYSJWMO1bH5wfDrbnNNZbotqAtTZdG4JN63kNDyHkjMHgF7RFNx0rvUyf1QuU2Zdgc5M8TAv3wJS/s1600/Untitled.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="260" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH02OzboCt-bGBIOQkGuJFCE36L0LOupuC2RW87NEpntMJ41bb5EIZkE9iIcZRR9oOdYSJWMO1bH5wfDrbnNNZbotqAtTZdG4JN63kNDyHkjMHgF7RFNx0rvUyf1QuU2Zdgc5M8TAv3wJS/s640/Untitled.png" width="640" /></a></div>
<div class="MsoListParagraph" style="margin-left: 0.25in; text-align: left;">
</div>
<div align="center" class="MsoListParagraph" style="margin-left: .25in; mso-add-space: auto; text-align: center;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 13.5pt; line-height: 115%;">Star
is observed on earth due to Space-time is curved by Mass of Sun, In 1919<o:p></o:p></span></b></div>
<div class="MsoListParagraph" style="margin-left: 0.25in; text-align: justify;">
</div>
<div class="MsoNormal" style="text-indent: 0.25in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal" style="text-indent: 0.25in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal" style="text-indent: 0.25in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">So, to achieve the speed limit of universe, we need to understand what happens at
speed of light. Some basic principle will have to keep in mind. <o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0.25in;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoNormal" style="text-indent: 0.25in;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">Space-Time Dilation: </span></b><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">As
the object starts to move in space, time w.r.t the moving object reference
frame starts to expand. It is so called “Time Dilation”. That means, if you are
travelling in a car with velocity <b><i>v</i></b>, time dilation will expand your
time by factor <b><i>sqrt(1-(v/c)<u><sup>2</sup></u>).</i> </b>If a time for observer at
rest is <b><i>T<sub>o</sub></i></b>, and time passing for traveler at speed <b><i>v </i></b>is
<b><i>T<sub>,<o:p></o:p></sub></i></b></span></div>
<div class="MsoNormal" style="text-indent: 0.25in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> T = T<sub>o</sub> / sqrt(1 – (v/c)<sup>2</sup>)<o:p></o:p></span></i></b></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> Same way, the distance traveled by car with reference to
rest observer is <b><i>D<sub>o</sub></i></b>, and distance traveled by car with reference to
car-driver is <b><i>D<sub>,<o:p></o:p></sub></i></b></span></div>
<div class="MsoNormal" style="text-indent: 0.25in;">
<b><i><sub><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> </span></sub></i></b><b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">D
= D<sub>o</sub> * sqrt(1 – (v/c)<sup>2</sup>)<o:p></o:p></span></i></b></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> That means the Space for car driver compresses, as well as
the time for car driver expands with respect to Rest Observer. This is called
the <b>Space-Time Dilation.</b></span></div>
<div class="MsoNormal">
<b style="text-indent: 0.5in;"><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoNormal" style="text-indent: 0px;">
<span style="text-indent: 0.5in;"><span style="font-family: 'Times New Roman', serif; font-size: 15pt; line-height: 115%;"> <b>Energy-Mass Conversion: </b></span></span><span style="font-family: 'Times New Roman', serif; font-size: 15pt; line-height: 115%; text-indent: 0.5in;">For
the same example, the mass of car-driver at rest = <b><i>m<sub>o</sub> </i></b>and<b><i> </i></b>mass
of car-driver at <b><i>v</i></b> velocity = <b><i>m</i></b>.</span></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">m
= m<sub>o</sub> / sqrt(1 – (v/c)<sup>2</sup>)<sub><o:p></o:p></sub></span></i></b></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">This
is a very interesting phenomena, according to which, Mass of an object
increases as it moves with increasing speed (<b><i>v</i></b>). That means, some
portion of the energy given to the car (for fuel) will convert to mass which
will ultimately increase the mass of a Car-driver as well as Car.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">The
conversion of Energy into mass is given by very famous equation.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">E
= mc<sup>2</sup></span></i></b><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">At
the speed of light, the mass of a car-driver will be infinite, because at a
speed light all the energy will start converting into mass and then no more
energy will be used to ignite the car-engine and the car will remain to travel
at nearer to a speed of light (<b><i>99.999% of light speed</i></b>). Or in other
words, car needs an infinite energy to travel at a speed of light. <b><i>Theoretically
it looks possible. But in practice, it is not possible to collect infinite
energy. Till now it was a problem. But there is a way to overcome and design a reliable
time machine.<o:p></o:p></i></b></span></div>
<div class="MsoNormal">
<b><span style="font-family: "Times New Roman","serif"; font-size: 23.0pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoNormal">
<b><span style="font-family: "Times New Roman","serif"; font-size: 23.0pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoNormal">
<b style="text-align: left;"><span style="font-family: "Times New Roman","serif"; font-size: 23.0pt; line-height: 115%;"><br /></span></b></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="MsoNormal">
<b style="text-align: left;"><span style="font-family: "Times New Roman","serif"; font-size: 23.0pt; line-height: 115%;">Reaching
the Light speed by Rotational motion</span></b></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">Better Solution of this problem may
be by making energy source stable. </span></b><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">In the above example we
were using fuel as a car ignition, which was also travelling with a car, which was
limiting the required energy. As speed increases the mass of fuel also
increases. So, we require extra energy to overcome the increased fuel mass
also. If the energy source is stable (at rest) then there may be possibility to
get light speed in a more efficient way.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">So,
let’s do the thought experiment (as a hobby of Einstein). Imagine you are in a
car having no engine. The car is attached with a very long iron rod, which is
very strong, unbreakable and impossible to bend. The other end of the Iron Rod
is connected to very powerful electric motor, which can produce a very high
amount of torque and it has very high rotational speed. Electric motor is kept
on rigid body. It is shown in the figure below.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmHdE5CFNzBbsQQVYP1UfpKF43Jo0UmAIxPYFAqk-qjVy_4V00Q2F8tVN3OQVrM_0SDcFjKK4Gg1rauhdDjuem2Mee1nfiAnrulpIeoKSDfVv_Be338GRnh3ACDAJ8F77bQKQh9iH4aXe2/s1600/Untitled1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="124" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmHdE5CFNzBbsQQVYP1UfpKF43Jo0UmAIxPYFAqk-qjVy_4V00Q2F8tVN3OQVrM_0SDcFjKK4Gg1rauhdDjuem2Mee1nfiAnrulpIeoKSDfVv_Be338GRnh3ACDAJ8F77bQKQh9iH4aXe2/s400/Untitled1.png" width="400" /></a></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
</div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">The
settlements for thought Experiment<o:p></o:p></span></b></div>
<div align="center" class="MsoNormal" style="text-align: center;">
</div>
<div class="MsoNormal" style="text-align: justify;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> Now if the Electric
motor starts (by giving electric supply) which is going to be kept with fixed
rigid body. So the Rod which is connected to motor starts rotating. As the rod
starts rotating, the car which is attached at the other end of the rod also
starts moving in circular path of radius equal to the length of rod. Now, motor
starts to speed up that means the rotational speed is increasing. As the
Rotational speed is increasing, the car is now moving faster and faster at the
other end. After some time it will achieve 99.999% of speed limit. But there
are some consequences. To understand this mathematically, let’s assume that <b>the</b> <b>rotational speed of motor</b> = <b><i>w </i></b>and <b>the length of rod = <i>l</i>.</b> So
at any instance the linear <b>velocity of
car</b> in the direction of Tangent to that circle <b>=</b> <b><i>v.</i></b><o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><b><i><br /></i></b></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8OqdqBB6Pk0iRwuSpI7-Jd-NyeMIuXwpPLhoO8UbwKkf90pyy6N5Vt5S0fNoOp2JlhP36wKqIWjNYysMPw2qvzFqGBh9rli8WImQOuJPuDqU7M87MEyYuFNQdkTaKqFt0xcJ5UxiBApnk/s1600/Untitled2.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="600" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8OqdqBB6Pk0iRwuSpI7-Jd-NyeMIuXwpPLhoO8UbwKkf90pyy6N5Vt5S0fNoOp2JlhP36wKqIWjNYysMPw2qvzFqGBh9rli8WImQOuJPuDqU7M87MEyYuFNQdkTaKqFt0xcJ5UxiBApnk/s640/Untitled2.png" width="640" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8OqdqBB6Pk0iRwuSpI7-Jd-NyeMIuXwpPLhoO8UbwKkf90pyy6N5Vt5S0fNoOp2JlhP36wKqIWjNYysMPw2qvzFqGBh9rli8WImQOuJPuDqU7M87MEyYuFNQdkTaKqFt0xcJ5UxiBApnk/s1600/Untitled2.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8OqdqBB6Pk0iRwuSpI7-Jd-NyeMIuXwpPLhoO8UbwKkf90pyy6N5Vt5S0fNoOp2JlhP36wKqIWjNYysMPw2qvzFqGBh9rli8WImQOuJPuDqU7M87MEyYuFNQdkTaKqFt0xcJ5UxiBApnk/s1600/Untitled2.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><b><i><br /></i></b></span></div>
<div class="MsoNormal" style="text-align: justify;">
</div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">Thought
Experiment in Progress<o:p></o:p></span></b></div>
<div align="center" class="MsoNormal" style="text-align: center;">
</div>
<div class="MsoNormal" style="text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 15pt; line-height: 115%; text-indent: 0.5in;"><br /></span></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 15pt; line-height: 115%; text-indent: 0.5in;"><br /></span></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="font-family: 'Times New Roman', serif; font-size: 15pt; line-height: 115%; text-indent: 0.5in;">The speed of car w.r.t
the motor’s reference frame (at rest) = </span><b style="font-family: 'Times New Roman', serif; font-size: 15pt; line-height: 115%; text-indent: 0.5in;"><i>v</i></b></div>
<div class="MsoNormal" style="text-align: justify;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> v = w * l</span></i></b></div>
<div class="MsoNormal" style="text-align: justify;">
<b style="text-indent: 0.5in;"><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> </span></i></b><span style="font-family: 'Times New Roman', serif; font-size: 15pt; line-height: 115%; text-indent: 0.5in;">So as w increases, v also
increases. To get high value of velocity (<b><i>v</i></b>) at small value of angular
velocity (<b><i>w</i></b>), it is clear that length of rod (<b><i>l</i></b>) should be high. That’s
why we have taken length of rod as very high.</span></div>
<div class="MsoNormal" style="text-align: justify; text-indent: .5in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">Now,
after a certain time from beginning, the speed of electric motor increases up
to a level at which the speed of car reaches to <b>50% of speed limit (=0.5c). </b>Still the motor is powerful that it continues
to increase the rotational speed which leads to increases in speed of car.
After some time the speed of car reaches to <b>90% of speed limit (=0.9c). </b>At 90% of speed limit mass of car <b><i>m </i></b>can
be found by using the equation <o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-indent: .5in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">m
= m<sub>o</sub> / sqrt(1 – (v/c)<sup>2</sup>)<sub><o:p></o:p></sub></span></i></b></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> <b><i>m = m<sub>o</sub> / sqrt(1 – (0.9c /c)<sup>2</sup>)<o:p></o:p></i></b></span></div>
<div class="MsoNormal" style="text-align: justify;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> m = m<sub>o</sub> / sqrt(1 – 0.81)<o:p></o:p></span></i></b></div>
<div class="MsoNormal" style="margin-top: 12.0pt; text-align: justify;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> m = m<sub>o</sub> / 0.4359<o:p></o:p></span></i></b></div>
<div class="MsoNormal" style="margin-top: 12.0pt; text-align: justify;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> m = 2.2942 m<sub>o</sub><o:p></o:p></span></i></b></div>
<div class="MsoNormal" style="margin-top: 12.0pt; text-align: justify; text-indent: .5in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">So
according to equation, the car will be heavier in mass by nearly <b>230% at 90% of light speed. </b>At this
level, think about where the car is getting energy. As speed increases the car
becomes heavier in mass and the necessary energy to provide sufficient rotation
also increases. Car is getting energy from power supply which is connected to
electric motor. And that energy is transferred to car via iron rod. The rod is continuous,
so all the points at different radius on rod will be moving with different
velocity. So, the velocity at radius r will be</span></div>
<div class="MsoNormal" style="margin-top: 12.0pt; text-align: justify; text-indent: .5in;">
<b style="text-align: center; text-indent: 0.5in;"><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> v(r) = w*r where,
r</span></i></b><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; color: #222222; font-family: 'Cambria Math', serif; text-align: center; text-indent: 0.5in;"> </span><b style="text-align: center; text-indent: 0.5in;"><i><span style="background: white; color: #222222; font-family: "Cambria Math","serif"; mso-bidi-font-family: "Times New Roman";">∈</span></i></b><b style="text-align: center; text-indent: 0.5in;"><i><span style="background: white; color: #222222; font-family: "Times New Roman","serif";"> (0,l)</span></i></b></div>
<div class="MsoNormal" style="margin-top: 12.0pt; text-indent: .5in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">v(r)
is velocity of point which is at radius r w.r.t. motor’s reference frame<o:p></o:p></span></i></b></div>
<div class="MsoNormal" style="text-align: justify; text-indent: .25in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal" style="text-align: justify; text-indent: .25in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">Now
applying the time dilation equation, <o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-indent: .5in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">T
= T<sub>o</sub> / sqrt(1 – (v/c)<sup>2</sup>)<o:p></o:p></span></i></b></div>
<div class="MsoNormal" style="text-align: justify; text-indent: .5in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">where,
T<sub>o</sub>=time with respect to motor’s reference frame (at rest)<o:p></o:p></span></i></b></div>
<div class="MsoNormal" style="text-align: justify; text-indent: .25in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal" style="text-align: justify; text-indent: .25in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">All
the points at different radius having different velocities lead the different
expansion of time. That means if a person moves on a rod from motor to car end,
it experiences a different time dilation in which time continuously expands.
Same way, the rotational distance of point at different location will also
compress by formula, <o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-indent: .5in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">D
= D<sub>o</sub> * sqrt(1 – (v/c)<sup>2</sup>).<o:p></o:p></span></i></b></div>
<div class="MsoNormal" style="text-align: justify; text-indent: .5in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">where,
D<sub>o </sub>= D(r) = 2πr (Distance measured w.r.t motor’s reference frame at
rest)</span></i></b><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-indent: .5in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal" style="text-align: justify; text-indent: .5in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">So
<b><i>every
point</i></b> on rod will experience different circular perimeter. According to<b><i> their own</i></b> <b><i>reference
frame </i></b>the circular perimeter is compressed by a factor <b><i>sqrt(1
– (v/c)<sup>2</sup>) </i></b>w.r.t <b><i>Rest reference frame.</i></b> But the motor’s
reference frame is at rest. So according to motor’s reference frame the distance
traveled by the point at different radius will be the circular path given by
equation <o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> D(r) = 2πr</span></i></b><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> where, r = radius of the path<o:p></o:p></span></i></b></div>
<div class="MsoNormal" style="text-align: justify;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></i></b></div>
<div class="MsoNormal" style="text-align: justify;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">So according to thought
experiment, rotational motion will give a better leverage than linear motion.
So let’s design the model in real world.<o:p></o:p></span></i></b></div>
<div class="MsoNormal" style="text-align: justify;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></i></b></div>
<div class="MsoNormal" style="text-align: justify;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></i></b></div>
<div class="MsoNormal" style="text-align: justify;">
</div>
<div class="MsoNormal">
<b><span style="font-family: "Times New Roman","serif"; font-size: 23.0pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoNormal">
<b><span style="font-family: "Times New Roman","serif"; font-size: 23.0pt; line-height: 115%;">Designing
the model<o:p></o:p></span></b></div>
<h1>
<span style="font-size: 15.0pt; font-weight: normal; mso-bidi-font-weight: bold;"> </span><span style="font-family: Times, Times New Roman, serif;"><span style="font-size: 15pt; font-weight: normal;">Now it’s time to designing the model practically
possible. For designing purpose, we will use possible resources. Electric motor
should have higher speed as well as it should produce high amount of torque. The
highest rpm ever achieved on earth is 1,000,000 rpm by </span><span style="font-size: 15pt; font-weight: normal;">ETH
Zurich researchers. But for practical purpose consider medium case scenario,
that this motor can produce highest torque at </span><span style="font-size: 15pt;">600,000 rpm.</span></span></h1>
<h1>
<i><span style="font-size: 15pt;"> <span style="font-family: Times, Times New Roman, serif;">So,
Rotation in one minute = 600,000rpm<o:p></o:p></span></span></i></h1>
<h1>
<i><span style="font-size: 15pt;"><span style="font-family: Times, Times New Roman, serif;"> N
= 600,000 rpm<o:p></o:p></span></span></i></h1>
<h1>
<i><span style="font-size: 15pt;"><span style="font-family: Times, Times New Roman, serif;"> N
= 600,000 / 60 rps (rotation per second)<o:p></o:p></span></span></i></h1>
<div class="MsoNormal">
<b><i><span style="font-size: 15pt; line-height: 115%;"><span style="font-family: Times, Times New Roman, serif;"> N = 10,000 rps</span><span style="font-family: Times New Roman, serif;"><o:p></o:p></span></span></i></b></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">So, <b><i>angular
velocity w = 2πN rad/s<o:p></o:p></i></b></span></div>
<div class="MsoNormal">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> w = 2π * 10,000<o:p></o:p></span></i></b></div>
<div class="MsoNormal">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> w =62,800 rad/s<o:p></o:p></span></i></b></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">for calculation simplicity
round of this figure to 60,000 rad/s.<o:p></o:p></span></div>
<div class="MsoNormal">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> w = 60,000 rad/s<o:p></o:p></span></i></b></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> Now, to achieve the speed
of light at the end of rod i.e. car end, the length of rod should be <b><i>l. </i></b>So,<b><i> length
of rod = l.</i></b><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> Here, <b><i>v = c (we want to achieve light speed at the
end of rod)<o:p></o:p></i></b></span></div>
<div class="MsoNormal">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> c = 299,792,458 m/s<o:p></o:p></span></i></b></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"> v = c = 299,792,458 m/s<o:p></o:p></span></i></b></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">But,
v = w * l<o:p></o:p></span></i></b></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">l
= v / w<o:p></o:p></span></i></b></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">l
= 299,792,458 / 60,000<o:p></o:p></span></i></b></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">l
= 4996.54 m<o:p></o:p></span></i></b></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">l
≈ 5000 m = 5 kilometer<o:p></o:p></span></i></b></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">We
need 5 kilometer long iron rod which should have high quality of strength and its
mass should be as low as possible. So that the required energy to rotate the
rod will be very low and the time machine will be very efficient. Yes of course,
that is very difficult to find 5km long iron rod. But for reducing a length of
rod, the maximum rotational speed of motor should be increased. We have
considered medium case scenario by considering rotational speed (<b><i>600,000
rpm</i></b>) lower than the actual speed (<b><i>1 million rpm</i></b>). So, if motor rotates
at its maximum speed i.e. <b><i>1 million rpm</i></b>, the required length
of rod will be <b><i>3km</i></b>. So in industry we will have to develop the techniques by
which we can design this kind of <b>Strong,
very long </b>and<b> low mass</b> iron
rods. At the other end we can attach two chairs (or car) for time travelers.
One thing which we have to keep in mind is the total mass of car and rod should
be as low as possible. Finally, electric power supply to give energy to motor. So
that’s it. <b>That’s our one<i> way to future Time Machine</i>. So, be
ready to start travelling in future.<o:p></o:p></b></span></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;"><br /></span></i></b></div>
<div class="MsoNormal" style="text-indent: 0.5in;">
<b><i><span style="font-family: "Times New Roman","serif"; font-size: 15.0pt; line-height: 115%;">“<span style="background-color: white; background-position: initial initial; background-repeat: initial initial;">The journey of a thousand miles begins
with one step</span> and that step begins with a tiny thought.”<o:p></o:p></span></i></b></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<div class="MsoListParagraph" style="margin-left: 0.25in; text-align: justify;">
</div>
<div class="MsoListParagraph" style="margin-left: 0in; text-indent: 0.25in;">
<o:p></o:p></div>
<br />
<br /></div>
Sagar Patelhttp://www.blogger.com/profile/06517990297047309532noreply@blogger.com0tag:blogger.com,1999:blog-5474268201667740573.post-57130773717069505662012-05-18T00:08:00.001+05:302014-02-26T19:12:28.172+05:30C++ to Text file converterHi guys i have made a Batch File code by which you can convert C++ File to Text File.<br />
I know that we can convert it by using notepad. But for understanding the purpose of Batch Coding you can try this. This code changes the file extension of C++ (.cpp) to Text (.txt). So, we can assume that your file gets converted into text file.<br />
<b><br /></b>
<b>CODE</b><br />
<pre class="brush:bat">@echo off
Set /P userin=Enter the File name
ECHO file name is =%userin%
pause:
set str1=%userin:.cpp=%
echo.%str1%
set "str2=%str1%.txt
echo.%str2%
pause: Press any key to convert it into Text file
COPY %userin% %str2%
pause:
</pre>
<b><span style="font-size: x-small;"><br /></span></b>
<br />
<b><span style="font-size: x-small;"><span style="font-family: "Georgia", "Times New Roman", serif;"><br /></span></span></b>
<span style="font-family: "Times", "Times New Roman", serif;"><span style="font-size: small;">Save this code with .bat extension. When you run this code, use the whole path specifying the drive later also.</span></span>Sagar Patelhttp://www.blogger.com/profile/06517990297047309532noreply@blogger.com0