Sunday 15 November 2015

Arduino tutorial 3: millis() function

If you are new for my tutorial,just check out this

Things to know about ARDUINO

ARDUINO TUTORIAL 1: Reading analog sensor

Arduino tutorial 2:basic programmings

millis()
  • It is a inbuilt function of arduino(so we need not to include any preprocessor statement to use this).
  • If you use the millis() function,it gives the number of milliseconds since the arduino started running the sketch. so it is named as millis().
  • Delay() function is also an inbuilt function as like millis().If we invoke delay() function nothing will be happen untill delay() has finished.
  • So at that time ,the response from arduino would not instantaneous.It is a drawback
  • Some critical situation you may not use delay() function in your program.Instead of that you can use millis().
  • ()-represents that it is a function.
  • This function is also used to measure frequency using arduino,to find the toggle time and most importantly for deb-ounce. 

Serial monitor
  • On top right corner of the above image is a button for Serial monitor.
  • It displays the Serial data from arduino.
  • If you want to use this ,you want to begin this in setup().
  • Serial.begin(9600) is used to begin communication to Serial monitor.9600 is the baud rate which defines the rate of speed of data transfer.
  • Serial.print("Arduino program"),this command print "Arduino program".

millis() program:

  •  In above program,Serial communication to Serial monitor is invoked in setup().
  • In loop,Reasonable delay for better visibility. you can change the delay time and you get the corresponding output change.
  • Serial.println() -It print consecutive data in new line.Instead of this if you use Serial.print() ,the new line would not be invoked.
  • just run this on your arduino and see what it will do.
millis() counter for 10 sec:

This is to count 10 sec using millis() and It is little bit complicated than what we seen before.explanation is on image itself.


   
The output of this program is :







If you have any douts,feel free to ask me in comment box.
To get more updates like my page in facebook
Learn Electronics-Facebook

Friday 6 November 2015

Arduino tutorial 2:basic programmings


Hi guys,

This is the continuity of tutorial 1, i hope you got knowledge about analog sensors and its working.

If you haven't got my tutorial 1,Here the link:
ARDUINO TUTORIAL 1: Reading analog sensor
If you miss that, Don't worry!
Go and study then you got better idea about this one.

Arduino is an integrated development environment ( both software and hardware).So only,the software to program arduino is named as Arduino IDE and it's available in www.arduino.cc.
Just go there and download and install that.
  If you are a windows user,make sure you successfully installed driver also.
 Your Arduino IDE looks like this .


In above image you can see 2 functions or Methods.One is void setup() and other is void loop()

void setup()
{
}

void-It denotes ,this function does not return any value.
setup()-It is set your projects input and output pins. 
It is used to give a overview about your project to arduino.
It is enough now,for upcoming tutorials you get a better idea about this.

void loop()
{
}
your program must be inside this loop.then only it continuously run your program.It is a never ending loop.

Now come back to reading analog sensor.The program for reading analog sensor is given below.


This program is to read the value of analog out and print it in a serial monitor(looks in right corner of arduino IDE).
  • The analogRead(a0) gets reading of analog sensor and give it to the variable sensorValue  .
  • Serial.println(sensorValue) is to print the values in serial monitor
  • delay(1) is give the appropriate delay to took reading .the delay here is 1 milli seconds .you can change it to delay(1000)-( 1000 ms=1 sec) to get a better visibility.
  • This program is available in File>Examples >Basics>analogSerialread.
  • On the top of the IDE,there is a tick symbol . It is used to compile the program.
  • On next to that,the arrow is used to send the program to arduino.
  • Before sending the program,make sure you haven't get any error.
If you have any problem for troubleshooting,make sure about your COM ports.
verify the program twice,and make sure for no error.

If you have any doubt,ask me in comment box

Follow me on facebook to get more updates:
Learn Electronics- Facebook



 

Friday 30 October 2015

ARDUINO TUTORIAL 1: Reading analog sensor


ARDUINO TUTORIAL 1: READING ANALOG SENSOR

ANALOG SENSOR:
Analog sensor

There are different types analog sensors are here. The basic types of sensors are:
  •     variable current output
  •     variable voltage output
In industry,they use current analog sensors ,its is the rating of (4-20)mA.
But here,we gonna see about the voltage analog sensor and how to interface with arduino.
Basically,the voltage analog sensor varies its output range from 0v to 5v.
0v means no detection in the analog sensor , 5v means high detection in the sensor and the intermediate values are proportional to the detection.

Example: LDR(light dependent resistor) is an analog sensor,its output is  proportional to light and its resistance is indirectly proportional to light.
   If  more light falls on the sensor,its resistance goes 0ohm,then it gives the high output(as per we given) and vice versa.

ARDUINO ADC:

  • Arduino have 6 analog input pins on the left bottom of that.
  • The first analog pin is A0,second is A1 and so on.
  • It has a inbuilt 10bit ADC in analog pins.so your analog values are converted into digital by ADC.
  • Suppose,if you want measure the light intensity of the room using LDR. Presumably, a good LDR gives the varying output accordance with the light intensity of the room.Reading the analog values directly is not possible.so you can use the inbuilt ADC in arduino.
  • The accuracy of ADC is determined by the resolution.In case of arduino ,it have a 10bit ADC (i.e) 2^10=1024
  • so your analog values 0-5v is split into 1024.
  • 0v gives 0000,5v gives 1023(because 0000-1023 is 1024 values)
  • if it's 2.5v ,ADC gives 512 and so on  .
ARDUINO COMMANDS:
  •  I hope ,now you got better understanding about ADC and analog sensors.
  • Now you can integrate this into your arduino.
  • The arduino commands to read analog value is analogRead(a0).
  • Here a0 is analog pin.
so,on my next tutorial i'll explain about how to write program (on your own) for arduino .If you have any douts, ask me in comment box
To get more updates follow me on facebook
Learn Electronics- Facebook

Sunday 4 October 2015

Know about a scientist:

-He spent his whole life on inventions -
(from age four on)
-He was the first inventor to have an invention laboratory!
-He invented the first electric light bulb.
The first one lasted 40 hours.
The second one lasted 225 hours
-He invented the movie camera-which is the reason we are
able to go to the movie theater today!!
-He invented the fluoroscope.
-He also invented the re-chargeable battery.
-He was celebrated on the fiftieth anniversary of the
invention of the light bulb.
Unless,He is thomas alwa edison.

Saturday 3 October 2015

How to test a relay whether it's working or not?

How to test a relay whether it's working or not ?
 Relay is an electromagnetic device. Basically it has a 5 pins,more pins also available it depends on the type of relay. For industrial purpose,they use 8 pin relays.But all relays working in a same principle. Here we will study about 5 pin relay. This is we used in our projects. The 5 pin relay is shown in fig.


RELAY

Normally, relays are used to turn on the 230v with the help of 5v(different values are available). The testing methods are:

METHOD 1: 



  • This is using multimeter. put your multimeter in resistance measurement.
  • Make sure your multimeter is working ( By connecting the 2 leads ,it shows zero resistance) 
  • The relay shown in fig,we have 3 leads in same line on top of the relay.In that 2 leads on the both sides are coil leads.The center lead also we call as center.
  • Measure the resistance of the coil in relay.Normally ,the relay coil resistance is 350ohm + 10% tolerance.  If it shows in between range of that,then your relay is working otherwise it is not.
METHOD 2:
12v relay

  • This method is depends on the voltage rating of your relay.
  • If you use 5v relay, then take 5v power supply(or choose variable supply to 5v)
  • connect the positive and negative leads of power supply to the coil leads. Then the relay changes it n/o ,n/c contacts( You can identify this by hearing "tuk" sound ). 
  • If you remove supply,it goes back to the normal state.
  • continuously oscillating relays are also not working.
 Identifying N/O and N/C contacts:



  • N/O- Normally open.
  • N/C-normally close.
  • Put your multimeter in continuity,make sure your multimeter is working by connecting the 2 leads of multimeter(it gives beep sound).
  • In normal condition,connect positive lead to center of the relay and place the -ve lead in other 2 leads(Any one at a time) in bottom of the relay.
  • If beep sound occurs,then it is N/C contact
  • Other lead is   N/O contact.
  • By connecting supply to the coil,the continuity changes from N/C to N/O contact. 
If you have any doubts , ask me in below comment box.
Follow me on facebook  to get more updates.
Learn Electronics-facebook

What is "GSM"?

What is "GSM"?
GSM is a TDMA based wireless network
technology developed in Europe that is used
throughout most of the world. GSM phones make
use of a SIM card to identify the user's account.
The use of the SIM card allows GSM network
users to quickly move their phone number from
one GSM phone to another by simply moving the
SIM card. Currently GSM networks operate on the
850MHz, 900MHz, 1800MHz, and 1900MHz
frequency bands. Devices that support all four
bands are called quad-band, with those that
support 3 or 2 bands called tri-band and dual-
band, respectively. In the United States, Cingular
operates on the 850 and 1900MHz bands, while
T-Mobile operates only on the 1900MHz band.
Also known as: "Global System for Mobile
Communications", "Groupe Special Mobile"

Friday 2 October 2015

SIMPLE LAPTOP STEREO SPEAKER

SIMPLE LAPTOP  STEREO SPEAKER:

connect the components as per figure shown below.

Architecture of 8085 microprocessor

The architecture of 8085 microprocessor as shown in fig. It is the basic architecture of all microcontrollers used today.

Things to know about ARDUINO

what is ARDUINO:
 Arduino is open source hardware, all the design files, schematics,
and source code are freely available to everybody. The best part about the arduino prototyping platform is that's whatever you want it to be. The Atmel micro-controller is fixed to arduino boards which have TTL serial converter,voltage regulators, USB connector, ICSP connector and so on.you can program through arduino IDE(integrated development environment) which is available on www.arduino.cc
 

Arduino Functionality :
All Arduino boards have a few key capabilities and functions.
  • At the heart of every Arduino is an Atmel microcontroller unit (MCU).
  • The Arduino Uno in Figure uses an ATMega 328p. The  Arduino Due is an exception;it uses an ARM Cortex microcontroller. This microcontroller is responsible forholding all of your compiled code and executing the commands you specify.                                                                                      
  • The Arduino programming language gives you access to microcontroller peripherals,including analog-to-digital converters (ADCs), general-purpose input/output(I/O) pins, communication buses (including I2C and SPI), and serial interfaces.                                           
  • A 16 MHz ceramic resonator is wired to the ATMega’s clockpins , which serves as the reference by which all program commands execute.                  
  • You can use the Reset button to restart the execution of your program.
  • Arduino boards come with a debug LED already connected to pin 13
To get more updates,like my page in facebook
Learn Electronics-Facebook