Sunday, 7 June 2020

Programming AVR micro controller using Atmel Studio 7

In this blog, we will learn how to upload hex file using Atmel Studio. Atmel Studio is used for programming ATtiny, ATmega and AVR32 mirocontrollers. You can download atmel studio from:


Open Atmel Sudio from windows start menu:

File > New Project >  GCC C executable project

New Project


In device selection, choose Atmega8a

In main.c write down the following program for toggling PORTD

#define F_CPU 8000000
#include<avr/io.h>
#include<util/delay.h>

int main(void)
{
DDRD = 0xff;  // set portd as output
    while (1) 
    {
PORTD = ~PORTD; // toggle PORTD bits
_delay_ms(500); // delay of 500 ms
    }
}

Code Snippet

Follow the steps as mentioned above n the screenshot. 

Once the code is successfully compiled, we are ready for the next step i.e. uploading the program to the target board.

Go to: Tools > External Tools > 

External Tools


In arguments type this:
avrdude -c usbasp -p atmega8 -U flash:w:$(ProjectDir)Debug\$(TargetName).hex:i
since we are using atmega8.

Provide the path of avrdude in command. You can input USBasp in Title

Make connections as follows:

USBasp programmer                                                Atmega 8 target board

Vcc       ===========================>      Pin 7,20,21 
GND     ===========================>      Pin 8,22 
MOSI    ===========================>      Pin 11 
MISO    ===========================>      Pin 12 
SCK      ===========================>      Pin 13 
RST       ===========================>      Pin 1 

Now click on: Tools > USBasp

And voila your mcu is flashed!! 





Friday, 5 April 2019

Morris Garage car event at JW Marriott, Delhi

MG Hector SUV is soon going to be launched in India market. It's truly internet of cars
MG Technology Partners:

The name 'Hector' draws inspiration from the noble qualities of the Trojan warrior hero – Prince Hector of Troy. It pays homage to great British engineering tradition, as a nod to the Royal Hector biplane, used by the Royal Air Force in the 1930s.


‘Hector’ stands for everything Strong, Bold, Trustworthy and Dependable.

Airtel, Microsoft, CISCO, Abode, AccuWeather, Nuance, Cognizant, Gaana, Panasonic, iSmart, Tomtom, SAP, Unlimit


MG Hector JW Marriott


Monday, 7 May 2018

Arduino python GUI led control

Hello Friends,

In this project, we are interfacing arduino with python. Arduino can be easily interfaced with python using serial communication (uart) via pyserial library. For GUI on python, we are using tkinter.

Let's start with the python script:
Libraries required: pyserial

It can  be esaily installed by: pip install pyserial


Monday, 30 April 2018

How to load hex file into AT89S52

In this post, we will learn how to upload hex file into AT89S52. It's a bit difficult to upload hex file into AT89S52 unlike atmega controllers which use AVRdudes for uploading hex file.

AT89S52 ia 40-pin IC and it has 40 GPIO pins and there are 4 ports viz, PORT 0, 1, 2 and 3. Each port has 8 pins. Total GPIO pins are: 8(pins in each port) * 4 (total number of ports) = 32 gpio pins
PORT0 is pull-up rest of the ports have internal pull-up resistor.

In order to eliminate tri-state condition in 8051 we can use network resistor of 10k (A103J)
It have peripherals like: Timer/ Counters, UART, GPIO programming, interrupt programming, etc. It don't have built-in ADC, SPI, I2C and there is no option of  internal RC oscillator.

It's Machine Cycle (MC) is calculated by: 12/ 11.0592 MHz = 1.085 us

Hardware required:
  • USBasp Programmer
  • AT89S52 development board (either on strip board or bread board)
Software required:
  • Progisp (for dumping hex file)
  • Keil uVision (8051 IDE for programming)

Thursday, 1 March 2018

Connecting Raspberry Pi to visible/ hidden SSID

Hello Folks,

In this tutorial, we will learn how to connect Raspberry Pi using command line.
First of all, open terminal
and type the command:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

This will open nano text editor with wpa_supplicant.conf file. Now, we have to add some statement for connecting it to WiFi

At the end of the file, add these statements:

Wednesday, 7 February 2018

Arduino and processing based GUI person counter

In this post, we will make arduino and processing based GUI person counter. For person counter, we are using infrared sensor (IR). It's output is digital and is fed to pin number 7 of arduino.

The connections are as follows:
Connection of arduino with proximity sensor




Interfacing HC-05 with Atmega8

In this post, we will interface bluetooth module (HC-05) with atmega8. Atmega8 is a 28-pin IC and it has three ports viz., PORTB, PORTC and PORTD and it has total 23 gpio pins. It has internal rc oscillator, that is user selectable from  1, 2, 4 or 8 MHz.

We are using 8 Mhz internal rc oscillator.

Compiler Used: GCC

Connection is as follows:

Atmega8                                     BT module
RX            ============>     TX
TX            ============>     RX
GND         ============>     GND
VCC         ============>     VCC

We are using uart at baud rate 9600. Make sure that BT module and atmega8 both have same baud rate.

Saturday, 12 August 2017

Getting Started with NodeMCU

Hello Friends,

Today we will write first program for NodeMCU3 that is led blinking. NodeMCU3 has esp12e and ch340 (USB-TTL) on-board. It can be connected to PC/ Laptop via USB mini(type B) data cable.

Let's get started.

All we need is NodeMCU3 and arduino IDE.
LED and resistor



Tuesday, 1 August 2017

Step by step installation guide for ch340 USB-UART converter

Hello Friends,

In this tutorial, we will cover how to install ch340 driver for different versions of windows.
CH340 is USB-UART converter and is used for serial communication with PC/ laptop with external device e.g. GSM module, GPS module, arduino pro, etc.

Things required:

CH340 USB-UART

Monday, 3 July 2017

4-Digit Seven Segment TM1637 Display interfacing with arduino

Hello Arduino Lovers,

In this post, I am going to interface 4-digit seven segment display with arduino. It's TM1637 based display and it just requires 4-pins. And it's better than conventional 4-digid SSD since that requires 12 (8+4) output pins. So, it saves our pin. As MCU have limited I/Os it's very useful.

The pins are as follows:

CLK, DIO, VCC and GND. 

It's 2-wire serial communication and it's different from I2C communication.

Sunday, 11 June 2017

Generating a delay of 1s using timer in atmega8

Hello Friends,

In this tutorial, we will learn how to generate a delay of 1second using timer0 in atmega8.

We are writing the code in Avr studio 4.

Timer 0 is a 8-bit timer means we can feed any value from 0 (0x00) to 255 (0xff)

Timing Diagram
In this example, we are using prescaler of value8. Prescaler divides the base frequency (provided by crystal or internal rc oscillator).

Machine Cycle = 1/Fosc      (Fosc is 8 MHz)

M.C = 1/8 us or 0.125 us

Delay = (256-x) * 0.125 * Pre scaler  (Pre scaler = 8)

Friday, 24 March 2017

Matlab with Arduino - Part 1

In this post, we are going to install arduino library in matlab.
There are two options available:
Online and Offline support package for matlab. We are using offline method for installation of arduino library.


  • Matlab 
  • Matlab account (for downloading support package)
  • Arduino IDE
  • Arduino UNO board
First of all, download the support package zip file from:

Thursday, 16 March 2017

Temperature based fan speed control using arduino uno and lm35

In this post, we will make a temperature based fan control using arduino and lm35. LM35 is temperature sensor, whose output is analog (linear). Arduino uno has six channle of adc (A0-A5)
and adc is of 10-bit

Stuff required:
  • Arduino UNO
  • LM35
  • LCD 16*2
  • POT 10k
  • Motor driver (L293D)
  • DC motor

Sunday, 5 March 2017

Getting Started with Raspberry Pi

Hello Raspberry Pi Lovers,

In this post, we are going to install NOOBS on raspbeery pi.

Stuff required:

  • Raspberry Pi 2/3
  • SD card booted with Raspbian OS
  • Hook-up wire
  • LED with 220ohm resistor
  • 5V/ 1A power supply
  • Monitor with HDMI port (or you can use HDMI to VGA)

Wednesday, 8 February 2017

Temperature logger using arduino and thingspeak

Hello Arduino lovers,

In this tutorial, we are making a temperature logger using arduino and thingspeak.
Let's start

Things required:

  1. Arduino Uno
  2. LM35
  3. Sim900 module
  4. Internet pack 
  5. Thinkspeak account

Thursday, 26 January 2017

Interfacing 20*4 LCD with arduino

Hello Friends,

In this tutorial, we are going to interface 20*4 lcd with arduino uno. As the name suggests it has 4 rows and twenty columns. In total, we can show 80 characters. It has blue backlight. It has 16 pins just like 16*2. The pin configuration of 20*4 lcd is similar to that of 16*2 lcd.

Circuit Diagram:
Connection on proteus

Monday, 9 January 2017

How to burn Arduino bootloader to atmega 328

In this post we will learn, how to burn hex file in avr microcontroller using programmer and burner software.

List of components/software:

1. USBasp programmer
2. Target circuit board having microcontroller (mine have atmega328)
3. Avrdudes (Burner software)

Prerequisites:
USBasp driver installed in your system.
If it is not installed, then read instructions about installation from my previous post.
USBasp driver installation

Default fuse byte for atmega328 is: LFUSE = 0X62 and HFUSE = 0XD9. It might vary
This corresponds to internal rc oscillator

LFUSE = 0XFF and HFUSE = 0XDE
This corresponds to external oscillator having frequency 16 MHz

Saturday, 31 December 2016

How to update esp8266 firmware

In this post, we are going to upload firmware to ESP8266 (ESP-01) . The firmware can be updated by both arduino as well as usb-ttl module.
ESP-01 is wifi SoC module and it has two GPIO pins i.e. GPIO0 AND GPIO2
For using ESP8266, we can use either AT commands using any terminal software/ esplorer ide (it supports lua programmming and AT commands) or we can use arduino library.
ESP8266 is a 8-pin SoC having two GPIO pins, it requires 3.3 volt and the current consumed by wifi module can't be attained through arduino. Therefore, if we are using arduino we need external 3.3 volt power supply.
Esp8266 wifi module can act as STA as well as AP or both

Monday, 26 December 2016

How to make a simple IR remote tester using TSOP 1838

In this post, we will make a simple IR remote tester. Since infra red rays are invisible to light we can't check it using naked eyes. Therefore, we need some device/ instrument for testing it.

One simple method to check IR remote is by using mobile or digital camera. However, it's not handy.
We will make a simple circuit using TSOP1838

We simply need a Tsop1838, one led (RED 5mm) and a 220 ohm resistor.

Wednesday, 14 December 2016

Arduino knight rider circuit using led bargraph

In this post, we are going to make knight rider circuit using led bargraph. Led graph, it consists of 10 leds.

Stuff required:

  1. Arduino uno
  2. LED bargraph
  3. 220 ohm resistor
  4. connecting wires
Connections:

First of all, make connections as given in the diagram below: