Saturday, 8 August 2015

AVR Embedded Systems Workshop



AVR Embedded Systems Workshop


AVR Embedded Systems Workshop mainly focuses on the students and hobbyists eager to learn about Advanced features of AVR Microcontroller. They will get a chance to expand their knowledge in interfacing LEDs, GPIOs, Potentiometers, LCD Display and their application in real time projects.

The duration of the workshop will be one day with 8 hours hands on practical session. Each person will be provided with the non-takeaway AVR kit for hands on.













1. Introduction to Microcontrollers
   
          This session would deal with the basics of Microcontroller. the focus will be on the AVR series micro controller - ATMega8, which is one of the most powerful and widely used 8 bit micro controller.

2. Introduction to Software and Debugging

          This session would deal with the basics of 'Embedded C', writing your First 'Embedded C' program in AVR studio. Program compilation and Loading compiled C program into the microcontroller.

3. Input and Output (I/O) operations
          
           This session deals with Interfacing LEDs, Switches to the GPIO pins and generating LED pattern using switches.

4. ADC operations 

          This session deals with Interfacing Potentiometer to the ADC input of the AVR micro controller and hands on performing operations like controlling intensity of the LEDs by reading potentiomenter data.

5. Interfacing DC motor

          This session deals with Interfacing DC motor to the AVR microcontroller and hands on performing operations like operating Motor speed and direction control.



Note: The kits provided at the time of the Workshop are non-take away kits (you have to return the kits at the end of the session).

Note: Images for representation purpose only

Location:  Bangalore

For more Information like payment for workshop, mode of payment, Venue, scheduled date

with subject "AVR Embedded Systems Workshop"





Tuesday, 4 November 2014

HC-05 Bluetooth AT commands configuration




We have been using the serial SPP(Serial Port Profile) Bluetooth modules to interface our embedded hardware and robots to Laptop or a smart phone... hear is an example of Bluetooth controlled POV LED display and a smart phone turned into an intelligent robot....




So this HC-05 is very much useful if you want to make some thing cool like this. So it will be helpful if we are aware of the configurations commands to work with the module. 

AT commands:

AT commands stands for attention commands with which we communicate with the module and alter it's performance.

There are TWO modes of working with HC-05 module. To check with the module you will need a serial port on your PC or laptops. But nowadays our PC won't come with an inbuilt RS232 serial interface  so you can use any USB to serial converters like CP2102 or FT232 devices. After connecting the device to the PC we need any serial terminal software in case of  windows7 and 8 like "Teraterm" or "Putty" .But in case of windows XP you got hyper-terminal. 

In my case i got a CP2102 with me. connect Bluetooth to the CP2102 UART pins (RX and TX)

  
 There is one important thing that you need to keep in mind is....
 "your Bluetooth module logic voltage levels" mine is 3.3V but it got tolerance up to 5V so no problem with my device. and my CP2102 is direct TTL and I am not using any MAX232 in this. so make sure of your device before powering it.

 after connecting the Bluetooth to your serial port device like the one in the picture above. 
connect the device to your PC and power it up...now you will see an LED blinking very fast on your Bluetooth module. This is the normal serial data mode.

Now remove the power. Press and hold the mode button and connect the power. Then the LED will start blinking very slowly...which indicate that you Bluetooth is now in "AT command"mode.

open the serial terminal software and select the "COM" number of your serial port module and configure the following                                
baud rate as"38400"
hardware    "none"
parity          "none"
databits       "8"
stop bits      "1"

better enable local echo in your terminal software...

type "AT" and press <enter> switch you will get response "OK" it means your device is working in AT mode successfully..once if you disconnect the power then the you Bluetooth will be back to serial data mode.

NOTE: in AT mode the baud rate will be 38400. but in serial data mode many baud rate values can be  used.

few of the useful AT commands:

AT    <enter>   it gives the response OK continuously so press <enter> again to stop

