Tuesday, December 13, 2016

Show Temperature on 16x2 LCD with LM35 and Arduino

Good evening everyone so in my Arduino series last two posts were about temperature reading, displaying it on Serial monitor and using a 16x2 LCD display. Now allow me to merge them together to show the temperature reading in that display.

Parts Needed:

1. Any Arduino board ( And yes I'm using the UNO);
2. USB Type A to Type B cable to connect to computer and upload the code.
3. 16x2 LCD Display.
4. Male to Male Jumper Wire.
5. Practice Board.
6. 220ohm Resistor.
7. 10kohm Variable Resistor.
8. LM35.
9. Arduino IDE.


Connection:

Let's start with the display.

Pin 1 - Ground.
Pin 2 - +5V.

Pin 3 - Connect to the Wiper Terminal of the variable resistor. Variable resistor needs both Ground and +5V on it's other two terminal. This resistor is used as contrast control.

Pin 4 - Register select, connect this to Arduino pin 12.

Pin 5 - Read or Write pin. Connect it to the Ground to enable Write mode.

Pin 6 - LCD Enable Pin, connect it to the Arduino pin 11.


Pin 11 - D4 to Arduino pin 5.

Pin 12 - D5 to Arduino pin 4.

Pin 13 - D6 to Arduino pin 3.

Pin 14 - D8 to Arduino pin 2.


Pin 15 - LED+ to 5V/3.3V with a series resistor maybe a 220ohm one. I'm using a 1K one though.
Pin 16 - LED- to Ground. 


Now let's hook up the Temperature sensor.

Pin 1 - +5V
Pin 3 - GND

Pin 2 - Arduino Analog input pin 5.

That's pretty much the connection that we need.


The Code:

Here is the code with necessary explanations.

// Let's start with including the LCD Library.

#include  <LiquidCrystal.h>

// Define the Input pin for LM35, in this case it is A5.
int  tempPin  =  5     ;

// Declare variable
int  value;

// Initialize the library with the numbers of the interface pins.
LiquidCrystal  lcd    (12, 11, 5, 4, 3, 2);

void  setup()

{
  // Sets the data rate in bits per second (baud) for serial data transmission.
  Serial.begin(9600);

  // Set up the LCD's number of columns and rows.
  lcd.begin(16, 2);

  // Print a message to the LCD.
  lcd.print("Temperature: ");

}

void  loop()

{ // taking in the value from input pin.
  value = analogRead(tempPin);

  // convert the voltage information, as LM35 is already calibrated in celcius to get the celcius output not much code is needed.
  float mv = ( value / 1023.0) * 5000;
  float cel = mv / 10;

  // convert the celcius value to farenhite, uncomment this and print it to get the fahrenheit result.
  //float farh = (cel * 9) / 5 + 32;

  // Serial Print will print value to serial monitor.
  Serial.print("Temperature = ");
  Serial.print(cel);
  Serial.print("*C");
  Serial.println();

  // Let's give it a vertical shift so it will be on the bottom line.
  lcd.setCursor(0, 1);

  // Print a message on the bottom line.
  lcd.print(cel);
  lcd.print(" *C") ;

  //Start again after 300ms.
  delay(300);

}


So how does it work?

Well I have separately written how the display and the temperature monitoring works so I will just put links to those post at the bottom of this post where you can find details on them.

Let's look at the completed project.


Here you can see the display, Arduino and the LM35. The reason there is no variable resistor is because I don't need to control the contrast in this one. So I just left it out.


Applications:

Temperature sensor can be really helpful and putting it on a display can be even more helpful. It not only can be used as a visual modification for your project but can be used in many different projects where it is necessary to show the temperature. You can also control other devices using temperature as the trigger point. One thing you can do is to make something like the following image and cover the wires with heat shrink material and can be used as a temperature probe to lower it in a liquid or reach in a place where it wouldn't be practical to put the practice board in.


In Here I'm Just using three Male to Female jumper wire, the one that is used with Raspberry Pi.

So that's pretty much it, hope this has been helpful.


Links:

1. Temperature monitor using LM35.
2. Using 16x2 display with Arduino.
3. Read my other posts here.


Monday, December 12, 2016

Temperature Monitor Using Arduino and LM35

Good evening. This is the continuation of the Arduino series and this particular one is about how to make a simple temperature monitor using the LM35 precision temperature sensor.

This will a very small project as the part it needs is the LM35. Reason behind that is this small chip is already calibrated in centigrade so it is just as simple as reading it's output value, do a small conversion and show it on display or use it in somewhere. LM35 is a linear temperature sensor and it's output voltage is proportional to the temperature. It's output is 10mV/Degree Centigrade. So if you rise temperature by 1 Degree Centigrade, output will increase by 10mV. So all you have to do is read that through Analog input pin of your Arduino and done. There are couple different positive things about using this. It has wide voltage range, it is a very small device so it is suitable for pretty much any application where temperature reading is needed.


So let's go over the parts list:

1. Arduino, again for basic projects like this I use UNO.
2. LM35.
3. USB A to B cable and Jumper Wires.
4. Arduino IDE on computer
5. Practice Board.


 
Procedure and Connections:

As there will be no other parts other than the LM35, the connection is pretty simple. LM35 has three pins. Pin1 takes in positive voltage which can be anything from 4V to 30V and Pin3 is the ground pin. I have just powered it directly from the Arduino 5V and GND pin.

Pin2 is the output pin of LM35 which needs to be connected to any of the analog input pins of the Arduino. You might have to change the code if you use anything other than 5 because that's what I'm using.

After connecting upload the code provided, code has all the necessary explanation and how you can modify it. Then open up the serial monitor to see the temperature reading.


The Code:

// declare variables.

int value;
int tempPin = 5;

void setup()
{
  Serial.begin(9600);
}
void loop()
{
  // taking in the value from input pin.
  value = analogRead(tempPin);

  // convert the voltage information, as LM35 is already calibrated in celcius to get the celcius output not much code is needed.
  float mv = ( value / 1023.0) * 5000;
  float cel = mv / 10;

  // convert the celcius value to farenhite
  float farh = (cel * 9) / 5 + 32;

  Serial.print("Temperature = ");
  Serial.print(cel);
  Serial.print("*C");
  Serial.println();
  delay(1000);

  /* uncomment this and comment the previous 5 lines to get temperature in farenhite
    Serial.print("Temperature = ");
    Serial.print(farh);
    Serial.print("*F");
    Serial.println();


  */
}



Here is the project:



How does it work? 

I have talked about LM35 earlier on this post, so you get the idea of what happens with different temperature, it gives different output voltage which is analog. Hence we put that in the analog input of Arduino. Now we have to convert it to digital in a way that it represents the proper temperature value.


Result:


 You can check for the accuracy using a source with known temperature.


Applications:

This one might be a very simple project but you can use it in many different things like battery over temperature protection or any kind of over temperature protection. It can also be used to control devices based on temperature. 

Hope you have enjoyed it.


Links:

Sunday, October 30, 2016

Easy Chat Program using Arduino.

Good evening everyone. So in this day of age anyone who is interested in electronics or keep an eyes on technological news Arduino should be a very common word for them and rightly so because it has made designing and implementing circuits so simple that even amateur people can actually make awesome things this days. Arduino has pretty much gave everyone the power to make something which was previously kinda on the hands of people who knows about how things work. Anyway you can already guess this post will be something using Arduino and it is a simple chat program.

So what this will allow us to do is just send and receive simple text from a computer. Yes I understand there are much better options out there but this one will help you to get familiarized with Arduino and show you how easy it is to get things done.

Parts needed: 

1. A pair of Arduino. I'm using the ever popular and cheap Arduino UNO.
2. A pair of USB Type A to Type B cables to connect Arduino with computers.
3. Two Male to Male jumper wire or similar cable to connect the Arduinos.
4. Arduino IDE on computers.

Procedure:

1. In this particular example I'm using the Arduino pins 7 and 8 but you can use any pin you want all you have to do is to change the code accordingly. I have used 7 and 8 because they are easy to find. Just connect pin 7 of one Arduino to pin 8 of the other. So there will be two wires connecting both the Arduinos.

2. Make sure the IDE is installed on your computer, it can be downloaded from their website for free.

3. Connect the Arduino via USB port and upload the Code found in the Direct Chat Code file, link will be on the bottom of this post. You need to put the exact same code in both of them. Make sure to select the correct COM port before uploading.

4. Now open up serial monitor and you can start chatting.


The Code:

/* Simple Chat Program

 Receives from the hardware serial, sends to hardware & software serial.
 Receives from software serial, sends to hardware serial.

 The circuit setup:
 * RX is digital pin 10 (connect to TX of other device)
 * TX is digital pin 11 (connect to RX of other device)

 Created and modified by Redwan Hasan based of software serial example.
  */
#include <SoftwareSerial.h>

SoftwareSerial chat(10, 11); // Define RX, TX

int text;

void setup() 
{
  // open hardware serial, TX = 1, RX = 0
  Serial.begin(9600);
  Serial.println("Welcome to the chat program...");
 
  // set the data rate for the SoftwareSerial port
  chat.begin(9600);

  // delay 1s to stabilize serial ports
  delay(1000);

  chat.println("Your Friend is online");
}

void loop()
{
  if (chat.available())
    Serial.write(chat.read());
   
  if (Serial.available())
  {
    Serial.print("Me:\t");
    while (Serial.available())
    {
      text = Serial.read();
      chat.write(text);
      Serial.write(text);
    }
    chat.println();
    Serial.println();
  }
}


Here is the project.

Working Circuit for this project


So how does it work?

The basic idea is very simple here, the pin 7 is the RX pin and 8 is the TX pin. The way we have connected them is from TX to RX and RX to TX. What's gonna happen is this, what one is transmitting other will simply receive it and put it on display and as the path is bi-directional anyone can send and receive.


Result:




Here it is, a bi-directional conversation can be done here. I have used one a single computer to connect both the Arduinos but you can use two computers and essentially chat with someone else.

Hope it has helped.

Links:

1. Arduino webpage.
2. Read my other posts.

Tuesday, September 20, 2016

Fleming's Both Hands Rule!

Good afternoon everyone, so I think today is a good day to write about something kind of confusing which is Fleming's Left hand rule and his right hand rule. These rules are just mnemonic or you can call them memory technique to remember the directions of current, magnetic field and motion in both motor and generator.

So first things first remember this;

1. Fleming's Left-hand rule is used for electric motors.
2. Fleming's right-hand rule is used for electric generators.

Now let's talk about how to apply these rules, starting with left-hand or the motor hand.

As we are talking about motor the current and the magnetic field will be given but the force direction will be unknown. If a current carrying wire is subjected to a magnetic field in a perpendicular fashion then the wire will feel a force which is perpendicular to both the direction of current and magnetic field. So we are talking about 3 axis here, if you set say the field and current to x and y axis respectively then the motion will be in z axis. Things are a bit complicated without any visual representation.
 

Here is a left hand diagram where

Thumb or F is the force vector or the thrust on the conductor or motion of it. 
Fore finger or B represents the direction of magnetic field or flux density.
Second finger or I represents the direction of current.


Let's move on to the right hand rule now.

For generators however the motion and the field is given we need to know the direction of current. So thing is if we subject a moving conductor in a magnetic field we will get current which is both perpendicular to the two applied causes. Again let's look at a visual representation.



In here

The thumb is the motion of the conductors.
Fore finger is the magnetic field.
Second finger is the direction of current.



So that's a brief description of Fleming's left and right hand rules.

For more info visit the wiki links.

Left hand.
Right hand.

You can also read my other posts here.

Index to my blog.




Monday, September 5, 2016

Raspberry Pi Starter Kit

Good evening everyone. Hope you guys are doing great. So currently single board computers are very popular and getting more more and more popular day by day. Truth to be told there are huge amount of legitimate reasons behind their popularity. If you are however new to all these then this post might help you out. In this specific post I will be focusing on Raspberry Pi and I will go into the reason why in a few moments.


Like I was saying if you are new to this whole single board computer thing I would say start with Raspberry Pi as it has been here for quite a long time so you will get more support. Now let's take a look at what you are going to need to properly work with Raspberry Pi in many different scenarios. So couple things are common for all scenarios, let's start with them.

1. You will obviously need a Raspberry Pi, as for September 2016  I would suggest getting either a Pi 2 or Pi 3.

Raspberry Pi 3

Raspberry Pi 2
Let me give you a bit more info on this single board computers. Both of them are ARM based and have a lot of similarities but the newer one has couple more tricks up its sleeve.


System on Chip:

RPi2: BCM2836 Quad Core ARM Cortex-A7 900MHz with VideoCore IV 250MHz
RPi3: BCM2837 Quad Core ARM Cortex-A53 1200MHz with VideoCore IV 300MHz


Audio and Video Output:

HDMI supports 1080p video with audio.
3.5mm TRRS jack for Stereo Audio and Composite Video.


Connectivity:

RPi2:  10/100Mbps Ethernet Port via an USB to Ethernet Adapter on-board.
           4 USB 2.0 Port.
           1 HDMI, 1 3.5mm TRRS Jack.
           40GPIO Pins,
           Camera Interface(CSI)
           Display Interface(DSI)
           MicroSD Card Slot for Loading Operating system.
RPi3:  10/100Mbps Ethernet Port via an USB to Ethernet Adapter on-board
           Bluetooth 4.1Classic, Bluetooth LE, Wi-Fi 2.4GHz 802.11n Standard.
           4 USB 2.0 Port.
           1 HDMI, 1 3.5mm TRRS Jack.
           40GPIO Pins,
           Camera Interface(CSI)
           Display Interface(DSI)
           MicroSD Card Slot for Loading Operating system.
Power:

5V 2A(Recommended) via Micro USB.

So the major difference here is the Improvement on the CPU side as frequency is bumped from 900MHz to 1200MHz and also the GPU sees a little improvement. The big advantage here is the fact that Raspberry Pi 3 comes with Wi-Fi and Bluetooth. Next thing we need is microSD card to load operating system.

2. MicroSD cards.



As they are inexpensive I would suggest you to buy about 4 of them, 16GB of capacity and Class 10 in speed specification. That way you can keep one or two stable operating system ready in hand to use and maybe one or two more for experimenting.

3. A good power adapter.



To power up the device properly a good quality power supply is needed with a good micro USB cable. Personally I use phone chargers and they work just fine. I would suggest getting at-least 2A one but if you plan on using portable Hard drive or something I would recommend getting a 3A one. (Although keep in mind that the combined current output of all four ports are 1.2A)

4. Ethernet cable or Wi-Fi dongle:



Depending on which method you use, you might need an Ethernet cable, a CAT5e would be enough or you can opt for a USB Wi-Fi dongle for RPi2 but for the RPi3 it has built in Wi-Fi. If you are plan on using network attached storage however I would recommend using the Ethernet port as it will provide more consistent speed and better latency.

5. HDMI Cable and 3.5mm splitter:



For connecting with TV or monitor I would recommend using HDMI as it is better and easier to configure as oppose to the composite output, however if you still want to use that you can use another 4 pole to two 3 pole converter. The one that will work with Android or apple devices will also work here to. What it will do is just take in the A/V signal and give out separate stereo audio and composite video. In case of using the same jack with laptop's combo port or phone you will get stereo audio out and microphone in. Don't fall for the HDMI cable money trap though, 5$ one worked exactly like a 50$ one.

6. USB flash drive.



If you are plan on using NAS or Media Center or maybe RetroPi gaming setup, you might need this. Don't bother with USB3.0 however because ports on Raspberry Pi2/3 are of USB2.0 standard.

7. An analog game controller.


If you plan on using RetroPi this is a must for you. You can get either the wired one or wireless one.

8. (under construction)

Tuesday, August 30, 2016

Setting up DHCP address reservation

Good afternoon everyone, in this brief post I will talk about how you can enable DHCP address reservation on your router. For demonstration purpose I'm using a TP-Link router which is very common but any other brand of router should have the similar option too.

Before getting into how to do it let's discuss DHCP. It stands for Dynamic Host Configuration Protocol and as it's name suggests it is an network protocol used on Internet network protocol. This protocol is controlled by a DHCP server to dynamically distributes network parameters such as IP addresses. So it drastically reduce the workload for the network engineer who is in charge with deploying a network. If DHCP wasn't available network engineer or the person who is setting up the network has to manually assign IP addresses to all the devices but with DHCP the server itself assigns IP addresses to devices automatically. Connect a new device and it will get a new IP automatically, you don't have to do anything. If you think about depleting IP addresses then lease time will help you with that. Unused IP addresses will be re-cycled via this. DHCP server leases IP for certain set period of time, if after that time the device no longer needs the IP it will be assigned to some other device. So it's all well and good right then where is the point of reserving certain IP?

Here is the thing, if you are running a network attached storage or IP TV or media center then DHCP might not be ideal as it will change the IP address over time. Say if you configure your phone to get certain data from certain IP, if that IP changes it will no longer get that data, you will have to enter the new IP. Now if you completely turn off DHCP then again you have to manually set all the IP addresses for different devices. Hence DHCP address reservation. In this method what is done is simply reserve certain IP address to certain MAC address or device address so that that IP won't be given to anyone. This ensures that certain devices will always get certain IP addresses. For example I always reserve IP address for my Raspberry Pi so that I can easily SSH into them. Let's look at the procedure then.


Procedure:

1. Get into the router via the web based interface, for different router it might be different for example
Tp-link can be accessed with http://192.168.0.1/ or tplinklogin.net
SMC can be accessed with http://192.168.1.1/



After that login with the username and password, it should be written under the router or on the box if you haven't changed it yet.

2. After getting into the router you will be greeted with this page where you should find something like DHCP. We need to get into that too


3. Now getting into DHCP we will find the options for turning it on or off. Default it should be enabled and we want to keep it that way.


4. Next we need to go to the DHCP Client list to get the MAC address for our client. If you can't determine the device from the client name, for example it is very tough to determine android devices so in that case you might want to gather the IP address or MAC address from the device itself. Keep that MAC address in mind to assign the IP address that you want to assign. Remember the lease time I was talking about? Look carefully and you will see some devices have their IP address with lease time, after the expiration either those IP addresses will be renewed or given to some other device if needed. Those with the Permanent lease time are reserved.


5. Now let's move on to the final part the Address reservation, in here you will see any existing one that is already configured or you can add/modify/delete any entry.


6. As I already have couple devices configured to have same IP address all the time those devices are already listed here. If you are doing it for the first time you will see an empty table. To add a new entry you simply click Add new and put in the MAC address and IP address and done. You might want to restart the router afterwards.


So that's how easy it is got enable DHCP address reservation and saves a lot of time finding IP addresses of devices. Now for an example I will always reach my Raspberry Pi 2 at 192.168.0.103

Hope it has helped.

Read my other posts here.

Friday, August 26, 2016

Learn English - Euphemisms

Good morning everyone and in this particular post I will talk about Euphemism and it's usage with couple examples.


So what is Euphemism? 


To simply put it is something to replace certain harsh or offensive words with something mild or less unpleasant. So basically it substitutes harsh, offensive, direct words or words that has negative stigma attached to it to something softer in order to avoid offending people or over inflate the importance of some words. It can be a word or two or an expression. Honestly I'm not a big fan Euphemisms, I like to call things whatever it is in most cases but in this day and age it is very easy to offend people, so it is better to learn about an alternate way of expressing your mind. Hopefully this hasn't offended anyone yet. To me personally it is not about showing disrespect or something because I think someone can be disrespectful inside even if they use a milder word but someone can be respectful and yet call spade a spade. Now Let's take a look at couple examples that are very common.


Examples:

1.

Death, instead of blatantly saying someone has died we can use something different like

Passed away,
Meet someone's maker,
Six feet under,
Didn't make it,
Departed,
Negative patient outcome etc.


2.

Toilet, many people feels shy using this word so they use something else like

Little boy's room,
Rest room,
Wash room,
Lady's room,
Go and see a man about a dog,
Powder your nose,
Spend a penny etc.


3.

Unemployed, it is a bit harsh to say someone is unemployed so we can use

Laid off,
Between jobs etc.


4.

Handicapped or Disabled, again rude to use such terms and about the word disabled they are really not disabled so it is better to use something like this

Mentally challenged,
Physically challenged,
Differently-able etc.


5.

Fat, again some people consider this word to be rude so the following words can be used instead

Overweight,
Full figured,
A few extra pounds,
Let himself go,
Portly,
Big boned,
Chubby etc.


6.

Stolen(or cheap product), often times we can buy very cheap products from something like a black market that we know might have been stolen, we don't say stolen we say the following words,

Fell off the back of a truck,
Get off the truck etc.


7.

Used, in car dealership using the term used kind of decreases the value of the good so they instead use

Previously enjoyed.


8.

Getting pregnant, some people feel shy to admit it or say anything about it so they use different terms like

Bun in the oven,
Knocked up(some people actually consider this to be even more negative).


9.

Jail, it is not pleasant to say someone is in the jail rather the following term is used.

Correctional facility.


10.

Genocide, I don't have any problem with this word rather I would say it is better to use this because softening it might undermine the severity of what happened. We know examples of genocide like Armenian Genocide of First World War, Jewish genocide on Second World War, Genocide on Bangladeshi people on 1971 etc. and these were really severe so again I don't see any point of using anything else but people use the term

Ethnic cleansing.


11.

Prostitution might sound taboo and people use

Turn a trick.


12.

Accidental death, which often times happen specially during war time or invasion time like now and lot of time civilian casualty happens and rather than using accidental death media or government  usually uses

Collateral damage.


13.

To fire someone might not sound good so instead of saying that we can use

Letting someone go.


14.

Euthanize is to kill someone(usually animal) to lessen their suffering. In a terminal case where the animal usually a pet is going to die anyway and suffering greatly they are instead euthanized and people don't like to call it this so they say

Put to sleep,
Pull the plug.


15.

Homeless, instead of saying homeless it is polite to use

On the streets.


16.

Abortion might sound harsh or saddening to some people so they use

Pregnancy termination.


17.

Pornography might offend some people so use

Adult entertainment.


18.

Liquor, wine and beer might offend people too so instead use

Adult beverage.


19.

Prostitute, some people use

Comfort woman although I don't agree with this because this word was used during world war 2 and comfort women were the girls that were forced into sex slavery by Japanese people so not really prostitutes.


20.

Late kinda sounds harsh so use

Chronologically challenged.


21.

To have Sex sounds aggressive to some people so use

Sleep together,
Go all the way.


22.

Short, don't say someone is short which might offend that person instead use

Vertically challenged.


23.

Maid, the person who works at home can be called

Domestic engineer.


24.

Ugly can be derogatory so use

Appearance deficit.


25.

A place where chance of getting mugged is high can be referred to as

Vibrant area of town.


26.

Lazy can be harsh too so use a bit more polite

Couch potato.


27.

Stripper is a person who usually dance or performs naked so use

Exotic dancer.


28.

Elderly, rather than saying it better say

Senior citizen.


29.

Poor also might sound rude so use

Economically challenged.


30.

Unwanted call is kind of a call to or from wrong person and can be said

Courtesy call.


These are some common Euphemisms that you might hear on a daily basis.


Read my other posts here.


Sunday, July 24, 2016

DIY LED Torch

If you go out to visit someplace or go on camping a torch will be very handy right? You can use a mobile phone flash for the job but it will be much more comfortable to use an actual torch and it will be more fun if you can make one for yourself right? This post is about making your own LED torch.


Components needed:

1. Integrated circuit: MAX660.
2. Capacitor: 1*22uF and 1*100uF, better to get tantalum type capacitor.
3. Diode: 3*1N4148, LED: 3*High brightness LED.
4. For power use 2*AA Cells.
5. Enclosure for circuit, battery and reflector for LED.
6. Don't forget to put a switch between source and circuit that will serve the purpose of turning on/off.


Circuit Diagram:



 How it works? 

The first question that you might ask is why do we need an Integrated circuit for this! LED can be used directly with a power source, maybe limiting the current via a resistor will be enough and yes you are correct but in this arrangement of constant current provided by the MAX660 integrated circuit that is in voltage Inverter mode will be able to drive them at constant brightness.

So simply we are powering the LED via two AA cells, typically 1.5V per cell for non rechargeable one. You can use rechargeable cells too but probably disposable Alkaline cells will be better suited for this purpose. You might want to read why is that!

Like I mentioned above MAX660 will provide a constant current which in this case is 100mA is enough to drive multiple LED which is done in this circuit.

I forgot to add a switch to this circuit, you can just add it between Bat+ and Pin 8 of the integrated circuit.


Resource:

1. MAX660 Datasheet
2. LED Driven in constant Current
3. My other posts.

Main Line Powered LED Pilot Lamp

This is a post about AC main line powered LED lamp with minimum components.

There is not much to write about this circuit so I will try to go a bit deeper and explain how the whole thing works. This circuit can be used with any electrical outlet that does not have a pilot lamp or indicator.


So what do we need for this?

1. A small circuit board to assemble, or you can just solder parts to each other.
2. 0.1uF 400V non polar capacitor, it might read 104 in front of it.
3. 1kohm 1/4W Resistor.
4. 1N4004 diode.
5. LED

That's all!


Circuit Diagram:



How it works? 

Simply the capacitor is dropping the voltage and the resistor is limiting the inrush current. The diode 1N4004 is performing two crucial tasks here. First one is it is limiting the maximum reverse voltage across the LED and the second one is it is providing a path for the negative half cycle so that the capacitor can pass current in both direction. During positive half cycle it will pass through the LED and for the negative one like I mentioned above the diode will be used. If you want to work with lower input voltage just increase the value of the capacitor and that's pretty much it!


WARNING:
 
SHOCK HAZARD!


This circuit is not isolated from the AC main line so do not touch any part of the circuit without testing even when the power is off.


Modification:

1. Diode 4004 can be replaced with another LED. Same orientation as the diode.
2. A resistor can be used across the capacitor to discharge it when not in use. 

Hope it will help! Happy Experimenting!

You can read my other posts here.
Learn about Inrush Current.

Friday, July 22, 2016

SLi, Everything you need to know

Good evening everyone, today again slightly different topic and kinda written in brief and it is about SLI. Hope you will enjoy it.

What is SLI?

I won't go much into details here with all those technical terms of how it works but to put simply this is a GPU technology developed and used by Nvidia to utilize more than one GPU in a single system to boost the performance. For two cards alternate frame rendering can be used where one GPU renders the odd frames other one renders the even frames thus increasing the overall throughput. Although SLI was first used by 3DFX on their Voodoo2 cards but that SLI meant Scan Line Interleave and SLI used by Nvidia means Scalable Link Interface.

3DFX Cards in SLI configuration


What Do you need? 

1. Multiple SLI capable GPU.

2. SLI enabled motherboard.

3. SLI Bridge.

4. SLI enabled operating system.

5. Proper drivers and applications.

Nvidia GTX980 2 Way SLI on an Asus X99 board.


Gains and advantages: 

1. Substantial performance increase.

2. It might be the case when you already have the best card and you want more performance out of your system you have no choice but to add in another card.

3. Chances are you are running a card from older generation and price of your card has dropped as with the release of new generation it always happens. You can either get a new card from new generation or add in a same card and get more performance out of it.

4. You can easily hit higher frame rates or better quality with SLI, there are games at this time that would even put the best card out there in good amount of stress.

5. Show off and bragging rights, don't deny it many people use SLI just for this. You will get huge scores in benchmarks.


Limitations and disadvantages:

1. Video RAM won't add up which means two 4GB card won't give you 8GB of video memory instead it will give you 4GB. The reason being each card has to store the same data so eventually the total effective memory stays the same.

2. Not all tittles support SLI and many of the games are optimized for taking full advantages of it. So many games will just run on a single card. For example Company of Heroes does not even support SLI, so when I played this game with my SLI setup only one card was essentially taken all the load.

3. Performance does not scale up that much, two cards do not necessarily guarantee 200% performance and three of them won't give you 300% and as more and more cards are added the scaling goes down even further and latest generation of 1000 series cards actually have a lot of things regarding SLI but it is ideal to use only two of them.

4. You will need a SLI capable motherboard that will be slightly costly and as you add in more cards PCI express link width will decrease in most cases. Let me remind you that most common AMD and Intel desktop processors only have 16 PCI Express lanes. For example the Core i7 6700k has 16 lanes. So for single card it will be 16X but if you add in another card the link speed will go down to 8X, adding a third card will decrease the link speed to 4X for two of them. For single moderately powerful card 8X bus speed is enough but for high end card you might loose a little performance for decrease of Bandwidth. However for 28/40 lane Intel Extreme processors you can add up multiple cards without loosing that much bandwidth.

5. A much beefier power supply is needed, preferably one with SLI certification. Personally I use one with a single 12V Rail that can provide good amount of current on it because that way I don't have to worry about balancing the load. To learn more about this you can check this post.

6. Only same Graphics Processing Card can be used together. For example you can use two GTX980 together but not one GTX980 with a GTX970. You can however use different manufacturer. I have used Gigabyte Card with MSI card, as long as they have the same Graphics processing unit you can use them together. DirectX 12 supposed to solve this issue but let's see how things turn out.

7. Cards with aftermarket cooler might make the inside of the case hotter as these cards tend to exert heat inside the case. Blower style reference cards are better in this regard as they blow heat out of the case. Moreover top card might run hotter in many cases as it will get less air due to the close proximity of another card.

8. In poorly optimized games it might result in stuttering which drastically decreases the overall gaming experience. You will see that the game is running at a very high frame rate but frame time will be so different that the game won't be enjoyable any more. For example I had this issue with Far Cry 4 and Call of Duty Advanced Warfare with my SLI setup.

9. Many CUDA enabled software won't be able to use both cards at the same time. In that case a single card would have been better.


Final thought:

So if you are out for shopping a new card buy the absolute best you can get for your budget. It is not wise to spend on two moderately powered cards over a powerful one. Think about it in this way, if you want to accommodate multiple cards you will be using SLI enabled motherboard and high end power supply unit rather you can just go with a single GPU and a slightly cheap board which will actually give you more performance for the money.

But like I said earlier, if you want the absolute best and even the single card in the market is way below your maximum capability, by all means go ahead and add another one and if you want to get a older generation card to pair with your existing one rather than buying a new generation card, you can do that too.

That's pretty much it, good day everyone.

Visit my full blog here.

Tuesday, July 19, 2016

Why does Bangladesh Import academic books?

Good evening, so I came across this interesting discussion so I think it is worth sharing!


Let's talk about O/A level books first.

As far as I’m concerned they have to stick to the regulations of IGCSE and most O/A level books that I have seen might be from India but they are not written by Indians rather most of them are written by probably Europeans. So probably even if any Bangladeshi person writes a book on O/A level topics won’t be accepted as a textbook and students have to buy the ones that are suggested by the curriculum. This is a standard they want to maintain or maybe even a monopoly so won’t accept anything else.


Look at school and college level books, they are pretty much the same as O/A level books only difference being O/A level books have more topics but SSC/HSC level books go much deeper into any certain topic and these books(SSC/HSC) are written solely by Bangladeshi writers, you probably won’t find any SSC/HSC book written by anyone else, even the ones that are in English so apply the same thing to O/A level, it is easy to understand Bangladesh has to import them. You probably will get pirated O/A level books in Bangladesh too, printed locally.


*Now what is wrong with Bangladesh’s publication industry?

Nothing is wrong, they act the same way as any other publication industry, quality is not the concern, profit is so they will publish anything that sales better no matter what the quality is and then again for artistic point of view everything is relative.


*Don’t Bangladesh has quality writers?

Question to this answer actually lies within the answer of your next question so let me tackle both at the same time.


*Don’t Bangladeshi people buy books?

This is a broad question because you were talking about Academic books but now this question also applies to general class too. The simple answer is no, most Bangladeshi people don’t want to buy books anymore and they read much less than they once read at a time and you can guess the reason too, there are more ways of entertainment available this days, you have huge amount of TV channels, radio channels, social networking sites, YouTube etc and Bangladesh has moderately high speed internet this days so people passes time on them more than anything. Look at the modern generation, they rarely read a book and what can you do they have grown up with these technological wonders and we all know how they can impact attention. There was a time when people bought a lot of books. Book fairs had huge amount of sell, libraries had too but now people just visit those places and if you don’t have an audience no one’s gonna create what a small minority might demand. You probably won’t get to live by the earning from writing a book so it is better to do something else and think about it more and more generations are distancing themselves from books so who is going to write them?

On academic level however it is even more painful, most people will go to KFC or Pizza hut and spend thousands on food, they will buy pricey dresses, pricey cosmetics but when it comes to buying books they will look for free digital copy, not all of them of-course but most of them will do it and can’t fathom this. Many private universities solely depend on presentation files and often times people print them or use any device to read them so the market is shrinking, if you write something and no one buys that you won’t write anymore.

Although luckily we have some good books written by teachers from University of Dhaka, I can give one good example, math books like Linear Algebra, a good book written by Prof. MD. Abdur Rahman of dept. of mathematics. I will hope view of Bangladeshi people will change and then Bangladesh can import less and it will eventually fuel other teachers to write something.

Hope it has given you something to think about. 


Q:1 Non Rechargeable Batteries, why do we still use them?

Good evening everyone, this is another new segment where I try to write about question or queries that I was asked and think they are worth writing about. So the very first post is about batteries, rechargeable versus non rechargeable. In this day and age where rechargeable cells are very common why do we still use one time use ones? If you have this question too let's see if I can answer that.


Collection of non-rechargeable AA cells
NiMH AA cells being Charged


Most devices that we use today are powered by rechargeable cells and it is understandable why because even if the rechargeable one will cost you more money to get it will cover that up with it's ability to be used for many times. Even if you have to buy a charger for it and charging will cost you some electricity bill yet your money will be saved because you will be able to charge them and use them for moderately long period of time.


Both rechargeable and non-rechargeable cells have their usage and most of the time in different scenarios. So let me mention some of those scenarios where non-rechargeable cells might perform better and then explain why.
  1. In low drain devices like Infrared Remote Controller, Electronic Calculator, Wall clocks or different other similar gadgets non-rechargeable cells are better. Lets think about the wall clock, you know those clocks that run on single AA cell. If you put a normal AA cell that might cost 1/8th of a dollar it probably will run for a year, put an Alkaline one that might cost you 1/2 dollar and it will run for around 3 years so where is the point of even putting a pricey rechargeable cell! Same thing is true for other products that I have mentioned.
  2. Electronic devices that are hardly used and might sit on the shelf for a long time and you might need them to work right away, in this case Disposable cells will be much better suited.
  3. One thing to remember is the NiMH cells have a nominal voltage of 1.2V where standard non rechargeable ones have 1.5V so in many cases the rechargeable one might be considered to be low in voltage even though it has good capacity left.
  4. Charging NiMH is a bit tricky so you will need a good charger so ultimately you will have to invest a good amount of money if you want to use rechargeable cells as oppose to non-rechargeable ones.
Now let’s think about why. Well the very first reason is self discharge rate of NiMH is much higher than non-rechargeable Alkaline cells. The AA Alkaline cells that I bought last year comes with an expiry date of 2022 and I know for fact that they will even work after that time but NiMH will need to charged up occasionally.

For low drain device it might even be the case where the current that the device drains is smaller than the self discharge rate so really not suitable for low drain devices and if for devices that are just kept for emergency like a flash light if you just keep that like for couple years chances are the NiMH cells will just discharge fully and won’t work when you will need it.

NiMH dumb chargers might not be that pricey but they are not good for the cells and might overcharge and cause them to fail prematurely to avoid this you will need a smart charger and usually those smart chargers cost much more than dumb ones.

Another important thing to remember is the environmental impact, yes primary cells(or non rechargeable cells) might be the the bigger contributor to this although the use of mercury is no longer prohibited so environmental impact is not that severe and as I was saying earlier if an AA Alkaline can power a wall clock for 3 years that impact is really negligible although we should be careful while using these cells, stopping unnecessary usage will be eventually be better for everyone.

Note:

Notice that I have spoken mostly about NiMH, why is that? Because in places where lithium ion or lead acid batteries are used it is very hard to replace them with non-rechargeable ones as the cost will go up significantly for example in mobile phone or laptop or uninterruptible power supplies but for NiMH in low drain application you might even get better value using non-rechargeable cells.

Hopefully this small discussion has given you something to think of.

Visit the Index page of my blog for more posts.

Friday, June 10, 2016

Getting Started with Hobby Electronics - 1

Good afternoon everyone, I was planning to write this post for a very long time now, but didn't quite got my thoughts together to compile this so let me try another time. I will be writing this as a series and first one obviously is the introduction.

To whom this post might concern:

1. Someone who is trying to get into hobby electronics.
2. Someone who is already into it but not sure what to do.
3. Someone who is facing difficulty.
4. Just to get the idea what it is all about.

Why? 

Well, this probably is the most common question that we get is why do you need to be an electronic hobbyist? The simple answer is, it is a hobby, I don't need a reason to have this hobby, simple. Although it is pretty much the same as any other hobby but it might be somewhat beneficial in your day to day life too. Electronics hobbyists usually don't have to rely on electricians for normal day to day needs regarding electrical equipment and stuffs. An electronic hobbyist can many of his/her domestic problems associated with electrical or electronic items just fine. So it is obvious that hobby electronics is a pretty fun thing to do and also very useful.

I do understand that hobby is a thing that we do to distract ourselves from the normal monotonous work that we do so often times we don't worry about the gains from hobbies and it should be this way but almost every hobby that I know will help you with something. If you collect stamp it is pretty sure that you know something about many countries that other people do not know about. This knowledge pretty much comes free and it might help you one day, same thing applies for electronics hobby too. It will help you in many ways but that is not the primary purpose.

How about some more examples?

I probably can think of thousands upon thousands of examples of how this hobby can help you in your day to day life but let's just start with some normal examples.

1. Say your 2 years old router is not working, none of the indicator lights are glowing but you need internet very badly, what can you do? Well you are in luck if your hobby is electronics, measure the output voltage of the adapter of the router. Probably it has died so not putting anything on the output lead. Okay so probably the problem is identified, now you can look closely at the adapter or router it should say the working voltage of it. Assume 9V 0.6A which is very common. Now with your skill and simple components like the 7809 regulator you can make a power supply under 10 minutes and you are good to go to run the router again.

2. Your phone needs charging but no electricity, although you have a sealed lead acid battery and couple other components. What can you do? Well make a simple circuit that puts out 5V from the input 12V, maybe a 2576 regulator based circuit and done, charge your phone with that! You need to charge your lead acid battery? No problem you can do that later too maybe with a 317 integrated circuit and some other components!

3. How about some automation? A remote control to turn on your lights or fans? Sounds good right and you can make that happen with some development board too, not that complicated either!

4. Ceiling fan running slow? Chances are the capacitor has gone bad, replace it, if you are a hobbyist it will be a very simple thing to do, no need to call for assistance of other people and it might take only 3-4 minutes.

5. Need to change blown fuses? Depleted batteries? Damaged lamps? Well you can do any of them with relative ease. Someone who doesn't have this hobby can do it too so it will be even easier for you.

6. How about building a small Network attached storage that will download and store your favorite series which you can watch from any device you want? Well you are in luck, you can use any small single board computer to do this.

7. How about making a small amplifier? You can use either Bluetooth or standard wire with it to get the audio from the source!

You can think of infinite number of examples too but I will just stop here and hope that my point has gone across. Proper tools and necessary knowledge can make your life a lot easier and we regularly face this issues so no harm knowing I guess.

One thing to keep in mind though yes you can buy these stuffs or service but the main thing is the fun, making something brings a lot of pleasure and this pleasure will be multiplied when you will see the things that you make are working properly and helping you with something!

That is pretty much what I wanted to say as introduction, I hope I have got your attention so in the next couple posts I will be focusing on:

1. The hardware that is needed, both mandatory and optional.
2. Some circuit theories that might be helpful.
3. Conclusion.

Resource:

1. Index page of my blog!



Friday, June 3, 2016

Tight VNC Server On Raspberry Pi

Good morning everyone so according to my plan I was experimenting with the Raspberry Pi and trying to document as much as possible but the process is still pretty slow but here is a small bit of that. So we know Raspberry Pi is a single board computer that has its own Video output but what if you don't want to use it and you are not happy with the SSH either then a virtual network computing might come handy. So this post is about how you can set up VNC and use it on raspberry pi. 


First of all what do we need?

1. The obvious one which is a Raspberry Pi, I'm using the Pi 2 model B. 





2. Next we need something to power up the Pi. I'm using my good old phone adapter from Asus. You can use whatever you have on hand but make sure it is from a reputable brand.



3. You need to connect the Pi to the network where the other system is connected in order to make this happen. Probably you can connect a Pi directly with your system and it will still work but it is much convenient to use a router or something. I'm just using my home router to connect with both my computer and Pi 2 via Ethernet cable. You can use wired or wireless network, no problem.


4. We need some software like Putty and Tight VNC for the computer which I will get more into in procedure section. These software are free and download links will be on the resource section.

So let's begin!


First let's talk about the connection.

I'm guessing you are running the latest version of Raspbian. So just plug in the network wire and power it up. In case of Wireless, make sure to connect to the network that you will be using and done.


Procedure:

1. Make sure your computer is also connected to the same network and get the IP address of your Pi. To do this you can check the router's client list. In my case it is 192.168.0.103. 




One important Tip here, if you have to frequently use SSH to login and you need the IP often and you don't want to turn off the DHCP of your router then what you can do is reserve the IP address against that MAC address. This way your Pi(or any other device) will always have the same IP as long as that MAC address matches.

There is another easy way however, just type ifconfig directly on the Terminal of Raspbian or via Putty and you will get the IP address. (Although if you already have the IP to connect via Putty why would you need the IP one more time right?)

 



As I'm using Pi 2, I only have the wired Ethernet, if you use Pi 3 or an USB Wi-Fi dongle you might get one more option of eth1 and make sure you use the proper IP. 

2. Now that we have the IP address we will move on to Putty and login.

Default User : pi 
Default Password: raspberry



Okay so we are in!

3. Make sure your Pi is fully updated, if not type in the following commands and update the pi.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Now when the upgrade process is finished let's start installing the VNC server. To do so type in

sudo apt-get install tightvncserver



So mine was already installed and updated. For you just install it.

4. Now to enter the password type in tightvncserver and hit enter.



It is nothing that complicated either, for the first time you need a password that viewer computer has to put in to see. I keep it at default raspberry.

5. Now let's start a full high definition session on display 1. Remember when your Pi boots up it has already started a display at display 0, so you have to use display 1. To do so type in

vncserver :1 -geometry 1920x1080 -depth 24



You can probably use 32bit depth but I tried using it and didn't work so 24bit is fine. 


6. Now download and install tight VNC viewer on your computer and launch it. 




Important thing to remember is the :1 part, if your pi starts broadcasting at display 2, you have to use :2 for that. Anyway after launching Tight VNC viewer, type in the IP with display number and hit enter. Next enter the password that you set up earlier. Click okay and done, now you should view through the network and work on it. Let me show you an example.



So that's pretty much how you can set the whole thing up. There are much to it actually like turning off the display at 0 because remember display 1 and display 0 are not showing the same thing. You can also set up tight vnc server to start at the boot, the way that I have shown will require you to start each time you boot up the pi.

Anyway that's pretty much it, let me add the useful links down below.


Resources: 


Good luck and happy experimenting!