Pages

Thursday, 20 November 2014

3 axis accelerometer-ADXL345



3 Axis Accelerometer – ADXL345:
The 3 Axis Accelerometer- ADXL345 is a small, thin and low power with high resolutions (13bit) measuring at up to +16 g. Digital output data is formatted as 16 bit twos complement and is accessible through either SPI(3- or40-wire) or I2C digital interface.



3 axis accelerometer-ADXL345 Features:

  • Ultralow power: as low as 40 μA in measurement mode and μA in standby mode at VS = 2.5 V (typical)
  • Power consumption scales automatically with bandwidth User-selectable resolution
  • Fixed 10-bit resolution
  • Full resolution, where resolution increases with g range, up to 13-bit resolution at ±16 g maintaining 4 mg/LSB scale factor in all g ranges)
  • Embedded, patent pending FIFO technology minimizes host processor load Tap/double tap detection
  • Activity/inactivity monitoring
  • Free-fall detection
  • Supply voltage range: 2.0 V to 3.6 V
  • I/O voltage range: 1.7 V to VS
  • SPI (3- and 4-wire) and I2C digital interfaces
  • Flexible interrupt modes mappable to either interrupt pin
  • Measurement ranges selectable via serial command
  • Bandwidth selectable via serial command
  • Wide temperature range (−40°C to +85°C)
  • 10,000 g shock survival
  • Pb free/RoHS compliant 
  • High quality PCB FR4 Grade with FPT Certified.
For Sample Codes, Schematics : CLICK HERE

Bluetooth Module HC-06


Bluetooth Module HC-06:

This module enables you to wireless transmit & receive serial data. It is a drop in replacement for wired serial connections allowing transparent two way data communication. You can simply use it for serial port replacement to establish connection between MCU or embedded project and PC for data transfer. This board operates on 5V and has LED indication and 3V regulator.







Bluetooth Interface Arm code: 


/*
 * Project name:
     BLUETOOTH MODULE
 * Copyright
     (c) Researchdesignlab.com
 * Description:
    
 * Test configuration:
     MCU:             LPC2129
     Dev.Board:       LPC2129 mini
     Oscillator:      12 MHz
     Software:        Keil uVision3

*/


#include<stdio.h>
#include"lpc21xx.h"    // header file
#include<string.h>
//*******************************************************************
void SEND_CMD_2_LCD(unsigned char);    // function protoype
void SEND_2_LCD(unsigned char *, unsigned char);
void DISPLAY_ON_LCD(unsigned char DATA);
unsigned char RECIVE_DATA(void);
void TRANSMIT_UART0_BYTE(unsigned char P);
void TRANSMIT_UART0(unsigned char *P);


#define sw4 0x00010000 

void DELAY(void); 
void LCD_DELAY(void);


unsigned int LCD_RS=0X01000000;      // pin declerations
unsigned int LCD_EN=0X02000000;
unsigned int LCD_DATA_LINES=0X00003C00;
unsigned char RX;
                        

//*******************************************************************
int main()
{
    unsigned char LCD_CMD[]={0X20,0X28,0X0f,0X06,0X01,0X80},COUNT,i; // LCD commands


    IODIR0|=LCD_DATA_LINES;
    IODIR1=0X03300000;
      
    for(COUNT=0;COUNT<6;COUNT++)
    SEND_CMD_2_LCD(LCD_CMD[COUNT]); // LCD INIT function call

    PINSEL0    = 0X00050000;
    PINSEL1=0X15400000;       // UART INIT
    U1LCR = 0X83;           // 8bit data setting        
    U1DLL = 0X61;                                   
    U1LCR = 0X03;    // 9600 baud rate setting        
    U1FCR = 0X01;    // FIFO enable

    PINSEL0|=0X00000005;
    U0LCR=0X83;
    U0DLL=0X61;
    U0DLM=0X00;
    U0LCR=0X03;

      DELAY();

      DELAY();
      DELAY();
      
                 
  TRANSMIT_UART0("MC 1");              //TRANSMIT DATA TO BLUE TOOTH
  while(1)
   {
  
   
   RX=RECIVE_DATA();            // RECEIVING BLUE TOOTH DATA DISPLAY ON LCD
   DISPLAY_ON_LCD(RX);
   i++;
  

  }
 }



    void DELAY(void)
    {
    unsigned int X=800000;
    while(X--);
    }
    
    
    void LCD_DELAY(void)
    {
    unsigned int X=20000;  // delay calculation subroutine
    while(X--);
    } 

 void SEND_CMD_2_LCD(unsigned char DATA)
{
    unsigned int TEMP;                      // LCD command write function
    IOCLR0=LCD_DATA_LINES;
    TEMP=DATA;
    TEMP=((TEMP&0xf0)<<6);
    IOCLR1=LCD_RS;
    IOSET0=TEMP;
    IOSET1=LCD_EN;
    LCD_DELAY();
    LCD_DELAY();
    IOCLR1=LCD_EN;
    IOCLR0=LCD_DATA_LINES;
    
    LCD_DELAY();

    TEMP=DATA;
    TEMP=((TEMP&0x0f)<<10);
    IOCLR1=LCD_RS;
    IOSET0=TEMP;
    IOSET1=LCD_EN;
    LCD_DELAY();
    LCD_DELAY();
    IOCLR1=LCD_EN;
    IOCLR0=LCD_DATA_LINES;
}

