go_away

Author Topic: TV-remote controlled $50 robot  (Read 4766 times)

0 Members and 1 Guest are viewing this topic.

Offline dannytemmermanTopic starter

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
TV-remote controlled $50 robot
« on: February 08, 2009, 12:56:35 PM »
Hi, i am new here.

I have build the $50 robot.
I don't know much off programming.
But I want to have it remote controlled with TV-remote and i want it to have a program installed.

For an example: I want it to move around with the TV-remote if i press 4,8,6,2 and i want it to act as a object avoider when i press 5.And if i press 5 I regain control. What kind off receiver do i need and what kind of code.

Sorry for my maybe bad English.

I live in Belgium.

Thanks
« Last Edit: February 09, 2009, 08:04:17 AM by dannytemmerman »

Offline frodo

  • Supreme Robot
  • *****
  • Posts: 329
  • Helpful? 2
  • BOW DOWN TO MY MIGHTY STARE!!
Re: TV-remote controlled $50 robot
« Reply #1 on: February 08, 2009, 01:20:16 PM »
you need IR receivers. brilliant english by the way
OMG!!!! I AM SUPREME ROBOT!!!

Check out my Web

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,430
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
Re: TV-remote controlled $50 robot
« Reply #2 on: February 08, 2009, 04:35:03 PM »
First step, is to find out what sort of IR pulses the remote puts out. You can either look that up online, or you would have to build something like the IR widget to record it.

http://www.compendiumarcana.com/irwidget/


Or

you could use a documented solution:
http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/txtSearch/remote/List/1/ProductID/63/Default.aspx?SortField=ProductName%2cProductName


Offline frodo

  • Supreme Robot
  • *****
  • Posts: 329
  • Helpful? 2
  • BOW DOWN TO MY MIGHTY STARE!!
Re: TV-remote controlled $50 robot
« Reply #3 on: February 08, 2009, 05:48:53 PM »
nice IR widget. once you have the pulses of the remote, you need to get IR receivers that are compatible with the remote.
OMG!!!! I AM SUPREME ROBOT!!!

Check out my Web

Offline dannytemmermanTopic starter

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: TV-remote controlled $50 robot
« Reply #4 on: February 09, 2009, 03:00:36 AM »
i use a universal TV-remote to control a philips TV.
And what kind of IR receiver must i use. Is a normal Ir receiver okay?
And how about the code?

Offline dannytemmermanTopic starter

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: TV-remote controlled $50 robot
« Reply #5 on: February 09, 2009, 03:02:41 AM »
Do you have the documentation on other universal remotes?
I use a Welltech 40085/HTFB85 universal remote.
I have a Philips 28PT4418/01.

Edit:
Would it be possible to use a 555 timer with various resistors and switches. For example when switch 1 is pressed the resistance is 1K and so the pulse changes. And when switch 2 (switch 1 must be released) is pressed the resistance in 10K so the pulse changes again.
« Last Edit: February 09, 2009, 08:02:27 AM by dannytemmerman »

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,430
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
Re: TV-remote controlled $50 robot
« Reply #6 on: February 09, 2009, 11:05:37 AM »
i use a universal TV-remote to control a philips TV.
And what kind of IR receiver must i use. Is a normal Ir receiver okay?
And how about the code?

Do you know the pulse frequency of the remote?

Offline dannytemmermanTopic starter

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: TV-remote controlled $50 robot
« Reply #7 on: February 09, 2009, 11:34:27 AM »
i use a universal TV-remote to control a philips TV.
And what kind of IR receiver must i use. Is a normal Ir receiver okay?
And how about the code?

Do you know the pulse frequency of the remote?
No and i don't want to build that ir widget.

I would like to use this code for finding the frequency but I don't now how many loops are 1 sec.

Here is the code i already create.
If there are any mistakes in the code please mention.
The sensor_left is an ir receiver with a 120 ohm resistor.
"Nee" means "No"
"Ja" means "Yes"



void ja_sensor(void)
   {
   servo_left(44);
   delay_cycles(30000);
   }
void nee_sensor(void)
   {
   servo_right(44);
   delay_cycles(30000);
   }



