Showing posts with label Microcontroller Projects. Show all posts
Showing posts with label Microcontroller Projects. Show all posts

Sunday, June 29, 2014

Device Controlling Using Android

The purpose of this project is to demonstrate the basic principles of external device controlling using your android phone.

The basic principle in this project is that by interfacing an Android phone with a Arduino Board we can turn "off" or "on" some relays.
Components Required

  •           Serial Port Bluetooth Module( TTL )
  •           Arduino Microcontroller Board (ET-BASEAVR EASY328 ) Arduino Compatible Board
  •           8 channel Output Relay Board
 Connection Diagrams








Source Code For Arduino Board



For Arduino Microcontroller Board Source code

#define LED_PIN1  4
#define LED_PIN2  5
#define LED_PIN3  6
#define LED_PIN4  7

#define LED_PIN5  8
#define LED_PIN6  9
#define LED_PIN7  10
#define LED_PIN8  11

int firstSensor = 0;         // first analog sensor
int secondSensor = 0;    // second analog sensor
int thirdSensor = 0;        // digital sensor
int inByte = 0;               // incoming serial byte
boolean status_unlock;
boolean status_bluetooth;

long interval = 1000;           // interval at which to blink (milliseconds)
long previousMillis = 0;        // will store last time LED was update
int minite,sec;


void setup()
{
  // start serial port at 9600 bps:
  Serial.begin(9600);
  //pinMode(2, INPUT);   // digital sensor is on digital pin 2
  //establishContact();    // send a byte to establish contact until receiver responds
 
  pinMode(LED_PIN1, OUTPUT);
  pinMode(LED_PIN2, OUTPUT);
  pinMode(LED_PIN3, OUTPUT);
  pinMode(LED_PIN4, OUTPUT);

  pinMode(LED_PIN5, OUTPUT);
  pinMode(LED_PIN6, OUTPUT);
  pinMode(LED_PIN7, OUTPUT);
  pinMode(LED_PIN8, OUTPUT);
 
  digitalWrite(LED_PIN1, LOW);  // switch off LED
  digitalWrite(LED_PIN2, LOW);  // switch off LED
  digitalWrite(LED_PIN3, LOW);  // switch off LED
  digitalWrite(LED_PIN4, LOW);  // switch off LED
   
  digitalWrite(LED_PIN5, LOW);  // switch off LED
  digitalWrite(LED_PIN6, LOW);  // switch off LED
  digitalWrite(LED_PIN7, LOW);  // switch off LED
  digitalWrite(LED_PIN8, LOW);  // switch off LED
 
  status_bluetooth = true;
  status_unlock = false;
  sec = 0;
}