AT+NAME?  <enter> it displays the name of Bluetooth module

AT+NAME=new_name  <enter> changes module name to "new_name"

AT+PSWD?  <enter> displays password to enter while pairing with this device

AT+PSWD=4321 <enter> changes the password to 4321
( only 4 digit number is accepted as password )

for more info regarding AT commands refer to the data sheet.

   





Thursday, 3 July 2014

PIR motion sensor interfacing with microcontroller



Passive InRrared sensors:


This sensor senses the bodies that emitting IR radiation and are in motion. there are several types of PIR sensors are available in the market. most common types are these TWO..


TYPE.1: with one potentiometer                                                                                

  

 This Pot is used to set the time of out put signal  stays at logic high on object detection width. this  sensor's sensitivity can't be altered. It produces a     3.3V "logic high". 











TYPE.2: with two potentiometers  
The device has two variable resistors that you can adjust to tweak the performance of the module.
The first one (left-hand side on the photo) determines the sensitivity of the device. The default setting is usually 50%.
The second control (right-hand side on the photo and usually marked “time” on the PCB) allows you to adjust the amount of time the output pin stays at 3.3V (high) when it is triggered by movement. This can be set from a few seconds to 200 seconds. The default setting is usually a few seconds.
    WORKING:
But the operation of the both sensors is same. This PIR sensor doesn't respond for the stationary objects. Instead it senses the IR bodies in motions(hot materials and living objects). This sensor accepts DC voltage of 5V. 

NOTE:

Most of the time pin configuration will be printed on the sensor . But some sensors available with in in India are not describing pin configurations properly. But the standard notation of pin will be like all ways middle pin will be output. so if you identify the GROUND then remaining pin will be VCC.
It is very simple. Most of these sensors are made of using BISS0001(16 pin DIL package). 7th pin of this IC is GND. So take a multimeter and  check for short circuit test and beep sound. then it will be your sensor ground and opposite side pin will be VCC


As the sensor provides 3.3V signal it may be little difficult to interface with microcontrollers working at Vcc=5V(most 8 bit hobby controllers like AT89S51). At the same time it will be easy to interface with low powered microcontrollers like LPC2148. You better check your microcontroller Logic voltage levels.


Actually i interfaced this sensor to ATmega8 MCU which can detect even 3.3 volt logical signal. So i successfully connected this PIR sensor to the ATmega8 microcontroller.

Basic Program 

#include<avr/io.h>
void main()
{
  DDRC=0xfe; //configuring PortC pin 0 as input
 PORTC=0xff; //enabling internal pull-up resistors
DDRB=0xff;    // configuring PortB as output
PORTB=0x00; // buzzer off

while(1)
{
  if((PINC & 0x01)==0x01) // check for sensor pin PC.0 using bit       {                                            //masking (if sensor detects motion ) 
   PORTB=0xff;                   // buzzer on
   }
  else
  PORTB=0x00;                   // buzzer off
}

}
   

Tuesday, 13 May 2014

Bluetooth controlled robot using ARDUINO

This article helps you to make a robot that can be controlled from your android powered mobile through Bluetooth.



 HC-05:

This Bluetooth module works on SPP (serial port profile). It establishes a serial communication(UART) between your android mobile and microcontroller.

This module works in two modes:
1) AT mode
2)COM mode

AT mode:

