Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Netduino & LIRC


  • Please log in to reply
7 replies to this topic

#1 Vojin

Vojin

    Member

  • Members
  • PipPip
  • 11 posts
  • LocationVancouver

Posted 20 October 2010 - 06:00 AM

I'm trying to build IR remote for my Sony DSLR A350.

Simple setup:
Posted Image

I have a LIRC file for IR Remote
begin remote

  name  Minolta_RC3
  bits            8
  flags SPACE_ENC
  eps            25
  aeps          100

  header       3872  1708
  one           527   436
  zero          527  1331
  ptrail        527
  pre_data_bits   24
  pre_data       0xD3AC7D
  gap          9052
  toggle_bit      0


      begin codes
          one_sec                  0x000000000000007F
          two_sec                  0x00000000000000FF
      end codes

end remote

The problem is that LIRC values are in microseconds and I cannot turn irLED on or off for less them 1 millisecond.
For example, bit "1" is LED on for 527 microseconds and then LED off for 436 microseconds:
irLED.Write(true);
Thread.Sleep(0.527);
irLED.Write(false);
Thread.Sleep(0.436);

This doesn't work because Thread.Sleep accepts [int]

Any idea how to wait for x microseconds?

Is there .NET Micro equivalent to Arduino's DelayMicroseconds (http://www.arduino.c...layMicroseconds)

#2 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 20 October 2010 - 06:36 AM

The problem is that LIRC values are in microseconds and I cannot turn irLED on or off for less them 1 millisecond.

Unfortunately, there is no microsecond delay function in the current implementation of .NET Micro Framework, you'd need to use native code for this kind of delays. But, shouldn't the IR signal use ~40 kHz (30 - 60 kHz) carrier frequency?

#3 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 20 October 2010 - 06:58 AM

CW2...would the BitBanger code work well for this? Chris

#4 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 20 October 2010 - 07:48 AM

CW2...would the BitBanger code work well for this?

Well, I have not had a chance yet to check (measure) the latest version of BitBanger output timing, but according to my calculations it is fast enough to produce pulses at frequencies of tens of kHz (pin toggling functions take about 3 ~ 5 µs, which translates into 333 ~ 200 kHz, there are three calls for each bit, which means roughly ~80 kHz). So with appropriately crafted input bit stream it could be done, although I am not sure that 40 38 kHz can be achieved with desired precision. Personally, I would use PWM controlled by a timer - unfortunately, timers too have only millisecond resolution.

Edit: Fixed modulation frequency (38 kHz is LIRC default value).

#5 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 20 October 2010 - 07:55 AM

Perhaps SPI or USART can be abused to produce pulses with required timing.

#6 Dezorian

Dezorian

    Member

  • Members
  • PipPip
  • 24 posts

Posted 24 January 2011 - 10:43 PM

Perhaps SPI or USART can be abused to produce pulses with required timing.


I would also want to get communication via on of the TX ports (DIO1 or DIO3) to another Netduino with this receiver.

We want to make a Laser Tag game with IR led's, and we want to use the USART ports to get communication when you point and shoot at you opponent which has the IR receiver.

I now have this setup:


---------------
Netduino....5v|----------------|
...........GND|--------------| |
..............|..............| |
..............|..............| |
.....TX...DIO3|--IRLED---RES-| |
..........DIO2|..............| |
..........DIO1|........|-----| |
.....RX...DIO0|--IRRECEIVER----|
---------------


I hope you get the setup. Is this even possible like this? I've also found this circuit: http://www.ruggedcir...mages/sch13.png

On Arduino its working: http://dangerousprot...ared-data-link/

Any help is greatly appreciated.

#7 Dezorian

Dezorian

    Member

  • Members
  • PipPip
  • 24 posts

Posted 27 January 2011 - 10:03 AM

Found out that the receiver i use has to get the signal with a 38khz carrier.

I will probably use a 555 timer to get the carrier.

Here is a schema which i will be likely to use:
http://www.tkk.fi/Mi...ts/ir_send.html

Or maybe try to use this one but i'm not sure it can cope with the RS232 signals.
http://www.robotroom...nfrared555.html

#8 Corey Kosak

Corey Kosak

    Advanced Member

  • Members
  • PipPipPip
  • 276 posts
  • LocationHoboken, NJ

Posted 28 January 2011 - 06:17 PM

Tens of kHz...

"Tens of kHz" is so passe. B) I've looked over the code, and I'm certain BitBanger would benefit from the same massive speed advantages that accrue from accessing the I/O ports directly, as Chris Walker introduced in this discussion.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.