void loop()
{
  if (Serial.available() > 0) {  
      
    inByte = Serial.read();                      // get incoming byte: 

    if(inByte == 'A'){   
      digitalWrite(LED_PIN1, HIGH);        // switch on LED
      Serial.print('A', BYTE);                    // send a char
      delay(800);
      digitalWrite(LED_PIN1, LOW);        // switch off LED
      status_unlock = false;
      inByte = 0;    
    }
   
    if(inByte == 'a'){   
      digitalWrite(LED_PIN2, HIGH);        // switch on LED
      Serial.print('a', BYTE);                    // send a char
      delay(800);
      digitalWrite(LED_PIN2, LOW);        // switch off LED
     
      status_unlock = true;
      sec = 0;
      inByte = 0;    
    }
   
    if(inByte == 'B'){   
      digitalWrite(LED_PIN3, HIGH);        // switch on LED
      Serial.print('B', BYTE);                    // send a char
      inByte = 0;    
    }
   
    if(inByte == 'b'){   
      digitalWrite(LED_PIN3, LOW);        // switch off LED
      Serial.print('b', BYTE);                   // send a char
      inByte = 0;    
    }
   
    if(inByte == 'C'){   
      digitalWrite(LED_PIN4, HIGH);        // switch on LED
      Serial.print('C', BYTE);                    // send a char
      inByte = 0;    
    }
   
    if(inByte == 'c'){   
      digitalWrite(LED_PIN4, LOW);        // switch off LED
      Serial.print('c', BYTE);                    // send a char
      inByte = 0;    
    }
   
    if(inByte == 'D'){   
      digitalWrite(LED_PIN5, HIGH);        // switch on LED
      Serial.print('D', BYTE);                    // send a char
      inByte = 0;    
    }
   
    if(inByte == 'd'){   
      digitalWrite(LED_PIN5, LOW);        // switch off LED
      Serial.print('d', BYTE);                   // send a char
      inByte = 0;    
    }
   
    if(inByte == 'E'){   
      digitalWrite(LED_PIN6, HIGH);        // switch on LED
      Serial.print('E', BYTE);                    // send a char
      inByte = 0;    
    }
   
    if(inByte == 'e'){   
      digitalWrite(LED_PIN6, LOW);        // switch off LED
      Serial.print('e', BYTE);                   // send a char
      inByte = 0;    
    }
   
    if(inByte == 'F'){   
      digitalWrite(LED_PIN7, HIGH);        // switch on LED
      Serial.print('F', BYTE);                    // send a char
      inByte = 0;    
    }
   
    if(inByte == 'f'){   
      digitalWrite(LED_PIN7, LOW);        // switch off LED
      Serial.print('f', BYTE);                    // send a char
      inByte = 0;    
    }
   
    if(inByte == 'G'){   
      digitalWrite(LED_PIN8, HIGH);        // switch on LED
      Serial.print('G', BYTE);                    // send a char
      inByte = 0;    
    }
   
    if(inByte == 'g'){   
      digitalWrite(LED_PIN8, LOW);        // switch off LED
      Serial.print('g', BYTE);                   // send a char
      inByte = 0;    
    }   
   
    if(inByte == 'S'){   
     
      Serial.print('S', BYTE);                  // send a char
      status_bluetooth = true;
      sec = 0;
         
    }   
  } // if(Serial
 
  /*
  unsigned long currentMillis = millis();
     
              if(currentMillis - previousMillis > interval) {           
                previousMillis = currentMillis;         // save the last time you blinked the LED
               
                sec++;
               
                if(status_unlock==true){
               
                  if(sec== 11){
               
                      digitalWrite(LED_PIN1, HIGH);        // switch on LED
               
                      delay(800);
                      digitalWrite(LED_PIN1, LOW);        // switch off LED
               
                      status_unlock = false;                 
                      sec = 0;
                  }
                }
                else sec = 0;               
               
              }
 
 */
   
} //Loop

void establishContact() {
  while (Serial.available() <= 0) {
    Serial.print('.', BYTE);                   // send a capital A
    delay(500);
  }
}
ANDROID BLUETOOTH CONTROLLED DEVICE
 Android Bluetooth control application helps to control up to 8 external electrical or electronic devices. Use Android Bluetooth mobile device to  remote control your device with Bluetooth Receiver hardware Device.
Main features of the program
  • It can control  up to  8 devices.
    These devices can be turned off /on by setting Timer to ON / OFF the device and show the time.(the timer can be set to 1 minute, 15 minutes, 30 minutes, 1 hour, 2 hours, 4 hours).
    Use with Receiving device (Bluetooth Receiver Hardware Device see below).
  • Design for the Android version 4 and a screen resolution of 480 x 800 (WVGA).
  • Freeware with AD (free software)

Sunday, September 1, 2013

Heart rate monitor using 8051