//store sensor data
      sensor_left=a2dConvert8bit(5);

        int loops=29;
      int count=1;
      int frequentie=0;
      
        for (count = 1; count <= loops; count++)
        {   
      if(sensor_left < 240)
      frequentie++;   
        }
      
      if(frequentie<1)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<2)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }

      if(frequentie<3)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<4)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }         
         
      if(frequentie<5)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }         
         
         
      if(frequentie<6)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }         
         
      if(frequentie<7)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }         
         
         
      if(frequentie<8)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }         
         
      if(frequentie<9)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<10)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<11)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<12)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<13)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<14)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<15)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<16)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<17)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<18)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<19)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<20)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<21)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<22)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<23)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<24)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
         
      if(frequentie<25)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }   


Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
Re: TV-remote controlled $50 robot
« Reply #8 on: February 09, 2009, 11:43:06 AM »
An easier way to write that would be:

Code: [Select]
for(int i = 0; i < 25; i++)
{
if(frequentie < i)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
}

Offline dannytemmermanTopic starter

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: TV-remote controlled $50 robot
« Reply #9 on: February 09, 2009, 11:57:41 AM »
An easier way to write that would be:

Code: [Select]
for(int i = 0; i < 25; i++)
{
if(frequentie < i)
         {
         ja_sensor();
         }
      else
         {
         nee_sensor();
         }
}

Thanks

Do you now how to let the ATmega8 count the number of pulses in 1 second.
Something like:

For(time <= 1 second)
{
 if(sensor_left < 240)
      frequency++;  
}



But I don't now the exact code in C so i can't make the program.
« Last Edit: February 09, 2009, 12:32:25 PM by dannytemmerman »

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,430
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
Re: TV-remote controlled $50 robot
« Reply #10 on: February 09, 2009, 12:44:08 PM »
Check out the knowledge base on this:

http://www.sbprojects.com/knowledge/ir/ir.htm



If you set your universal remote to a code that doesn't have a corresponding television in your home, then the pulse will already be known.

For example, here is the sharp protocol:

http://www.sbprojects.com/knowledge/ir/sharp.htm


Here is another good table:

http://www.geocities.com/SiliconValley/Lakes/3947/TABLE.HTML
« Last Edit: February 09, 2009, 12:47:23 PM by pomprocker »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: TV-remote controlled $50 robot
« Reply #11 on: February 09, 2009, 09:52:34 PM »
Chances are your IR remote transmits at 44Khz, its just standard . . .

That being said, IR remotes transmits a fairly large code in IrDA. I think like ~20 characters if I remember right, but too lazy to look it up, and its different for different remotes.

IrDA will then need to be converted to TTL format for use with the UART pin on your microcontroller.

You read the entire command in as a string, then use if statements to control your robot.

Offline dannytemmermanTopic starter

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: TV-remote controlled $50 robot
« Reply #12 on: February 10, 2009, 01:18:58 AM »
I have created a device that can sent 20,30,40,50 and 60Hz.
Now i need a code to recognise with frequency is send to the robot.
I already created some pseudocode.

Here it is:

Read IR-receiver
IF(IR-receiver=on)
WHILE(IR-receiver=on)
{Read IR-receiver}
WHILE(time=< 1 second)
IF(IR-receiver=on)
WHILE(IR-receiver=on)
{Read IR-receiver}

frequency++



Would you see if its correct and please give me the code for 1 second.
« Last Edit: February 10, 2009, 11:18:04 AM by dannytemmerman »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: TV-remote controlled $50 robot
« Reply #13 on: February 13, 2009, 01:32:52 AM »
Quote
I have created a device that can sent 20,30,40,50 and 60Hz.
Now i need a code to recognise with frequency is send to the robot.
In this case, what you need to use is a hardware interrupt and a timer.

This forum has a few code examples, same with google.

Actually, at such a slow speed, you can just use a while loop that checks for a pin change. :P

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,430
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
Re: TV-remote controlled $50 robot
« Reply #14 on: February 13, 2009, 10:57:30 AM »
for detecting i/o pin changes, there are macros defined in sfr_defs.h which is included in io.h, but for the timing with an MCU, I don't know how accurate it would be without some sort of real-time clock or a 555 or something. In the case of IR pulses, how accurate does the timing need to be?

Offline dannytemmermanTopic starter

  • Full Member
  • ***
  • Posts: 48
  • Helpful? 0
Re: TV-remote controlled $50 robot
« Reply #15 on: February 13, 2009, 11:03:00 AM »
for detecting i/o pin changes, there are macros defined in sfr_defs.h which is included in io.h, but for the timing with an MCU, I don't know how accurate it would be without some sort of real-time clock or a 555 or something. In the case of IR pulses, how accurate does the timing need to be?

I just need to see which frequency it is.
And I also use a 555 timer to make my homemade remote sent out 20,30,40,50 and 60 Hz.
I just need my robot to recognise it with code.

 


Get Your Ad Here

data_list