void DISPLAY_ON_LCD(unsigned char DATA)
{
    unsigned int TEMP;
    IOCLR0=LCD_DATA_LINES;
    TEMP=DATA;                          //LCD data write function
    TEMP=((TEMP&0xf0)<<6);
    IOSET1=LCD_RS;
    IOSET0=TEMP;
    IOSET1=LCD_EN;
    LCD_DELAY();
    LCD_DELAY();
    IOCLR1=LCD_EN;
    IOCLR0=LCD_DATA_LINES;
    
    LCD_DELAY();

    TEMP=DATA;
    TEMP=((TEMP&0x0f)<<10);
    IOSET1=LCD_RS;
    IOSET0=TEMP;
    IOSET1=LCD_EN;
    LCD_DELAY();
    LCD_DELAY();
    IOCLR1=LCD_EN;
    IOCLR0=LCD_DATA_LINES;
}


void SEND_2_LCD(unsigned char *PTR, unsigned char POS)
{
    SEND_CMD_2_LCD(POS);
    while(*PTR)
    {                               // sending the data to LCD data line function
        DISPLAY_ON_LCD(*PTR);
        PTR++;
    }
    LCD_DELAY();
    LCD_DELAY();
}


void TRANSMIT_UART0(unsigned char *P)
   {
    while(*P){
        U0THR=*P;
        while(!(U0LSR&0X20));
        P++;}
    }

        
void TRANSMIT_UART0_BYTE(unsigned char P)
   {

        U0THR=P;
        while(!(U0LSR&0X20));
    
    }

    
  unsigned char RECIVE_DATA(void)
   { 
        while(!(U0LSR&0X01));
        RX=U0RBR;
        return(RX);
   }


Bluetooth Interface atmel schematic:




Bluetooth Interface Atmel Code:


/*
 * Project name:
    BLUETOOTH MODULE
 * Copyright
     (c) Researchdesignlab.com
 * Description:
    
 * Test configuration:
     MCU:             AT89S52
     Dev.Board:       8051
     Oscillator:      11.0592 MHz
     Software:        Keil uVision3

*/


#include<reg51.h>  

#define LCD_PORT P2                    // LCD D0-D7 PINS connected P2
sbit rs=P3^5;                        // LCD RS PIN connected P3.5
sbit en=P3^7;                        // LCD EN PIN connected P3.7
sbit D7=P2^7;
sbit rw=P3^6;                         // LCD RW PIN connected P3.6


void busy();                          //LCD busy 
void CMD_WRT(unsigned char);           //To write the commands to the LCD
void DATA_WRT(unsigned char);         //To write the data to the LCD
void LCD_WRT(unsigned char *); 
void DELAY();
void TRANSMIT(unsigned char *);
void transmit_byte(unsigned char );
unsigned char SCI_ReceiveByte( void );


 void main()
  {
   unsigned char CMD[]={0x38,0x01,0x0f,0x06,0x80},TEMP1,i,RX;

    for(i=0;i<5;i++)
    {
    TEMP1=CMD[i];                         //write the commands to the LCD
    CMD_WRT(TEMP1);
    }

    TMOD=0X20;                              //TIMER 1 , MODE 2
    TH1=0XFD;                              //9600 BAURD RATE            //SERAIL INIT
       SCON=0X50;
    TR1=1;                                  //TIMER1 ON
    DELAY();
    DELAY();
    DELAY();                               //DELAY
    DELAY();

     TRANSMIT("MC 1 ");          // trasmit the data to BLUETOOTH
  while(1)
  {
  
  
   RX=SCI_ReceiveByte();                      // RECIVING DATA from BLUETOOTH AND DISPLAY ON LCD
   DATA_WRT(RX);
      
  }
 }
    
    void DELAY()
    {                                  //delay of 3ms 
    unsigned int X=800000;
    while(X--);
    }
    
    
    void busy()
    {
    D7=1;
    rs=0;                             //cmd mode
    rw=1;                             //read
    while(D7!=0)                    //wait till LCD is ready
    {
    en=0;
    en=1;                            // low to high latch 
    }
    } 
    
    
    
    void CMD_WRT(unsigned char val)
    {
    busy();
    LCD_PORT=val;                   //write cmd to P2
    rs=0;                           //cmd mode
    rw=0;                           //write
    en=1;
    en=0;                           //high to low latch 
    }
    
    
    void DATA_WRT(unsigned char ch)
    {
    busy();
    LCD_PORT = ch;                  //write cmd to P2
    rs=1;                          //data mode
    rw=0;                          //write
    en=1;
    en=0;                          //high to low latch 
    }
    

    void transmit_byte(unsigned char  byte)       // TRANSIMITT SERIAL DATA
    {
    SBUF=byte;                                  //TRANSMIT DATA FROM  BYTE TO SBUF 
    while(!TI);                                   // WAIT TILL DTA GET TRANSMITTED 
    TI=0;
    }
    
    void TRANSMIT(unsigned char *string)
    {
    while(*string)
    transmit_byte(*string++);
    }
          
    unsigned char SCI_ReceiveByte( void )
    {                                            // RECIVING SERIAL DATA
    unsigned char byte;
    //    RI=0;
    while(RI!=1);                                // WAIT TILL RI IS HIGH
    byte = SBUF;                                //RECIVE DATA FROM SBUF TO BYTE
    RI=0;
    return byte;                                 // RETURN THE DATA
    }