In this article we are listing all the projects and circuits we have developed using the 8051 micro controller. We have tested all of these projects in our lab and verified the working . All these projects are made to solve a real world requirement or problem. Engineering students & other diploma students will find these projects useful for their mini project and main project requirements.
All the 8051 projects listed below are made using the 8051 compliant microcontroller from Atmel – AT89S51.  We have given the correct circuit diagram, working and software code (in assembly language) for each and every project. You can use all of them freely for your project & learning requirements. In case you are using a controller other than AT89S51 – please be sure to check the hardware of your controller and compare it with that of AT89S51. This is necessary because we have developed all the software in assembly language. If you are not that good at assembly language, you can convert the software into C language & use it with any compliant  8051 controller.
8051 micro controller based projects & circuits
Image Source
1. Ultrasonic Range Finder using 8051 – This project as the name says, is an application to measure distance of an object. It uses an ultrasonic transducer module HC-SR04 to measure the distance and the controller AT89S51 to make the necessary processing. This project can be used to make applications like Automotive parking sensor, Obstacle warning systems, Terrain monitoring robots etc. This ultrasonic range finder can measure distances upto 2.5 meters with an accuracy of 1 cm.
2. Digital Tachometer using 8051 –  This project is a digital tachometer which can be used to measure the revolutions per second of any object like a rotating wheel or a disc or a shaft. This application built using 8051 micro controller can measure upto 255 revolutions/second with an accuracy of 1 rev/sec. This application has 3 important sections – 1) is the optical pickup designed to pick the revolutions of the object using a photo transistor and LED. 2) is the processing stage designed using 8051 and the associated software 3) is the display section using 7 segment displays.
3. Water Level Controller using 8051 –  This is one of the most popular project we have published using 8051 controller. This water level controller monitors the level of the over head tank  and automatically switches on the water pump when ever the level goes below a preset limit. The level of the over head tank is indicated using 5 leds and the pump is switched of when the over head tank is filled.  We have given an illustrated circuit diagram with working explained in detail. You will also find the software codes written in assemble language.
4. Voltmeter using 8051    - We all must have used a multimeter from our young days. Have you ever bothered to create one ? So here is one such an interesting project. A Voltmeter using 8051 micro controller. Even though its quiet simple and an easy to make one, you shall find it really interesting. This can be used as an application at the mini project level for engineering and diploma students. This digital voltmeter  can measure 0 to 5 volts and has a sensitivity of  200mV which is a bit low but this project is meant for demonstrating how an ADC and seven segment display can be interfaced to 8051 to obtain a digital readout of the input voltage. ADC0804 is the ADC and AT89S51 is the controller used in this project.
5. Thermometer using 8051 - This is an interesting project designed to measure temperature using 8051. Its a simple 0-100°C digital thermometer with 1°C resolution using 8051. The circuit is based on LM35 analog temperature sensor, ADC0804 and AT89S51 microcontroller. LM35 is an analogue temperature sensor IC which can measure a temperature range of -55 to 150°C. Its output voltage varies 10mV per °C change in temperature.
Knowledge Resources:- The articles below given are basics on how to work with 8051 micro controller. You can refer them if you come across a road block anywhere!
1. Interfacing 7 segment display to 8051 – A good tutorial on interfacing 7 segment display to 8051 micro controller.
2. Interfacing LCD display to 8051 – Explains how to interface a 16×2 LCD display with 8051 micro controller.
3. Interfacing DC motor to 8051 – Explains how to interface a DC motor with 8051 micro controller.
4. Interfacing push button switch to 8051 – Interfacing LED & Push button switch to 8051 micro controller.
5. Interfacing ADC to 8051 – This articles gives you a good detail on how to interface ADC to 8051 micro controller. ADC 0804 is used to explain the interfacing procedure with an example software routine.

Alcohol Breathalyzer circuit using 8051 microcontroller (AT89S51).

This article is about a breathalyzer circuit using 8051 microcontroller which outputs the blood alcohol content (BAC) from the breath. The BAC is displayed in percentage on a 3 digit seven segment display. The microcontroller used if AT89S51 which belongs to the 8051 family and the alcohol sensor is MQ135 gas sensor from Futurelec.

MQ135 gas sensor.

MQ135 is a stable and sensitive gas sensor which can detect  ammonia, carbon dioxide, alcohol, smoke, nitrogen dioxide etc. The sensor consists of a tin dioxide sensitive layer inside aluminium oxide micro tubes, measuring electrode and a heating element inside a tubular aluminium casing. The front end of the sensor is covered using a stainless steel net and  the rear side holds the connection terminals.
The ethyl alcohol present in the breath is oxidized into acetic acid while passing over the heating element. This ethyl alcohol falls on the  tin dioxide sensing layer and as a result its resistance decreases. This resistance variation  is converted into a suitable voltage variation using an external load resistor. The typical connection arrangement of an MQ135 alcohol sensor is shown below.
mq135 alcohol sensor
MQ135 alcohol sensor
MQ135 has different resistance values at different temperature and different concentration of gases. The manufacturer recommends to calibrate the sensor at 100ppm of ammonia or 50ppm of alcohol. The recommended value of the load resistor is between 10K to 47K.

Circuit diagram.

Breathalyzer using 8051

