Society of Robots - Robot Forum

Software => Software => Topic started by: Arthi Selva on July 04, 2011, 01:07:11 PM

Title: Programming for sound tracking robot using "P16F877A"
Post by: Arthi Selva on July 04, 2011, 01:07:11 PM
Hello there..

I am doing a sound tracking robot for my FYP. I am a newcomer for programming side. The robot have 4microphones facing 4 sides. They will detect sound from sources. The robot have to move towards the sound source making sound in highest frequency. Anyone have program for it or any suggestion to do programming. Your help will be much appreciated. Thank You.
Title: Re: Programming for sound tracking robot using "P16F877A"
Post by: richiereynolds on July 04, 2011, 02:15:15 PM
Could you be a bit more specific? Are you looking for suggestions for technology? language? algorithm?
What have you done so far? You'll get a more helpful answer if you let us know more specifics about your project, e.g. are you using a specific microcontroller or sensor?

At a very basic level your code could be something like:

Code: [Select]
forever
{
    foreach side
    {
        if side has higher frequency than sideWithHighestFrequency
        {
            sideWithHighestFrequency = side
        }
    }
    move in diection of sideWithHighestFrequency
}

But if you want more help we'd need more detail!
Title: Re: Programming for sound tracking robot using "P16F877A"
Post by: Arthi Selva on July 04, 2011, 08:38:25 PM
I am using P16F877A micro controller and MPLAB for programming. I will write the abstract below. I am looking for the code bro.

(Audio Sensing Autonomous Robot is a navigation system that detects audio frequency. In this case a buzzer will be used to make the sound as the transmitter. At the receiving part, the robot will be facilitated with 4 electrets condenser microphones, which detect the sound made from the buzzer. A high pass filter will be used to filter out the unwanted noise in low frequencies and to let the high frequency sound to pass on. Those outputs from the high pass filter are then will be compared using the microcontroller PIC16F877A. The output frequency from the filter will be converted into digital data using ADC (Analogue to Digital Converter) inputs at PORT A. This data will be compared with the inputs from the other three microphones. After the comparison the robot will start to move towards the sound which is the highest frequency among the four inputs. The microphone which detects the highest frequency sound will be kept in line with the source. The robot will adjust itself to keep the microphone in line with the point making noise. )

I am using 2 servo motors as wheels.
Title: Re: Programming for sound tracking robot using "P16F877A"
Post by: corrado33 on July 04, 2011, 08:44:07 PM
Do you want us to do the project?   ;)

I'm not opposed to helping you(in any small way that I can).... as long as you show some effort to try yourself first.  (I used to be a tutor in college, I hated when people came in expecting me to do their homework for them.)
Title: Re: Programming for sound tracking robot using "P16F877A"
Post by: Arthi Selva on July 05, 2011, 03:04:35 AM
It is not that. I just need a sample code or similar code to that. so that i can get the idea how to write coding.
Title: Re: Programming for sound tracking robot using "P16F877A"
Post by: richiereynolds on July 05, 2011, 05:40:35 AM
Well, "how do I write code" is a bit too general a question. Also, if you've no idea about coding I don't think some example code is going to help you much. I'd suggest doing some basic tutorials for the language and microcontroller you're using. I'm sure someone can point you to some tutorials bu I'd have thought google would be a good place to start? How about - programming tutorial for P16F877A ?

You might find learning some very basic programming principles useful first though, again, google is your friend e.g. searching for a beginners C tutorial?
Title: Re: Programming for sound tracking robot using "P16F877A"
Post by: waltr on July 05, 2011, 07:51:40 AM
It is not that. I just need a sample code or similar code to that. so that i can get the idea how to write coding.

Here is a good start on how to write code:
http://www.gooligum.com.au/tutorials.html (http://www.gooligum.com.au/tutorials.html)
Title: Re: Programming for sound tracking robot using "P16F877A"
Post by: Arthi Selva on July 05, 2011, 10:53:18 AM
Thanx for the link. It is really helpful. Can u get me a sample of coding for any kind of mobile robot. I just want to refer to the coding and see how the process goes.

Thank you.
Title: Re: Programming for sound tracking robot using "P16F877A"
Post by: corrado33 on July 05, 2011, 02:28:26 PM
That link has a ton of example programs.  Even has examples for using timers and controlling 7 segment displays etc.  You just have to read through the PDF files.

The pseudocode richiereynolds posted above is actually REALLY useful.  Figure out how to do each of the lines individually, the put them together to get a working program. 

I'd first start with "how do I receive input from a microphone to a PIC microcontroller?" then "how do I determine what the frequency of the input is?"

Once you can answer those two questions, you'll be very close to being done.

Also, I honestly don't think posting a bunch of code will help you much.  A, you won't be able to copy it, B, you probably won't understand it, and C, it won't have anything to do with your project whatsoever. 

I know when I first started I'd look at code and just get frustrated because I didn't understand what anything meant.