Bluetooth Interface PIC Schematic:



Bluetooth Interface PIC Code:

/*
 * Project name:
    BLUETOOTH MODULE
 * Copyright
     (c) Researchdesignlab.com
 * Test configuration:
     MCU:             PIC16F877A
     Dev.Board:       PIC
     Oscillator:      20.0 MHz
     Software:  mikroC PRO for PIC v 4.6

*/



// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections

unsigned char uart_rd,i;

void main() {


  Lcd_Init();                        // Initialize LCD

  Lcd_Cmd(_LCD_CLEAR);               // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off

  UART1_Init(9600);               // Initialize UART module at 9600 bps
  Delay_ms(100);                  // Wait for UART module to stabilize

   UART1_Write_Text("MC 1");       // TRANSMIT "MC 1" TO   bluetooth

  
  while(1)
  {

   if (UART1_Data_Ready()) {     // If data is received,
      uart_rd = UART1_Read();     // read the received data FROM   bluetooth
      Lcd_Chr_Cp(uart_rd);       // and send data lcd
      i++;
      }

    /*
   
    
     */
    
  }
  
 }



Bluetooth module Features:

  • 5V power operation.
  • Supports baud rates from 1200 to 1382400 bps (default is 9600 bps)
  • UART interface
  • TTL output.
  • Built in antenna
  • 10 meters range
  • Easy to use
  • Minimum External Components
  •  Status LEDs
  • High quality PCB FR4 Grade with FPT Certified.

For Sample Codes , Schematics : CLICK HERE




Friday, 14 November 2014

ISP ATMEGA Programmer



ISP ATMEGA Programmer:


This programmer is based on USBasp design and connects to your computer's USB port. Not only is it quite compact, but the design is really elegent. The USB interface is achieved by using an atmega processor and the rest is done in firmware. ISP programmer supports  Atmel and Atmega microcontrollers. It is a reliable tool for fast programming of Atmel and Atmega devices.


ISP ATMEGA Programmer Features:


  • No special controllers or smd components are needed.
  • Programming speed is up to 5kBytes/sec.
  • SCK option to support targets with low clock speed (< 1,5MHz).
  • AVR Series: ATTiny12 (L), ATTiny13 (V), ATTiny15 (L), ATTiny24 (V), ATTiny25 (V), ATTiny26 (L), ATTiny2313 (V) , ATTiny44 (V), ATTiny45 (V), ATTiny84 (V), ATTiny85 (V), AT90S2313 (L), AT90S2323 (L), AT90S2343 (L), AT90S1200 (L), AT90S8515 (L), AT90S8535 (L), ATMEGA48 (V), ATMEGA8 (L), ATMEGA88 (V), ATMEGA8515 (L), ATMEGA8535 (L), ATMEGA16 (L), ATMEGA162 (V), ATMEGA163 (L), ATMEGA164 (V), ATMEGA165 (V), ATMEGA168 (V), ATMEGA169 (V), ATMEGA169P (V), ATMEGA32 (L), ATMEGA324 (V), ATMEGA325 (V), ATMEGA3250 (V), ATMEGA329 (V), ATMEGA3290 (V), ATMEGA64 (L), ATMEGA640 (V), ATMEGA644 (V), ATMEGA645 (V), ATMEGA6450 (V), ATMEGA649 (V), ATMEGA6490 (V), ATMEGA128 (L), ATMEGA1280 (V), ATMEGA1281 (V), ATMEGA2560 (V), ATMEGA2561 (V) etc
    High quality PCB FR4 Grade with FPT Certified.

For Sample Codes , Schematics : CLICK HERE