The voltage output of the alcohol sensor is converted into a digital format using the ADC0804 (IC1). The Vref/2 pin of the ADC is held at 1.28V using the voltage divider network made of R14 and R15. Vref/2 =1.28V means the step size of the ADC will be 10mV and the output of the ADC will increment by one bit for every 10mV increment in the analog input. Refer the datasheet of ADC0804 for a better grasp. Digital out of the ADC (D0 to D7)  is interfaced to Port1 of the microcontroller. Control signals CS, RD, WR, INTR are obtained from the microcontrollers P3.7, P3.6, P3.5, P3.4 pins respectively. R9 and C1 are associated with the clock circuitry of the ADC0804.
Capacitor C3 connected between Vin+ and Vin- of the ADC0804 filters of noise (if any) in the sensor output. If C3 is not used the digital output of the ADC will not be stable. This filter capacitor will surely induce some lag in the ADC response but it is not very relevant in this entry level application. The microcontroller performs required manipulations on the ADC digital output in order to convert it into BAC % and displays it on the three digit seven segment display. Port0 of the microcontroller is interfaced to the multiplexed three digit seven segment display. The drive signals for the threes digits are obtained from the microcontroller’s P3.0, P3.1, P3.2 pins respectively.

Program.

ORG 00H
MOV P1,#11111111B
MOV P0,#00000000B
MOV P3,#00000000B
MOV DPTR,#LUT
MAIN: MOV R4,#250D
      CLR P3.7
      SETB P3.6
      CLR P3.5
      SETB P3.5
WAIT: JB P3.4,WAIT
      CLR P3.7
      CLR P3.6
      MOV A,P1
      MOV R5,A
      SUBB A,#86
      JC NEXT
      SETB P3.3
      CLR PSW.7
NEXT: MOV A,R5
      SUBB A,#115D
      JNC LABEL
      MOV A,#00000000B
      CLR PSW.7
LABEL: MOV B,#5D
       MUL AB
       MOV B,#8D
       DIV AB
       MOV B,#10D
       DIV AB
       MOV R6,A
       MOV R7,B
DLOOP:SETB P3.0
      MOV P0,#01000000B
      ACALL DELAY
      CLR P3.0
      SETB P3.1
      MOV A,R6
      ACALL DISPLAY
      MOV P0,A
      ACALL DELAY
      CLR P3.1
      SETB P3.2
      MOV A,R7
      ACALL DISPLAY
      MOV P0,A
      ACALL DELAY
      CLR P3.2
      DJNZ R4,DLOOP
      SJMP MAIN
DELAY: MOV R3,#255D
LABEL1: DJNZ R3,LABEL1
        RET
DISPLAY: MOVC A,@A+DPTR
         CPL A
         RET
LUT: DB 3FH
     DB 06H
     DB 5BH
     DB 4FH
     DB 66H
     DB 6DH
     DB 7DH
     DB 07H
     DB 7FH
     DB 6FH
END

Notes.

  • The MQ135 gas sensor requires around 5 minutes of preheat before the first use.
  • The MQ135 takes few minutes to retrace back to its normal condition after a positive test (alcohol present in the breath).
  • If there is no alcohol in the breath  the sensor output will swing back to its normal condition very fast.
  • Read these articles Interfacing seven segment display to 8051 microcontroller , Interfacing ADC to 8051 microcontroller  before attempting this project.
  • This breathalyzer circuit is just an entry level one and is not suitable for high end applications such as law enforcement or laboratory application.
  • The logic for converting the digital output of ADC into BAC percentage was obtained using approximation techniques.

Sunday, June 16, 2013

STM32F4 Discovery Tutorial 1 Using NETMF - Setting Up the Environment



STM32F4 Discovery








I received my STM32F4 Discovery board few days ago. During these days I am searching for a good compiler for the STM32 which is free or provide a better code sized free version. I am already working in .Net environment using C#, and I it is pretty good. In Google search I saw STM32F4 programming using  .Net, the below link.
We are using a .net port for STM32F4, it is .Net micro framework. 
I am using Visual Studio Ultimate 2010 (Compatibility of others is not known).
I hope you have an STM32F4 Discovery Board.
Necessary Tools
1.      STM32 ST-LINK Utility            Get It ->
2.      USB Micro and USB Mini cable.
3.      .NET MicroFramework SDK  Get It ->  
4.      Download these files (Evaluation purpose only driver)
                                                              i.      If you are not a member, join
Install all the softwares.
 
Steps to follow: Click here

Smart Home : The Project

ABSTRACT
Smart home technology has proved to contribute to increased independence and safety. Smart Home Technology is a collective term for information and communication technology in homes, where the components are communicating through a local network. The technology may be used for monitoring, alarming and executing actions, according to the programmed criteria. These project includes a high level security system informs the authorized person and to the police station by a dedicated software using internet. The heart of the project is a Web Server running on an ARM Cortex M4 microcontroller. There are various sensors, devices connected to this device for security system, control and monitoring. Dedicated softwares are there for user (.Net and Android) and police station (.Net). The user software can control the devices in home, view various sensor readings, status of security system, change configuration etc. The application used in the police station use maps of local area to provide the intruder alert. The software used in police station will be communicating with this home server and if an intruder is detected, it will be shown in the software as a location in map and a notification message which makes their duty easily. Same time the house owner will be informed by the user software. The software communicates to the Smart Home Device using UDP protocol. The user software is compatible for future developments like camera interfaces. 





courtesy : http://microcontrollerprojects00.blogspot.in
read full

Tuesday, October 9, 2012

USB to Serial Converter using AVR microcontrollers


This project is based on the AVR microcontrollers, which can be used to make a USB to Serial port converter based on Object Deveopment's V-USB (Software-USB on AVR), and the CDC (Communication Device Class) protocol was extended over it
The AVR-CDC converts USB and RS-232C signals using the AVR micro- controller which has no on-chip USB interface. . AVR-CDC enables PC to communicate with the USB device through virtual COM port.
The basic idea of using CDC protocol over Low-speed USB is based on Kyosuke Ishikawa's experiment in 2005. To make it stable and practical, Christian Starkjohann in Object Development helped me modifying his V-USB stack. Since three endpoints and the bulk transfer on low-speed device violates the USB standard, I added a tiny patch driver on Windows' USB stack.
Although this technology is quite experimental, it may be useful to interface your original system to PC easily. 
Basically the circuit is very simple, but it requires a certain amount of skills to control. If you need practical or stable solutions, or you are not familiar with electronics nor installing drivers, use the dedicated chip from vendors like FTDI.
The back door to the low-speed bulk transfer is gradually closing on the newer OS. After enjoying this USB technology, switch to the HID protocol or to MCU having on-chip USB controller.





CDC-232
CDC-232 creates a virtual COM port on PC that doesn't have real RS- 232C port. It enables RS-232C communication (without control lines), after connecting the device and installing the driver.


Virtual COM Port over Software-USB



Usage
Write the program to AVR, build the circuit, and connect the device to PC's USB port. Install the driver on Windows. Access the device through generated virtual COM port from terminal software or your application. Control lines (DTR, DTS, RTS, CTS) are not used by the host application. Set the terminal software as "no flow-control".
Windows requests the driver installation again when connected to other USB port. Detect the previously installed driver automatically. Another COM number will be assigned. If you set serial number in AVR (rebuild with modified usbconfig.h), you can get the same COM port at any USB port. However, you cannot connect multiple CDC devices of the same serial number.
Before detaching the device, close the COM port in terminal software or in your application. Otherwise, you cannot connect to the device again because of the broken file handle. Restart the terminal software or your application then. Switch to the fast transfer mode using "lowcdc.vbs" to get the baudrate higher than 9600bps.

Loop-back test on ATtiny45 version
Schematics
These schematics are for ATtiny45/85, ATtiny2313/AT90S2313, and ATmega8/48/88/168. Their firmware are all ISP-programmable. The red LED drops the USB voltage from 5V to 3.3V, and provides to AVR. The current is about 10mA, and is not enough to drive other circuit. When connecting to other MCU, connect Gnd and connect TxD and RxD in crossing way. R4 limits the leak current when the MCU's Vcc is 5V. You can omit if the Vcc is equal. R5 protects the TxD pin when it shortened to Gnd. You can omit both R4 and R5 if you connect to the RS- 232C driver like MAX232. Use crystal oscillator. Although ceramic resonator works well in most cases, it becomes unstable if the frequency deviation is bigger. 

 CDC-232 for ATtiny45-20
ATtiny45/85 uses internal RC oscillator and PLL. It is calibrated by  USB signal when connected. UART is implemented by software. It is not enough for high speed data transfer. If the TxD and the RxD are inverted (rebuild with -DUART_INVERT option), you can directly connect to RS-232C line.     1200 - 4800bps, 8N1
 


