Tuesday, 4 July 2017

AT Commands for esp8266


Sunday, 14 February 2016

Flashing WINAVR code to Microcontroller using ARDUINO Bootloader

                             Hey all...after a long time i came with a new idea which i have implemented,it is programming a AVR micro controller using WINAVR with ARDUINO as Programmer.its little bit confusing,dont worry.I will give you complete description.
                                 Generally we program a micro controller using a programmer,so here it is normal programming.normal programming in sense??we use the programmer according to the software we used(for example,to program arduino we use a usb cable which  connected between pc and FTDI circuit as a programmer here controller will accepts the code because it contains a boot-loader ,similarly in AVR controllers we use some isp programmers like serial and usbasp's)and for flashing we use some third party tools. So few days back i came across with different type of programming i worked almost one month for this achievement.In This method of programming i am going to program a noraml avr controller with WINAVR code.you may think that there is nothing new if you are thinking sooo, once again read the title of the Post.here i will flash the WINAVR'S HEX file into avr controller(say atmega8) with arduino but not with normal programmers
before starting this you will need some below mentioned things
1.Arduino Board
2.Arduino Ide
4.target AVR controller

Prepare for burning arduino bootloader for target AVR controller(here iam taking Atmega8).Already i explained how to burn boot loader to avr mc in earlier posts.so you can check with that..

Download AVRDUDESS tool which is user friendly and easy to use.if you are good at CMD you can go with command line utility.
this is how the tool looks

After bootloading the target IC with arduino,you can go with isp type programming or simple method is replace the atmega328 chip on arduino with target bootloaded mc

Now connect the arduino board to the computer, open the tool and select arduino as programmer,COM port,19200 as baud rate,1.5 as bit clock or leave it.after doing all these things click DETECT which is seen in the above tool.if all the things are fine it will detect the target ic i.e atmega8 and the name of that ic is printed in below of the tool.

Finally select your HEX file which is generated using WINAVR IDE.and hit 'GO' then the hex will uploaded to your target within secs. remove the programmed controller from the arduino and use for your desired application.

NOTE: This tutorial is mainly useful for advanced or intermediate users,but note for beginners coz it is little bit confusing...
Any doubts regrading this ping me..thank u

Wednesday, 16 September 2015

Voice controlled smart home

Heyyyy all..!! again iam back with new prototype of thing which is "VOICE CONTROLLEd SMART HOME"in this post you are going to learn complete detailed description of Bluetooth module (HC-05) and also some micelinious already explained in earlier posts

Things that you need are:
 *Arduino board
*HC-05 Bluetooth module
*Relays ( as many as home appliances)

So our main aim is  to interface the Bluetooth module to our deserved one i.e ARDUINO
Here I made my own ARDUINO with atmega328p as heart also I programmed this board using another ARDUINO board which has onchip ftdi converter(USB compatible)
I hope you will understand this becoz I have given a clear theory about making ARDUINO'S

Interfacing of Bluetooth module with ARDUINO is very easy. Hc-05 module as total 6 terminals so out of six we are using only 3 terminals they are VCC,GND, and TX.remember there is no need of using RX pin of module because we are not receiving any data from ARDUINO. So VCC is connected to 3.3v since its operating voltage is 3.3v.if you don't have 3.3v supply simply connect it to 5v.now GND is GND of ARDUINO
Important thing is TX of module should be connected to RX of the controller

Now it's time to connect output devices confused?? Here my output devices are relays because they are hleping in the switching operation.if I connect relay directly to the ARDUINO it won't work since relay is a inductive load..I need more current to drive relay so here iam using external supply for that.what about the controlling of relays if I connect them to external supply. The controlling is achieved by relay driver nothing but a transistor.input of the driver is connected to controller,output part is connected to relays and it is powered with some external means..So remaining thing is programming which is very interesting but before entering to programming we have to know the things occurring behind the Bluetooth module

Bluetooth module working
First download the app to your smartphone which is freely available in playstore. After installing the app open and pair your smart phone with the module,at the time of pairing if it asks any password type 0000 or 1234 which is default one.every smart phone contains one Bluetooth module and voie recognization circuit so we are using these two things as exploits to hack our thing. Here I program the controller such that if it receives any string it should acivate the relays.  some commands I used in program are LIGHT ON,LIGHT OFF,FAN ON ,FAN OFF ETC.

Below is the code which is written in ARDUINO ide

String voice;
void setup()
void loop()
  char c=Serial.read();
  if(voice=="*light on")
  else if(voice=="*light off")
  else if(voice=="*fan on")
  else if(voice=="*fan off")

  Here some of pics...


Tuesday, 21 July 2015


Want to make everything wireless..??? Huh.!! Then u r at right place. There are many wireless technologies like ir,DTMF,rf etc of these IR and DTMF are covered in earlier posts. So now its time for radio frequency communication.. Dont be get puzzled
In this post I will direct you how make simple RF remote..
So for making remote,components that you required are
*1.1M ohm resistor
*55k ohm resistor

Now its time to know about encoders and decoders.encoders is a thing which creates some data at transmitter end. Decode is opposite for those encoders it simply decode the data which has been transmitted by encoders..so from this we conclude that encoders should always lies at transmitting section and decoders lie at receiver section



This is how rf MODULES looks

Monday, 20 July 2015


The Analog World

Microcontrollers are capable of detecting binary signals: is the button pressed or not? These are digital signals. When a microcontroller is powered from five volts, it understands zero volts (0V) as a binary 0 and a five volts (5V) as a binary 1. The world however is not so simple and likes to use shades of gray. What if the signal is 2.72V? Is that a zero or a one? We often need to measure signals that vary; these are called analog signals. A 5V analog sensor may output 0.01V or 4.99V or anything inbetween. Luckily, nearly all microcontrollers have a device built into them that allows us to convert these voltages into values that we can use in a program to make a decision.

What is the ADC?

An Analog to Digital Converter (ADC) is a very useful feature that converts an analog voltage on a pin to a digital number. By converting from the analog world to the digital world, we can begin to use electronics to interface to the analog world around us.
alt text
Not every pin on a microcontroller has the ability to do analog to digital conversions. On the Arduino board, these pins have an ‘A’ in front of their label (A0 through A5) to indicate these pins can read analog voltages.
ADCs can vary greatly between microcontroller. The ADC on the Arduino is a 10-bit ADC meaning it has the ability to detect 1,024 (210) discrete analog levels. Some microcontrollers have 8-bit ADCs (28 = 256 discrete levels) and some have 16-bit ADCs (216= 65,535 discrete levels).
The way an ADC works is fairly complex. There are a few different ways to achieve this feat (see Wikipedia for a list), but one of the most common technique uses the analog voltage to charge up an internal capacitor and then measure the time it takes to discharge across an internal resistor. The microcontroller monitors the number of clock cycles that pass before the capacitor is discharged. This number of cycles is the number that is returned once the ADC is complete.

Relating ADC Value to Voltage

The ADC reports a ratiometric value. This means that the ADC assumes 5V is 1023 and anything less than 5V will be a ratio between 5V and 1023.
alt text
Analog to digital conversions are dependant on the system voltage. Because we predominantly use the 10-bit ADC of the Arduino on a 5V system, we can simplify this equation slightly:
alt text
If your system is 3.3V, you simply change 5V out with 3.3V in the equation. If your system is 3.3V and your ADC is reporting 512, what is the voltage measured? It is approximately 1.65V.
If the analog voltage is 2.12V what will the ADC report as a value?
alt text
Rearrange things a bit and we get:
alt text
alt text
Ahah! The ADC should report 434.

Arduino ADC Example

To show this in the real world let’s use the Arduino to detect an analog voltage. Use a trimpot, or light sensor, or simple voltage divider to create a voltage. Let’s setup a simple trimpot circuit for this example:
alt text
To start, we need to define the pin as an input. To match the circuit diagram we will use A3:
pinMode(A3, INPUT);
and then do the analog to digital version by using the analogRead() command:
int x = analogRead(A3); //Reads the analog value on pin A3 into x
The value that is returned and stored in x will be a value from 0 to 1023. The Arduino has a10-bit ADC (210 = 1024). We store this value into an int because x is bigger (10 bits) than what a byte can hold (8 bits).
Let’s print this value to watch it as it changes:
Serial.print(“Analog value: “); Serial.println(x);
As we change the analog value, x should also change. For example, if x is reported to be 334, and we’re using the Arduino at 5V, what is the actual voltage? Pull out your digital multimeter and check the actual voltage. It should be approximately 1.63V. 

Number conversation.. ¿¿

When we write numbers, we have ten different digits that we can put in each place (0-9). After that we need to add a new column of digits and we keep going. This is called the decimal system (or base 10). What would happen if instead of using ten digits we used eight, or two, or even sixteen? Well, what happens is instead of a decimal system we would have what's called binary, octal, or hexadecimal systems (base 2, base 8, and base 16). We use subscripts to denote the system we are using: 987610 is decimal (if we don't use a subscript we assume we are using decimal), 76538 is octal, 10102 is binary, and BEEF16 isyummy hexadecimal.
Binary – binary just has 1s and 0s. But much of our world is binary. Light switches are either up or down, your computer is either on or off, our servers are either currently up or down (hopefully up). Because computers are made up of billions of little switches (called transistors), they do calculations in binary. Everything in your computer is either on or off. And so we represent larger numbers in 1s and 0s. Each 1 or 0 is called a bit, and 8 bits is a byte.
Octal – at some point we end up with a lot of 1s and 0s and they are kind of hard to read. For example "010101000110100001100101" and that’s just to spell "The.”  But if we break that into 3 piece sections with 8 possible digits it becomes 250641458 which is a little easier to read. And thus we have octal.  Unfortunately for octal we rarely use it.
Hexadecimal – What happens if we break that down into 4 piece sections? Well, first of all we run out of digits because now we have 16 possible digits instead of our normal 10. Sothe powers that be just decided to start using letters so hexadecimal has 16 digits (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F). In other words if we wanted to write 1010 we would write A16etc.  Now if we want to write out the word "the" it looks like 54686516 which is a whole lot easier to read.
Decimal ValueHex ValueBinary Value
Conversion – In decimal, the least significant digit (the one on the right) keeps track of 100. The next column is 101, then 102 etc.
So 382 is
(2 x 100)+ (8 x 101) + (3 x 102) = 2 + 80 + 300.
The same is true for other systems.
For example, 1011111102 goes thusly:
(0 x 20) + (1 x 21) + (1 x 22) + (1 x 23) + (1 x 24) + (1 x 25) + (1 x 26) + (0 x 27) + (1 x 28) =
0 + 2 + 4 + 8 + 16 + 32 + 64 + 0 + 256 = 38210
Now you try (highlight for answers):
D x 160 = 13 x 1 = 13
E x 161 = 14 x 16 =224
E x 162 = 14 x 256 =3584
B x 163 = 11 x 4096 =45056
Add that up and you get: 4887710
And remember just because things have bytes does NOT mean you should bite them. None of our products should be ingested or inserted under the skin.

Sunday, 21 June 2015

Alcohol sensor (MQ3) interfacing..¡¡¡

Heyyy..now am here to explain the "interfacing of alcohol sensor to popular ARDUINO. It's very easy.
Alcohol sensor simply mq3 sensor is analog sensor which outputs the voltage.o/p of the sensor is fed to analog pin of ARDUINO..
Here Is the pic how the sensor looks
It contains six pins so we to work for sometime to make this six pins as three pins i.e VCC,GND,Vout.below fig shows how to connect this sensor To ARDUINO board

Now we have 3 pins for the sensor,connect VCC to 5V,GND to GND pin of ARDUINO and data to any analog pin of arduino
Just dump the below Sketch to ur board and observe the output of the sensor in serial moniter

Here is the code
void setup() {
  // initialize serial communication at 9600 bits per second:

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (5.0 / 1023.0);
  // print out the value you read:

So final conclusion is that we can this sensor for breath analyzer ,automatic ignition off in cars etc..i hope u understand.
Thank you 

If u have any queries ping me at facebook.com/winrap57