Friday, 16 October 2015

How to upload the Bootloader Hex into the Atmega328p (Arduino Uno)

NSK Electronics have developed AVR 28 Pin Board which is useful in uploading the Bootloader Hex (Bootloader Hex for Arduino Uno is available in my previous post) into the Atmega328p (Arduino Uno). For buying the "AVR 28 Pin Board" visit: http://www.nskelectronics.com/avr-28p_brd_.html.     
The following diagram shows the image of the NSK Electronic's AVR 28 Pin Board:
  
With this board you can develop and prototype with any of Atmel's 28 pin AVR microcontrollers also. The board has User button and status LED. The bridge rectifier allows this board to be powered with both AC and DC power supply adapters.

The following diagram shows the circuit diagram of the above board:


http://www.nskelectronics.com/files/avr-p28-sch.gif 
The above board is to be used as a target board in which your new Atmega328p-PU, IC meant for Arduino Uno is to be inserted for the purpose of uploading the bootloader into the chip. Now you require one more board called "AVRDUDE" The same board is available with Extremelectronics at http://store.extremeelectronics.co.in/images/D/USBAVRProg21Main.jpg You can buy that board and use that to connect with NSK Electronic's AVR 28 Pin Board through 10 Pin FRC cum Ribbon wires. Then you have to download the driver software also for the AVRDUDE board bought from Extremelectronics.  


The SinaProg is a Hex downloader application software with AVR Dude and Fuse Bit Calculator. This is used to download code/program and to set fuse bits of all AVR based microcontrollers. The same Hex downloader software can be downloaded from http://www.ablab.in/?wpdmdl=9018
After downloading the software, do the following:

1) Install the SinaProg Hex downloader software in your computer.
2) Install the driver for the AVRDUDE board in your computer.
3) Connect the AVRDUDE board with AVR 28 Pin Board through 10 Pin FRC.
4) Insert the Atmega328p-PU chip into the AVR 28 Pin Board.
5) Copy the Arduino Uno bootloader Hex from my previous post and save as a notepad file or text file.
6) Open the SinaProg Hex downloader software and select the chip as Atmega328p.
7) Browse for Arduino Uno bootloader Hex.
8) Set the correct Fuse bits for 16MHz operation of Atmega328p-PU. Caution: don't disturb lock bits.
9) Press the Program button in the SinaProg. The bootloader hex will be loaded into the new chip.   
10) If you have any doubt please call me at +919842992780.           

Friday, 12 June 2015

BOOTLOADER HEX FILE FOR ARDUINO UNO

BOOTLOADER HEX FILE FOR ARDUINO UNO

I have given here the Bootloader Hex File for Arduino Uno R3 board. If the original hex file is corrupted at any time then you can use this file.

Hex:  

:107E0000112485E08093810082E08093C00088E1A6
:107E10008093C10086E08093C20080E18093C4001B
:107E200084B714BE81FFD0D08DE0C8D0259A86E0FB
:107E300020E33CEF91E0309385002093840096BBD3
:107E4000B09BFECF1D9AA8958150A9F7DD24D3944D
:107E5000A5E0EA2EF1E1FF2EA4D0813421F481E0E7
:107E6000BED083E024C0823411F484E103C08534A1
:107E700019F485E0B4D08AC08535A1F492D0082FDA
:107E800010E010930102009300028BD090E0982F35
:107E90008827802B912B880F991F90930102809344
:107EA000000273C0863529F484E099D080E071D057
:107EB0006DC0843609F043C07CD0E0910002F0919F
:107EC000010283E080935700E895C0E0D1E069D0DB
:107ED0008993809102028150809302028823B9F72E
:107EE00078D007B600FCFDCF40910002509101020E
:107EF000A0E0B1E02C9130E011968C91119790E0C8
:107F0000982F8827822B932B1296FA010C01D0927E
:107F10005700E89511244E5F5F4FF1E0A038BF078E
:107F200049F7E0910002F0910102E0925700E895D4
:107F300007B600FCFDCFF0925700E89527C08437C4
:107F4000B9F437D046D0E0910002F09101023196A9
:107F5000F0930102E09300023197E4918E2F19D043
:107F600080910202815080930202882361F70EC043
:107F7000853739F42ED08EE10CD085E90AD08FE018
:107F800096CF813511F488E019D023D080E101D05B
:107F900063CF982F8091C00085FFFCCF9093C600DF
:107FA0000895A8958091C00087FFFCCF8091C600FE
:107FB0000895F7DFF6DF80930202F3CFE0E6F0E00A
:107FC00098E190838083089580E0F8DFEE27FF2713
:107FD0000994E7DF803209F0F7DF84E1DACF1F93FD
:0E7FE000182FDFDF1150E9F7F4DF1F9108952D
:0400000300007E007B
:00000001FF

The above dumped hex can be copied into a text file and loaded that file into your new Atmega328P chip. To load the hex into your chip, there lot of methods are being used by the people. You can refer that in the web. In the next post, i will describe the complete way to load bootloader into the Atmega328P.    

A simple and minimal Atmega328P Target Board

A simple and minimal Atmega328P Target Board

The following circuit will definitely be helpful for any electronic hobbyists who seek a simple circuit useful for small small embedded applications such as domestic timers, PIR base lights on/off circuits, remote switches, burglary alarms, measuring instruments such as voltmeters, ammeters, LED Displays etc... The circuit is designed with minimum components so that the cost of fabrication of PCBs will be less and also for assembling the circuit, the expenditure will be less.  


  

Thursday, 11 June 2015

HOW TO USE TILT SENSOR WITH ARDUINO UNO

HOW TO USE TILT SENSOR WITH ARDUINO UNO

In this example, let us see how a tilt sensor can be interfaced with an Arduino Uno. Through this article you can imagine some applications where you can use these type of sensors. Through this tilt sensor, you can sense a tilt by means of any movement of normal and abnormal in nature.

What is a tilt Sensor?
Tilt Sensor allow you to detect orientation or inclination. They are small, inexpensive, low-power and easy-to-use. If used properly, they will not wear out. Their simplicity makes them popular for toys, gadgets and appliances. Sometimes they are refered to as " mercury switches", "tilt switches" or "rolling ball sensors" for obvious reasons. 

In construction, they are usually made by a cavity of some sort(Cylindrical is popular, although not always) and a conductive free mass inside, such as a blob of mercury or rolling ball. One end of the cavity has two conductive elements (Poles). When the sensor is oriented so that the end is downwards, the mass rolls onto the poles and shorts them, acting as a switch throw.

The diagram shows such sensor.


The following wiring diagram shows the Tilt sensor to be connected to the Arduino Uno.


The following diagram also shows the 3D view of connections of Arduino Uno with Tilt sensor at Pin no.2 and Led at Pin no.3

 
  
                    The following shows the Arduino sketch. Load the sketch into the Arduino IDE and run it, now shake the tilt sensor, the led connected to the Pin no.3 will become on and off depending upon your tilt.

int SensorPin = 2;
int LEDPin = 3;
int LEDstate = HIGH;
int reading;
int previous = LOW;
long time = 0;
long debounce = 50;


void setup()
{
pinMode(SensorPin, INPUT);
digitalWrite(SensorPin, HIGH);
pinMode(LEDPin, OUTPUT);
}

void loop()
{
int switchstate;
reading = digitalRead(SensorPin);
if (reading != previous)
{
time = millis();

if ((millis() - time) > debounce)
{
switchstate = reading;
if (switchstate == HIGH)
LEDstate = LOW;
else
LEDstate = HIGH;
}
digitalWrite(LEDPin, LEDstate);
previous = reading;
}

After loading the above sketch, incline the tilt sensor and the LED connected on pin 3 will turn on. If you have any problem please send feedback.


Monday, 22 September 2014

Reading a Push-Button with Arduino Uno

                   This example will explain you how to interface a Push Button(Push to ON switch) with Arduino UNO. The Push Button is connected to the Pin No.7 of Arduino and a LED is connected to the Pin No.13 of Arduino as shown in the Schematic below. A 1K ohm resistor is being used along with Push Button for connecting it to Pin no.7, this is to normally pull down the Pin No.7 to ground when the pin is not read otherwise the pin will foat sometimes and lead to wrong reading by Arduino.

                     Another 220 ohm resistor is also being used with LED, this is to limit the current to the LED approximately to 23mA (5V/220 ohm = 23 mA). After wiring the complete schematic, write the code shown below into the Arduino IDE and build it. Now, if you press the Push Button, immediately the LED becomes ON, if you leave the Push Button, immediately the LED becomes OFF.

Code 1:

// Reading a Push Button through Arduino UNO.
int ledPin = 13;                        // Pin for the LED
int inputPin = 7;                       // Pin for Push Button
int val = 0;                               // variable for reading the pin status

void setup()
{
pinMode(ledPin, OUTPUT); // configure ledPin as output
pinMode(inputPin, INPUT);  // configure inputPin as input
}

void loop()
{
val = digitalRead(inputPin);       // read input value
if (val == HIGH) // check if the input is HIGH (button released)
{
digitalWrite(ledPin, HIGH);       // turn LED ON
}
else
{
digitalWrite(ledPin, LOW);       // turn LED OFF
}
}

Same above code can be simply modified as for blinking of LED when the Push Butt
on is pressed totally OFF the LED when the Push Button is released from pressing.

Code 2:

// Reading a Push Button through Arduino UNO.
int ledPin = 13;                        // Pin for the LED
int inputPin = 7;                       // Pin for Push Button
int val = 0;                                // variable for reading the pin status

void setup()
{
pinMode(ledPin, OUTPUT);   // configure ledPin as output
pinMode(inputPin, INPUT);   // configure inputPin as input
}

void loop()
{
val = digitalRead(inputPin);   // read input value
if (val == HIGH) // check if the input is HIGH (button released)
{
digitalWrite(ledPin, HIGH);   // Blinking of LED starts here
delay(100);                              // set the delay of 100 milli Seconds for blinking
digitalWrite(ledPin, LOW);
delay(100);
}
else
{
digitalWrite(ledPin, LOW);  // turn LED OFF
}
}

Tuesday, 9 September 2014

Blinking a LED

Blinking a LED

            This example will explain you how to make a LED to blink continuously with a set time delay. The digital out put pin being used in the following circuit is 13 of Arduino Uno. Any LED should not be directly connected to the digital output of Arduino. You have to control the current to the LED. In this schematic a resistor of 220 ohm, 1/4 w is used to limit the current to 23 mA (5V/220 ohm = 23 mA). Anode of the LED is to be connected to Pin 13 of Arduino through a 220 ohm resistor. Cathode of the LED is to be connected to the ground. Both +5V and Ground terminals are available in the Arduino Board itself. After making the following wiring, write code in the Arduino IDE.

      

Code 1:
/*
  Blink
  LED connected to the pin of Arduino is made ON and OFF for one second each alternatively.
This is repeated for ever. 
 */

int led = 13;

void setup()
{                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
}

void loop()
{
  digitalWrite(led, HIGH);   // turn ON the LED (HIGH  = 1 level)
  delay(1000);                    // wait for a second (i.e. 1000 mS)
  digitalWrite(led, LOW);   // turn OFF the LED (LOW = 0 level)
  delay(1000);                      // wait for a second  (i.e. 1000 mS)
}

compile the above code with the Arduino IDE you can see the magic in the LED burning. If you want to make LED to blink fast, the milli second delay can be reduced and checked. If you want to experiment another circuit mentioned below, you can do so.


       By making the above circuit, you can have the circuit as decorative lamps running. For making the above circuit, either you can use same colour LEDs or different colour LEDs. For the above circuit, you can use the following code.

Code 2:
/*
  Blink3Led
  LED connected to the pins of Arduino are made ON and OFF one by one with a delay of one second. 
This repeated for ever. 

 */

int led1 = 11;
int led2 = 12;
int led3 = 13;

void setup()
{                
  // initialize the digital pins as outputs.
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);     
}

void loop()
{
  digitalWrite(led1, HIGH);   // turn ON the LED1 (HIGH  = 1 level)
  digitalWrite(led2, LOW);   // turn OFF the LED2(LOW = 0 level)
  digitalWrite(led3, LOW);   // turn OFF the LED3 (LOW = 0 level)
  delay(1000);                      // wait for a second  (i.e. 1000 mS)
  digitalWrite(led1, LOW);   // turn OFF the LED1(LOW = 0 level)
  digitalWrite(led2, HIGH);   // turn ON the LED2 (HIGH  = 1 level)
  digitalWrite(led3, LOW);   // turn OFF the LED3 (LOW = 0 level)
  delay(1000);                      // wait for a second  (i.e. 1000 mS)
  digitalWrite(led1, LOW);   // turn OFF the LED1(LOW = 0 level)
  digitalWrite(led2, LOW);   // turn OFF the LED2(LOW = 0 level)
  digitalWrite(led3, HIGH);   // turn ON the LED3 (HIGH  = 1 level)
  delay(1000);                      // wait for a second (i.e. 1000 mS)
}

 While experimenting the above, you can learn some thing in the field of micro-controller programming and hardware. If you really enjoyed my posts. Please comment, that will encourage me to post many more. You can also comment in both ways!     

      
  
           

Wednesday, 13 August 2014

12 x 16 Characters Display interfacing with Arduino Uno

12 x 16 Characters Display interfacing with Arduino Uno

This example shows how to interface a 2 x 16 Characters LCD Display with an Arduino UNO

Hardware required

·         Arduino Board
·         Potentiometer
·         JHD 162a LCD Display
·    Some of the jumper wires

Circuit
To build this circuit, a JHD 162a 2 x 16 Character LCD Display is wired up with an Arduino Uno as shown in the Schematic and a potentiometer of 2K ohm is also connected with the LCD Display, this is being used to adjust the brightness of theback light in the LCD Display. Then plug your Arduino board into your computer, and enter the code below

Schematic

Code
/*
LiquidCrystal Library - Hello World

Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780/JHD 162a drivers.
 This sketch prints "Hello World!" into the LCD
and shows the time.

  The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
* 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)

 */

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystallcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows:
lcd.begin(16, 2);
  // Print a message to the LCD.
lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
  // print the number of seconds since reset:
lcd.print(millis()/1000);
}