CDC-232 for ATtiny2313-20               

ATtiny2313/AT90S2313 has 2KB program memory. Although the baudrate is configured automatically, some functions are omitted.   600 - 38400bps, 8N1

CDC-232 for ATmega8/48/88-20
ATmega8/48/88's internal UART is configured from the PC. The flow-control (RTS/CTS) is supported.
600 - 38400bps, data 7/8, parity N/E/O, stop 1/2


Schematics
 
 CDC-232 for ATtiny45-20



CDC-232 for ATtiny2313-20

 



CDC-232 for ATmega8/48/88-20
 


Driver and code click here for CDC home page
 
 
courtesy : microcontrollerprojects00.blogspot.in
 
 
tags:  Serial Communication, Uart Project, USB to RS 232 converter, USB projects, USB circuits, USB to UART, Embedded projects, AVR, Atmega8, RS 232projects, Atiny



Monday, September 17, 2012

Two-digit LED counter using PIC


Here the PIC16F887 is used as a two-digit counter . The variable i is incremented (slow enough to be visible) and its value is displayed on a two-digit LED display (99-0). The challenge is to enable a binary number to be converted in decimal and split it in two digits (tens and ones). Since the LED display segments are connected in parallel, it is necessary to ensure that they change fast in order to make impression of simultaneous light emission (time-division multiplexing).
In this example, timer TMR0 is in charge of the time-division multiplexing, while the mask function converts a binary number into decimal format.
Example 9
/*Header******************************************************/
    
unsigned short mask(unsigned short num);
unsigned short digit_no, digit10, digit1, digit, i;

void interrupt() {
    if (digit_no==0) {
        PORTA = 0;                 // Turn off both displays
        PORTD = digit1;            // Set mask for displaying ones on PORTD
        PORTA = 1;                 // Turn on display for ones (LSD)
        digit_no = 1;
    } else {
        PORTA = 0;                 // Turn off both displays
        PORTD = digit10;           // Set mask for displaying tens on PORTD
        PORTA = 2;                 // Turn on display for tens (MSD)
        digit_no = 0;
    }
    TMR0 = 0;                      // Reset counter TMRO
    INTCON = 0x20;                 // Bit T0IF=0, T0IE=1
}

void main() {
    OPTION_REG = 0x80;             // Set timer TMR0
    TMR0 = 0;
    INTCON = 0xA0;                 // Disable interrupt PEIE,INTE,RBIE,T0IE
    PORTA = 0;                     // Turn off both displays
    TRISA = 0;                     // All port A pins are configured as outputs
    PORTD = 0;                     // Turn off all display segments
    TRISD = 0;                     // All port D pins are configured as outputs
    
    do {
        for (i = 0; i<=99; i++) {  // Count from 0 to 99
            digit = i % 10u;
            digit1 = mask(digit);  // Prepare mask for displaying ones
            digit = (char)(i / 10u) % 10u;
            digit10 = mask(digit); // Prepare mask for displaying tens
            Delay_ms(1000);
        }
    } while (1);                   // Endless loop
}
mask.c file:
/*Header******************************************************/
unsigned short mask(unsigned short num) {
switch (num) {
case 0 : return 0x3F;
case 1 : return 0x06;
case 2 : return 0x5B;
case 3 : return 0x4F;
case 4 : return 0x66;
case 5 : return 0x6D;
case 6 : return 0x7D;
case 7 : return 0x07;
case 8 : return 0x7F;
case 9 : return 0x6F;
}
}

Sunday, September 16, 2012

LCD based digital alarm clock using 89S51 MC

LCD based digital alarm clock using 89S51 MicroController

 
 Circuit Diagram
An alarm clock is a clock that indicates a pre-set time by producing sound at that time. This functionality of digital clock is used to awaken people or remind them of something. A digital clock is one that displays time digitally. The project explained here, displays time on a 16x2 LCD module. The LCD is interfaced with 8051 microcontroller (AT89S51). This circuit can be used in cars, houses, offices etc.


Read Full Article 




Tags: microcontroller projects, digital alarm, 89S51 microcontroller, 89S51 microcontroller projects, 89S51 microcontroller circuits, project circuits