Digital IR comms

Discussion in 'Wireless & RF Design' started by optickz, Nov 30, 2006.

  1. optickz

    Thread Starter New Member

    Nov 30, 2006
    8
    0
    Hello all. I am working on a project that will send 4 bits, serially, across a fiber link. The link will only be a few feet. My transmitter and receiver are set up on the breadboard and communicate with each other. However, I cannot figure out how to send these bits across the link.

    First, I need to convert my parallel data (4bits) into a serial bit stream. What is the best way to do this? Next, I need to recieve the bits at the receiver and hold them so that the stream can be converted back into parallel data and displayed. I've read tons on modulation and understand the theory, but I've never built a modulator/demodulator. I'm looking for a simple way to transmit the bits. I've looked at a few a circuit examples, but I still don't understand how to take into account clocking, synching of the emitter/receiver. I would rather not use the IR emitter/receiver from a Tv.

    I'm thinking around 30kHz. I don't care if it does not run super fast. The device will be used in a situation where speed is not really an issue.

    Thanks in advance.:)
     
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    Hi,

    It's lots easier than you think. Use logic like a 74LS253 multiplexer to make your serial bit stream. On the other end, an LS164 shift register will take in the bits one at a time, and has a parallel output to reassemble the nibble.

    You could use Morse code modulation - you light source is on or off. You can arrange to have extra bits sent to do things like a checksum, or start/stop. Some start signal might be a good idea to help resolve certain bits sequences, like 0000.

    What's your objection to IR LED's/transistors? If you want to be different, use any color LED for the transmiter, and one of the devices from TAOS, like their line of light-to-voltage converters. Go to www.mouser.com/taos for info.
     
  3. optickz

    Thread Starter New Member

    Nov 30, 2006
    8
    0
     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,145
    1,791
    Actually you could use shift registers for both the transmitter and the receiver. SIPO is a serial in parallel out shift register. PISO is a parallel in serial out shift register. Parts to consider include but are not limited to

    74HC164
    74HC165
    74HC166
    74HC595

    The 4000 series CMOS line also has functionally equivalent shift registes but I don't hve the specific numbers committed to memory
     
  5. optickz

    Thread Starter New Member

    Nov 30, 2006
    8
    0
    Thanks!

    So, if my input is 00000001...first four bits are start bits, the last four represent the number 1. I'll throw this parallel data into an 8-bit PISO shift register to create my serial stream. At the receiver end, I'll change this serial data back into parallel, using something like the LS164 (SIPO). Using clock provide by 555 circuit.

    Questions:
    1. How do I make my receiver aware of the fact that the first 4 bits are only to mark the start of a transmission?
    2. Can I use an identical clock on each end to keep time? How do I synch the tx/rx? If both clocks are set to have the same frequency, will I successfully capture the data?
    3. I'm having trouble reading the function table for the LS164. I want to take in 8 bits and then hold them to be used. Will this chip take in 8-bits and then stop the process?

    Thanks very much. Sorry for the numerous, probably simple, questions. :confused:
     
  6. optickz

    Thread Starter New Member

    Nov 30, 2006
    8
    0
    Hello again. I've acquired the suggested parts and set them up.

    Tx side: I now have my parallel data (input)converted into a serial bit stream. My data leaves the PISO chip properly. I'm monitoring with a logic probe. I think my transmitter is set up correctly.

    Rx side: I'm having trouble with the SIPO chip on the receiver (sn74hc164). It sees the data coming in, but it looks like the bits are not being held in their respective spot. Hmmm...How can I explain this? Well, on my display, the number changes as bits are coming in but it never settles on the correct number. After all bits are communicated, my display will read either a 1 or F only (it's a hex display). How do I get the chip to take in the 8 bits and stop. It looks like my data is being shifted out.

    thanks again. I appreciate any help.

    datasheet: http://focus.ti.com/lit/ds/symlink/sn74hc164.pdf
     
  7. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    4
    Where do you get the clock signal for the receiver from? And how do you keep it synchronised with the transmitter clock?
     
  8. optickz

    Thread Starter New Member

    Nov 30, 2006
    8
    0
    I have a 555 timer circuit generating pulses as my clock. Right now, for testing purposes, I have the reciever and transmitter both connected to the same clock. After I verify that my shift registers are set up correctly, I will have to figure out a way to separate the rx and tx clocks and synchronize them. I'm sure I'll have a problem with this as well, but I'd like to get everything else set up first. Thanks!
     
  9. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    Hi,

    One methodology for sending data is to do so by handshake. The sender indicates data ready by asserting a signal level (in RS-232, it is RTS - ready to send). The receiver says ready to receive with another signal level (RS-232 CTS - clear to send). As each bit is sent, another signal is sent to indicate a bit being sent (RS-232 - data ready). When the receiving equipment has taken it in it sends a level back (RS-232 - data acknowledge).

    That way, the data more-or-less clocks itself with the handshakes.
     
  10. optickz

    Thread Starter New Member

    Nov 30, 2006
    8
    0
    Thanks Beenthere. I see what you're saying about the handshaking and start/stop bits. However, I don't see how to implement this technique. I've been staring at this circuit board for days trying to figure it out. The chip that I'm using, on the receiver side, to take my serial stream and turn into parallel data has a clock inhibit input...so does the PISO chip on my transmitter. How can I use these inputs to do the following:

    1. Transmitter: send two start bits, 4-bit data, two stop bits
    2. Reciever: a. receive two start bits and start looking for incoming data
    b. take in 4 data bits and make available at parallel
    c. take two stop bits and inhibit clock, so that data will be available at parallel output for usage later.

    Thanks again. :(
     
  11. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    4
    One thing that you need to take into account is, in most serial asynchronous communication (including RS232) both ends of the link have their own clock circuits. The receiving end then has to adjust or synchronise its clock in response of the start bit or whatever start sequence that is sent by the transmitting end. Simply detecting the start sequence without properly phasing or syncronising both clocks would not work.
     
  12. optickz

    Thread Starter New Member

    Nov 30, 2006
    8
    0
    Thanks! I understand that the two clocks will need to be synched. For now, I have both the receiver and the transmitter connected to the same clock. My current goal is to send my data from the transmitter to the receiver, both using the same clock. The data will then be used for something else.

    After I have this portion figured out, I will then separate the tx and rx.

    I have some digital electronics books/guides that discuss this type of communications. However, none show how to implement this stuff. Can someone explain the logic/implementation? Thanks for your time. :)
     
  13. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    Hi,

    One dodge is to alternate clock and data intervals. You transmit 9 clock pulses, and the data is between each pair of clocks. That way you don't have to get elaborate about sending 0's.
     
  14. optickz

    Thread Starter New Member

    Nov 30, 2006
    8
    0
    Okay. I just ordered an 8-bit SIPO shift register w/ output register. The shift register and output register operate on separate clocks. The register I'm currently using does not have a built-in output register. This is what I'm thinking...see below.

    1. Send all 0's.
    2. Send a 1 as my start bit.
    3. (At the rx side) When the start bit is shifted to a certain point in the register, I will have a comparator set Rclk to 'high'. Rclk is the clock for the storage register. A low-to-high transition at Rclk will latch my data in the output register. Further clock pulses into the shift register will not affect the storage register.
    4. Use my parallel data.

    How does that sound? Possible? I should receive my IC on Monday.

    Also, when it comes time to have the tx and rx running on separate clocks, can I simply build the clocks to have the same frequency and use the scheme above? Or, is this not sufficient for synching the rx and tx?

    Thanks again!
     
  15. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    Hi,

    When it gets down to actual hardware, it's best to post up the circuit. Without part numbers and such, it's all guesswork at this end.
     
  16. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    4
    The scheme that you proposed sounds possible. Although building two separate clocks, even with equal frequencies, without actually syncronising them is doubtful. Even the so called 'self-syncronising' modulation, like manchester code, have some sort of rudimentary synchronisation in it. They could be full synchronisation of both clocks or simpler trigger of certain correlated period from synchronising signal to capture the actual data.

    As Beenthere suggested, it's probably better if you could post your circuit.
     
Loading...