In AT mode you can directly connect the module to your computer hyper terminal or any other serial gate way through DB9 serial port through MAX232 circuit (or you can use any USB to UART gateways like FT232and configure through AT commands. set the baud rate "38400"
some example commands:

AT    <enter>   it gives the response OK continuously so press <enter> again to stop

AT+NAME?  <enter> it displays the name of Bluetooth module

AT+NAME=new_name  <enter> changes module name to "new_name"

AT+PSWD?  <enter> displays password to enter while pairing with this device

AT+PSWD=4321 changes the password to 4321 ( only 4 digit number is accepted as password )

for more info regarding AT commands refer to the data sheet.

COM mode:
this is the mode that to be set when interfacing with a microcontroller through UART.

In this project i'm using an Arduino MEGA 2560 and a Bluetooth shield from Robogenesis

To drive the DC motors i'm using L293D.

CIRCUIT DIAGRAM:



arduino code:

//---------------------------------------------------
//--------------- code starts-------------------------
//---------------------------------------------------
unsigned char blue_data;
void setup()
{
  Serial.begin(9600);// set up serial communications with 9600 baud rate

  pinMode(7, OUTPUT);//motor 1a
  pinMode(6, OUTPUT);//motor 1b
  pinMode(5, OUTPUT);//motor 2a
  pinMode(4, OUTPUT);//motor 2b
digitalWrite(7,LOW);
digitalWrite(6,LOW);
digitalWrite(5,LOW);
digitalWrite(4,LOW);
}

void loop()
{
   if (Serial.available() > 0)
  {
    blue_data = Serial.read();// get incoming byte from bluetooth
          if(blue_data=='F' )//forword
           {
            digitalWrite(7,HIGH);digitalWrite(6,LOW);digitalWrite(5,HIGH);digitalWrite(4,LOW);
           }
  else if(blue_data=='B' )//backword
           {
            digitalWrite(7,LOW);digitalWrite(6,HIGH);digitalWrite(5,LOW);digitalWrite(4,HIGH);
           }
  else  if(blue_data=='L' )//left turn
           {
            digitalWrite(7,LOW);digitalWrite(6,HIGH);digitalWrite(5,HIGH);digitalWrite(4,LOW);
           }
  else  if(blue_data=='R' )// right turn
           {
            digitalWrite(7,HIGH);digitalWrite(6,LOW);digitalWrite(5,LOW);digitalWrite(4,HIGH);
           }
   else if(blue_data=='S' )// stop
           {
             digitalWrite(7,LOW);digitalWrite(6,LOW);digitalWrite(5,LOW);digitalWrite(4,LOW);
           }
   
  }

}

android app:

Description
****This application is designed to be used with a MODIFIED RC car. You have to replace the car's stock control circuit with a micro controller. This involves programming. The application will not work with a brand new, out of the box RC car. Please visit the website before you download the application.
The application allows you to control an Arduino based RC car over Bluetooth. This is done using a Bluetooth enabled Android phone. Visit this sitehttps://sites.google.com/site/bluetoothrccar/ for the Arduino code and control circuit. The app lets you control the car with either buttons or the phone's accelerometer. A slider bar allows you to control your car's velocity if the car's control circuit has this feature. There are also two buttons for front and back lights. A flashing light lets you know when the phone is connected to the car, and arrows light up letting you know the car's driving direction.



WORKING VIDEO


Wednesday, 26 February 2014

ZIGBEE (Tarang F4) interfacing with microcontroller

When there is a need of long range two way communications in hobby electronics most of the people prefer "ZIGbee" modules. there are several zigbee modules available in the market...with several ranges and qualities..

Tarang F4 is also a similar module.....

So let's see how to use these modules for normal full duplex serial communication with UART:

  1.  This module can be easily interfaced with  any 8 bit microcontroller with all standard baud-rates between 1200 to 115200.   
  2. Each module consists of a 16 bit address. So user must provide a source address and destination address while configuring the module. which means only the destination module with matched address can only receive the data.
  3. User can select the RF channels among 16 channels with addresses from 0x00 to 0x0F. The modules must be in same channel to establish the communication between them. 


 lets check the pin configuration of this module.

Tarang module works on 3.3v  power supply. so sufficient voltage regulator must be used.

WORKING PROCESS:

By default the tarang F4 module: works at baud-rate of : 9600
                      source address : 0x1000   (hexadecimal)     
destination address : 0x1000            
RF channel : 0x00     
it means :

"by default any tarang F4 module can communicate with any other module".

 So tarang modules can be directly interfaced with microcontroller with baudrate of 9600. The connection circuit will be as follows.

NOTE: if your microcontroller is working at 3.3V then you can directly interface it to the microcontroller. if your microcontroller is working at 5V connect a resistor of 100ohms between TXD pin of MCU and Din pin of Tarang F4.

CONFIGURING THE MODULE:

For configuring the tarang F4 module first connect the module to PC serial Port. Now a days our laptops are not designed with serial ports directly. So we have to go for USB to Serial converters Like FT232, CP2102 or  Prolific connectors.

  1. Connect the module to PC using any above serial interface.
  2. open "hyper terminal"(in xp) or use any similar software in case of  Windows7 or 8 like "Tera Term".
  3. connect to the selected "COM" port and select local echo option select baudrate of 9600,databits 8, hardware : none.
  4. Device must be set to command mode by entering three '+' symbols "+++"  with in one second. and Do not press enter.
  5. you will get a response from module "OK".
  6. Enter the correspond AT commands as per your requirement and press enter. Follow the command as per the data sheet. Some of the useful basic commands are listed below.
  7. After entering the settings the settings must be stored in the memory. "ATGRD" is the command used to store the settings. If this is not used the current settings will be lost.
  8. to exit the command mode "ATGEX" is used. it gives "EXIT" as response.  

SOME TARANG F4 BASIC AT-COMMANDS 

  1. "ATGEX" : exit form command mode ; response: "EXIT"
  2. "ATGRD": set module to default settings(channel(00)baud(9600),address(1000));response:"OK"
  3. "ATGWR":stores current settings; response : "OK"
  4. "ATNCH": sets/read channel number: response:"00" to "0F" (total 16 supporting channels)
  5. "ATNMY":set/read source address: response:"1000"(16 bit hexadecimal number)
  6. "ATNDA":set/read destination address: response:"1000"(16 bit hexadecimal number)
  7. "ATSBD": set/read baudrate: response: "00" to "07". 
00=>1200
01=>2400
02=>4800
03=>9600
  04=>19200
  05=>38400
  06=>57600
    07=>115200

Wednesday, 16 October 2013

ARDUINO based Quadruped robot using 2 servos

I all ways wanted to make a quadruped robot. And finally got a chance to make one. So i wanted to simplify the design with least possible hardware.

working video



I checked in the market to get good servos and found these VS-2 servos. These servos provide up to
 3Kg-cm torque.

To control the servos i wanted to use ARDUINO. I got Arduino mega with me. But that board is little heavy and my robot cant bare it. So tried for arduino uno or nano. I'm not able to find one in the Indian market and the cost is going beyond the budget. So i thought of making my own Arduino. 


 This board consists of an ATmega8 microcontroller working at 16Mhz and almost all the pins are exposed in this board and each and every pin is associated with  supply and ground pins.

 To load the arduino sketch into this board i made a sketch loader for it. In traditional Arduino boards FTDT chips(FT232) are  used. It is a USB  to serial devise. I googled about and found a similar chip which is a little cheaper in my local market called CP2102 from silicon lcbs.



MECHANICAL ARRANGEMENT












 







CIRCUIT DIAGRAM:

In this circuit diagram i didn't showed the Power supply for Arduino. if you are using any standard Arduino you have to use a separate 9v supply for your Arduino board. In this project i used an ATmega8L microcontroller(operates from 3.3V to 5V) with Arduino boot-loader. So i used a common power supply for both Board and Motors.
NOTE: if you are using a common supply the circuit may get reset continuously due to more load of motors. To overcome this problem i used 2x1000uF capacitors accross Vcc and Gnd 

ARDUINO CODE :


#include <Servo.h>

Servo mot1;
Servo mot2;


void setup( )
{
  mot1.attach(9); // servo one to  digital pin 9 of arduino
  mot2.attach(10);// servo two to digital pin  10 of arduino

}
void loop( )
{
   mot1.write(60);
    mot2.write(120);

   delay(300);
 
   mot1.write(120);
    mot2.write(60);

   delay(300);


}



Sunday, 13 October 2013

Analog 3-Axis Accelerometer interfacing with ATmega8 board

Every body is having a smart phone. The vary first game that you will look for is "TEMPLE RUN".
This game became favorite of many.

In the above situation how the player bends side?

I know what you will say "we tilt the smart phone left".

the question is how your mobile is able to sense the tilt. Here comes the concept of a small devise called

Accelerometer

 what is this thing?????????

It is a Micro Electro Mechanical device. For short MEMS.

How the accelerometer work?
when ever you tilt the accelerometer at any axis the module of the corresponding axis will sense the change in "g"(acceleration due to gravity) and produces a corresponding change in the terms of analog voltage. 

Now we are going to use an accelerometer to control the robot. This technique helps a physically challenged person to control the wheel chair with their hand gesture .
As shown in the above figure this sensor module is available at many models from different vendors. But the basic connection are same for all ADXL335 modules.

Actually this sensor module comes with an internal 3.3V voltage regulator. then you can directly use a 5V supply. otherwise you have to go for 3.3V supply. 

These X Y Z pins are the analog outputs from the sensor. As the device internally works at 3.3V the maximum voltage produced at these pins will be 3.3V

As we know that our microcontroller is digital and it cannot process the analog data directly. We need to convert the analog data into digital. An A/D converter is required for this process.

In this tutorial We are going to use an AVR microcontroller (ATmega8) based platform which is having an in built ADC mechanism in it.

This board was developed by ROBOGENESIS.
The specialty of the board is "NO EXTERNAL PROGRAMMER IS REQUIRED" .
It can be programmed through USB port.
comes along with a special library so any one can program the board.
Also compatible with ARDUINO programming.
For more info about This board mail us at : vaabrobotics@gmail.com
This board comes with a CD that include the necessary libraries for all the modules compatible with this microcontroller hardware.

So in this project we are going to use "adc.h" header file
which helps in using the ADC port of this board.

to check the ADC values at the respective levels we are going to interface an LCD too..
this will help us in calibrating the ADC data from the accelerometer.
to support the LCD port the "lcd.h" header file can be used.

connect the sensor X,Y,Z axis outputs to the ADC0, ADC1, ADC2 channels respectively

CODE FOR ATmega8 INTERFACING WITH ADXL335
#include<avr/io.h>                    //  I/O port definitions 
#define F_CPU 12000000UL  // frequency of the board
#include<util/delay.h>              // headder file for delay functions
#include"lcd.h"                        // LCD headder file
#include"adc.h"                       // ADC headder file
void main()
 lcd_init();   // initializing LCD
 adc_init();   // initializing ADC
 lcd_string("working"); // displays "working" on first row of LCD
 _delay_ms(1200);      // delay of 1.2seconds
 lcd_clear();               // LCD display cleared
lcd_cursor(0,0);         // setting cursor to row 0 column 0 position
 lcd_string("  X    Y    Z    "); // display on row 0
 unsigned char x,y,z; // variables
 while(1)
 {
  x=getdata(0x00);  //reading data from ADC0 storing in variable x
  y=getdata(0x01);  //reading data from ADC1 storing in variable y
  z=getdata(0x02);  //reading data from ADC2 storing in variable z
  
  lcd_cursor(1,0);  // setting cursor to row 1 colums 0 position
  lcd_num(x);       //displays the value of x
  lcd_cursor(1,5);  // setting cursor to row 1 colums 5 position
  lcd_num(y);        //displays the value of y
  lcd_cursor(1,10);// setting cursor to row 1 colums 10 position
  lcd_num(z);        //displays the value of z
 }
}

NOTE:ALL THE HEADER FILES ARE PROVIDED ALONG WITH THIS BOARD.....