Thursday, March 28, 2013

Logic Gates Using Transistor 1 AND Gate- EEE & CSE Lesson

Hello everyone!
Hope you all are in good shape.

Today I'm going to write something about logic gates & how they could be implemented using transistor. To see how it actually works we will be needing a few more stuffs like resistor, light emitting diodes etc!

So, first thing's first. What is a logic gate?

A logic gate is a physical device implementing a Boolean function! That means it performs logical operations! It may take one or more logical inputs & produces single logical output.
For example say you want to buy a new desktop but you are going to need the permission of both your mom & dad! If one of them says "NO" then you wont be getting a new desktop. If both of them says "YES" then u will be getting a desktop! You can put this whole thing in something like a logic gate & you can easily understand that.

Lets look at a picture

Lets assume A is for mom & B is for Dad. Now we all know how transistors work as a switch. If we apply positive voltage to a base of an NPN transistor it will start passing charges through it(usually)!

 And lets assume if the LED lights up you are going to get a desktop! You know a LED will light up if you apply proper voltage with proper polarity!


So, Now lets assume both your mom & dad answered the same. & that's a BIG "NO" so the input for A & B both is 0! As base of each of the transistors are not going to get anything they will remain off! So no current through them! & no positive charge/connection for the LED! It wont light up!

Now lets assume your mom says "YES" & your dad says "NO" now lets see what happens. As the transistor on the top side's BASE has got a "YES" it will say "YES" I'm going to pass current!
But the transistor on the lower side has a "NO" on its base so it wont pass any current! So what happens? Nothing! As one of the series elements are not conducting the LED wont light up! So you are not going to get a desktop! Same explanation for if your Dad says "YES" & Mom says "NO".

Now what will happen if they both say "YES"! as both the transistors gets "YES"(or positive charge) at their bases they will start conducting ! Both the series elements will start conducting so the led will light up! ( Here 4.7Kohm is much more bigger than the 680ohm)

So lets sum up what happened here.


See what we have here?? This is called a truth table! Sounds kinda HOLY!
Simply a truth table is a table used in logic! It is used for computing functional values of logical expressions.

What we actually did then? We have a logic gate using transistors!
This gate is called "AND" gate!

You can compare an AND gate with two series bridges. If you want to get to the other side you will be needing both of them. If any of them is out of order or not available you are not going to get to that desired place.
Assume that Mr. Black wants to meet Mr. Red! The only way is crossing bridges A & B. If one of them is not available then they wouldn't be able to meet!

Its the simplest form of AND gate!

How to make a three input AND gate?
Its also Easy!
Just Add another transistor. About truth table - only if all the Inputs are yes then its output will be yes rest will be no.





This is how a D400 transistor looks like. (sorry about the image quality, I don't have a macro lens)

Where to find transistor & other stuffs?

You can use any common NPN Transistor for this for example D400/2N2222 will be fine & you can find them in any hardware store!

Wednesday, March 20, 2013

Linear Voltage Regulator 1- Hobby Electronics

Good morning everyone.Today I'm going to write about linear voltage regulators.

In my previous post I have showed how easy it is to get a desired DC voltage from AC outlet but there is a problem which is that DC voltage is not regulated. What that mean is the DC voltage might fluctuate with time. Even after using smoothing capacitors the voltage that we get is not fully stable. So that voltage might not be ideal for operating many equipment where it is mandatory to keep the voltage stable.

What exactly a voltage regulator does?

A voltage regulator takes in unregulated input voltage that fluctuates with time and gives off regulated output voltage that doesn't change overtime.




Capacitors are used for maximizing stability of the circuit. When this regulator is under load the capacitors will help to minimize ripple.

Types:

Now more about Three Terminal fixed voltage Positive & Negative Regulators.

Positive Regulators are used for regulating positive voltage.
Negative Regulators are used for regulating negative voltage.

Positive voltage regulator starts with 78 & followed by two digits which provide information about voltage. Like a 7805 is a positive 5V regulator, a 7812 is a positive 12V regulator.
Negative voltage regulator starts with 79 & followed by two digits for  which provide information about voltage. Like a 7905 is a negative 5V regulator.

Common Specification of 78XX series:

1. Voltage : A 7812 has a typical 12V output but it could be as low as 11.5V & high as 12.5V.

2. Output Regulation : The output voltage regulation is seen to be typically around 4mV to a maximum of 100mV(depending on output current). It means output voltage can typically vary only 4mV from rated 12V.

3. Short-Circuit Current : Amount of short circuit current is typically 0.35A, if the output is accidentally shorted.

4. Peak Current : Rated maximum current is 1A-1.5A but its peak current is around 2.2A.

5. Dropout Voltage : Typically the dropout voltage for this ICs are 2V. This is the minimum amount of voltage difference across the input-output terminal. If it drops below 2V the IC will no longer provide regulation.

Important Note : 

Linear regulators can be really hot during operation as they burns a lot of power and higher the current is drawn from the regulator and higher the difference between input and output voltage bigger the loss is. So a moderately sized heat sink is needed if more than 500mA is drawn from them.

It wastes Power as follows : (Vin - Vout) * Current out

e.g. If I use a 5V regulator from a 12V unregulated source and I'm drawing around 500mA(.5A)

it will waste (12-5)*.5= 3.5W.

3.5W heat is a lot of heat for such tiny device. It will soon stop working as soon as thermal shutdown feature kicks in.

what if I use a 7V source?

(7-5)*.5 = 1W

which is much lower.

So, one more thing try to use a closer unregulated input voltage. & it IC gets hot use proper heat sink with proper thermal paste!

Where To Find :

This ICs are very familiar & can be found in most of the places. 


From left to right 7805, 7809, 7812 and 7815



To read my other posts, click here.

Saturday, March 16, 2013

Internet Connection Sharing

Good Afternoon!

This post will be about sharing Internet connection in many different scenarios which can come handy time to time.



Possible Scenarios:

1. Internet from USB based 3G/4G Modem shared over wired Ethernet from a Desktop or Laptop. 


Details:

1. Let's say you have two computers but only one USB internet modem and you want to use internet on both machines. You cant plug one USB modem in two different machines at any given time, here's how you can use the one internet on both systems.


Let's take a look what we need for this project.

1. Ethernet cable (can be CAT5/5E/6),
2. Working Ethernet port on both systems (you need to make sure that both of them have proper driver installed, enabled and working).

Procedure:









So how you are going to do this?


1. Plug your USB modem on your system. Connect to the internet.

2. Go to Network & Sharing Center  ( On the task-bar you can see this icon . Right click & Open Network and Sharing Center)









3. Now click the change adapter settings on the top left.
4.



You will see your existing installed hardware.  Here in my system Ethernet 2 is USB WiMAX modem & Ethernet is GbE and I will be using this Ethernet port to connect to another system.

5. Now right click on the Ethernet 2 (or the one you want to share) click properties. Then select Sharing Tab.
6. Check both of them & click OK.
7. You can control services from "Settings".



8. After clicking OK,IP will be automatically assigned to your other network Adapter ( the one through you are going to share)
Ethernet > Properties > IPv4



As you can see 192.168.137.1 has automatically been assigned.

9. Now get to your other machine & open up network & sharing center. Go to change adapter settings. Then go to the properties of your adapter that you are going to use. Set IPv4 & IPv6 to auto.


that means check the radio buttons "Obtain an IP address automatically" & "Obtain DNS server address automatically". Press OK.

10.  Now connect the cable & You are done!


2. [][]

Next let's say you have a phone that has 3G/4G connectivity but you need to use the same internet in any other phone, how can you do that? Well that's pretty simple too.

For this you won't actually need anything more then just two phones.

So assume you have a phone with internet connectivity via 3G/4G, in this case it's 3G.


So here it can be seen that this phone is connected to a HSDPA network, now I want to share this internet via WiFi. First I will get to the settings.



Next stop the More options.

Next I'm gonna go to Tethering.


As I was saying that I will be using WiFi so all I have to do is set up Wi-Fi hotspot, which is maybe give a proper name and password then just start the hotspot. 


Here you can see the security type and password is given to this SSID and in this particular phone when no device is connected it will automatically turn off the Wi-Fi hotspot so save battery, by default its 8 minutes. So after launching the hotspot you can see it in any other device.


Here the hotspot is being discovered by the other device. 


Like connecting to any other Wi-Fi router all I needed to do is to type in the password and as you can see it is connected and internet using is possible. 



Let's share some more internet!

Now let's say you have an internet connection, a broadband one via an Ethernet cat 5/5e/6 cable with RJ45 port and you have maybe a laptop or a desktop with a WiFi adapter and maybe a phone. You want to use internet in all of them at the same time but don't wanna get a router or you will just use for short time. Yes it can be done.

So like I was saying you will need an internet connection and at-least a wireless adapter, could be an USB dongle or could be the built-in WiFi of a laptop or desktop.

Now first thing's first you gonna have to make sure that hosted network feature is supported. For this you have to type in the following command in command prompt.

netsh wlan show drivers

Here we can see that hosted network is supported, if you find a No in here, make sure to install proper driver for your wireless dongle or adapter.  

Next stop will be starting an ad-hoc wireless network. To do so you have to type in


netsh wlan set hostednetwork mode=allow ssid=<Enter the network name> key=<Enter the password for this>




In this case you can see I have set it up the SSID as Internet and password is something.

Now you have to start this network, to do so type in the following command and press enter.


netsh wlan start hostednetwork



From My mobile phone I can see that the wireless network is available.



Now, you have to share the wired internet on this ad hoc network. To do so go to "Network and Sharing center", can be found in control panel. 



From there go to the "Change Adapter Settings" and figure out which one is your internet connection, for me it is the Ethernet 2. Now you have to share it over the ad-hoc network that was created. To do so you have to go to the "Properties" of Ethernet 2 and get into the "Sharing" tab. From there share it over the Local Area Connection*6(or whatever you have, look for microsoft hosted network).


After pressing okay you should see the network is shared.



Now connect your phone or tab or whatever you want to connect to and see if internet is on!




 And internet is available!


Although I have found something quite interesting here, the speed which I'm getting via this is actually slightly lower than directly connecting it to the router. Well I wasn't really expecting to saturate this, I have a slow internet connection so was expecting full speed, and the Wireless network is an Intel AC one so it should have performed better I guess. Maybe windows is the culprit here! Who knows.


The blue ones are the results when connecting the phone directly to the router and the red ones are via this method. Anyway If you want to turn it off, simply Turn off the sharing from the adapter settings. Then go to the command prompt and type in


netsh wlan stop hostednetwork


Here we can see it has stopped and also the connection 6 is no longer available.




Hope you have enjoyed the post! Have a nice day!