Monday, March 18, 2013

Programmable for C Language to final year project


This is coding for ultrasonic sensor and PIC16F877A and voice module.

#include <16f877a.h>
#use delay(clock=20000000)
#fuses hs, noprotect, nowdt, nolvp

#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, parity=N)

#byte PORTA=5
#byte PORTB=6
#byte PORTC=7

#define  sensor_sig  PIN_C0 //Pulse trigger input

long range;
long sensor_read();

void main()
{
  set_tris_a(0b00011111);
  set_tris_b(0b00000000); //RB as output
  set_tris_d(0b10000000);

   //initialize all ports
   porta=0;
   portb=0;
   portc=0;



   do{
      range=sensor_read()/10;  //read ultrasonics signal


      if
         (range>=0&&range<=50)

         {
          output_high(pin_d0); // voice command
          output_high(pin_d1); //  buzzer
          output_low(pin_d2);  // voice power supply
          delay_ms(3000);
          output_high(pin_d2);  // voice power supply


          }

      else if
         (range>=51&&range<=100)

        {
          output_high(pin_d0); // voice command
          output_low(pin_d1); //  buzzer
          output_low(pin_d2);  // voice power supply
          delay_ms(3000);
          output_high(pin_d2);  // voice power supply


          }

      else


         {
         output_low(pin_d0);
          output_low(pin_d1);
           output_high(pin_d2);
         }

      delay_ms(500);    //wait 500ms




   }while(1);
}

long sensor_read()
{
   long time_out=0;
   long sensor_cnt=0;

   output_low(sensor_sig);
   bit_clear(PORTC,0);
   delay_ms(100);
   output_high(sensor_sig);   //send a pulse out
   delay_us(5);               //for 5us
   output_low(sensor_sig);    //stop sending
   delay_us(600);             //wait for 600us
   bit_set(PORTC,0);

   //wait for feedback
   do{
      time_out++;
      delay_us(1);
   }while(time_out!=400 && input(sensor_sig)==0);

   //start count pulse
   if(time_out!=400)
   {
      do
      {
         sensor_cnt++;
         delay_us(1);
      }while(sensor_cnt!=20000 && input(sensor_sig)==1);
      delay_us(200);

      if(sensor_cnt==20000){
         return(0);
      }else{
         return(sensor_cnt);
      }
   }
   else
   {
      return(0);
   }
}

Monday, March 11, 2013

Drawing and Design a Method Implement Flowchart and Diagram

This is circuit implement flowchart for this project.


Flowchart Explanation

1.         Method Finding
It was done after project briefing since the first week. We had find out multiple choices of method that smart blind cane use to detect distance and barrier in front. As we can see, there are many type of ultrasonic sensor in the world.
2.         Method Analysis
            The method to construct circuit achieved either from the thesis, journal, magazine, internet and electronics shop. It is necessary to analysis beforehand to ensure it is really practically. During analyzing, the types of method have been decided by comparison and reasonable facts and factors.
3.         Calculation Analysis
            Once the method has been decided, all the required calculation analysis must being done. It is because to find the actual torque that can be driven with the load. The parameter of the ultrasonic sensor just measure with calculation the distance.
4.         Construct Circuit
In this part, the circuit involved only PIC, ping ultrasonic sensor and voice module circuit. In my part, the controller circuit is designed by the combination of ultrasonic sensor circuit and voice module circuit on the controller. This is very important circuit to setup the cut-off the controller of the cane. All the circuit that we design has its own relay. We put the relay on each circuit it is because easy to us troubleshot the circuit if the circuit does not function.
5.         Circuit Testing
            Was done after us soldering each circuit and determine circuit functionality. Proceed with the troubleshooting and reconstruct to recognize the problems.


6.         Troubleshooting
            This step took the most time in entire project execution. It may cause to reconstruct disolder and resolder. We are doing the troubleshooting mostly on sensor circuit and the voice module.
7.         Circuit Installation
            Finally, the complete circuit was installed in the casing. It also required some modification to fit the circuit and to make sure it is functioning with efficiency. 



This is a diagram for this project of Smart Blind Cane.


Monday, March 4, 2013

Soldering and do a circuit

Ping ultrasonic sensor:





WTR010-SD

Transistor Drive Relay





Pic 16F877A



 I do the circuit and soldering the circuit for this month.