Pages: [1] 2   Go Down
Author Topic: Suggestions on IR communication  (Read 1843 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 413
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm using a IR transmitter on a Arduino UNO board where I also connected a servo motor and a CC motor and a IR receiver on another Arduino UNO board where i connected a joystick and i'm trying to let them communicate by using IRemote library.

I'd like to receive suggestions on how realize the IR communication.
In particular, i have to send just four signals in order to change the CC motor rotation and to control the servo motor.

For example, if i move the joystick UP or DOWN, then CC motor has to change its rotation while if I move the joystick on the left or on the right, then the servo motor has to rotate in different directions.

Can you give me some suggestion about the protocol to use, please?
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I don't know anything about the library you are using, but if I was trying to implement a proportional ir remote system, I would use an ir emitter driven directly from the servo library.

I would try something like three servos, on for throttle, one set at a fixed signal just to act as a separator, then the steering servo.

The servo library already implements the type of pulse width encoding used to drive servos and electronic speed controllers, so why invent something else less efficient when you can transmit this directly ?

I am about to get on a plane some will have to leave it at that for now, if your interested in this approach I can help out tomorrow

Duane B


Logged


0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 413
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You gave me a great idea!

I can pass the value from joypad directly to the IR emitter by using servo library in order to have a proportional signal.
But, i have to receive and recognize these signals on the other side with the IR receiver and i'm not able to figure out how implements this other side of the communication.
 smiley-roll-sweat
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
   Still not on the plane yet.

   If you look on my blog there is a post on using interrupts to read a signal from an RC receiver, this will work for you, but you will be taking the interrupt from an ir receiver instead.

Prove the concept with the code from my blog and then I can give you some pointers on adding a second channel to the signal.

Rcarduino.blogspot.com look in the most popular posts.

Duane b

Logged


0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 413
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've read what you wrote about the RC and the Arduino, but i cannot figure out how to implement the IR communication.
It's ok the servo control part on your article, but it is important to decide what kind of signal the transmitter has to send.  smiley-confuse
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
   The servo needs this type of a signal which is easily generated by the servo library -



If you generate this on a pin with an ir transmitter connected, you can send it directly. I am not sure where you see the difficulty ?

is it that you haven't sent anything through ir yet ?

Duane b
Logged


0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 413
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry for the delay..
Thank you a lot for all your suggestions!

The difficulty I see is on the receiver side where it has to recognize if the transmitted signal has to move the servo motor (left or right) or the CC motor (front or reverse motion).

Tipically, when i send a IR signal with IRemote library, I receive a long integer string with a lots of numbers.
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
   The approach I suggested does not involve the IRRemote library. If all you want to do is send a signal to a servo and a motor through Infra red, then just  use the servo library to generate a servo signal, but connect it to an IR Emitter instead of a servo. On the other end you can read the signal and send it straight out to a servo with no additional coding or decoding on either end.

   What IR Receiver are you using, if its one that expects a signal in a given frequency range, you can build a small circuit with a 555 Timer to create this signal and then switch it using a PIN driven by the servo library. I can point you to some good online resources for building this part if your receiver needs it, but let me know what type it is first.

   Once you have one channel up and running its easy enough to add some more to the signal.

Duane B

rcarduino.blogspot.com


Logged


0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 413
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm using a IR TSOP2438, do you think it can work with servo library?

I'm asking this because i tried to let a LED blinking with this code:

Code:
void loop()
{
  digitalWrite( sendPin, HIGH);
  delay(100);
  digitalWrite( sendPin, LOW);
  delay(100);
  Serial.println("Invio");
}

but the receiver didn't recognise the signals.

Tomorrow, i'll try to use servo library, do you think it will work with my IR receiver?
Logged

Offline Offline
Sr. Member
****
Karma: 1
Posts: 260
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I suggest using the IR-Library by Ken Shirriff.
It's very ease to use.

Just send a signal with
Code:
  irsend.sendSony(0xa90, 12); // Sony TV power code
and on the receiver-side check the signal with
Code:
   if(results.value == 0xa90)
.
You can use your own codes instead of 0xa90.


Common IR-Sensors like the TSOP2438 do have filters for 38 khz transmission, thats maybe why your 100ms pulse won't be recognized. (meaning its way too long for a 38khz pulse detecting range)


« Last Edit: March 01, 2012, 06:59:43 pm by kduin » Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

As the previous poster has suggested, then detector you are using requires a 38khz signal. there are libraries that will generate this signal, but they are generally intended for sending infra red remote codes for home entertainment systems such as tvs etc. These libraries will not give you a signal for proportional control of a servo.

One quick experiment to try it to use a 555 timer to generate the 38khz signal for the ir emitter and then use the servo library to drive an arduino pin connected to the reset pin of the 555.

This will generate the correct frequency for your detector, but pulsed in the correct way to provide proportional control of a servo.

The 555 and 556 timer chips are great little devices that can be used for all sorts of projects, so if nothing else you will increase your options for future projects by experimenting with the 555 and 556

EDIT: Alternatively you can search for code examples for generating a 38Khz signal directly from an Ardiuno PIN, there are lots. If you find one that does not use timer 1, you can use an AND gate to combine an Arduino generate servo signal with the Arduino generated 38Khz IR signal to get a proportional 38Khz Servo signal out of the AND gate. I will have a go at putting together an example this evening.

Duane B

« Last Edit: March 02, 2012, 04:02:37 am by DuaneB » Logged


0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 413
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@kduin: can i use any kind of signal? Where can i find more information on how to create customized IR signal?

@DuaneB: today, i'll try to find a 555 timer in order to see if i'm able to use it with my arduino. I have to use two 555 or i have to use only one timer to generate the signal?

Can I try to send very fast pulses? Or arduino is not able to simulate a frequency like that?  smiley-roll-sweat
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Marcus,
   Just to make sure I am not leading you in the wrong direction for your project, can you give a quick outline of what you want the end result to be, then we can make a better judgement on IR or any other alternatives.

Duane B

rcarduino.blogspot.com
Logged


0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 413
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok smiley

I'm in this situation:

1) Arduino + IR receiver + servo motor + motor

2) Arduino + IR transmitter + 2-axis joypad (it uses two potentiometers)

  • When i move forward the joypad stick i want to transmit a IR signal to the second arduino in order to move the motor.
  • When i move on the left the joypad stick i want to send a signal to turn on the left the servo
  • When i move back the joypad i want to send a signal to change the rotation direction of the motor
  • When i move on the right the joypad stick i want to send a signal to turn on the right the servo
  • Also, if i move forward and on the right the stick, then it have to send two signal in order to let the motor and the servo move

Do you think servo library can help in this task?
Does i really need the NE555 timer?
What about if i let the led blink more faster?
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
   Ok, your project is as I previously understood it.

   The next question is, do you want control of the servo and the motor to be proportional ? if so its more functionality and more work than simple on/off left/right.

    Are you going for proportional control ?

    If so, my thinking is that you can generate a 38Khz IR signal from an Arduino timer or a 555 Timer and then pulse this signal on and off using the servo library.

    Are you planning to use two Arduinos ? or just one for transmitting or receiving ?

Duane B

rcarduino.blogspot.com
« Last Edit: March 02, 2012, 06:26:27 am by DuaneB » Logged


Pages: [1] 2   Go Up
Jump to: