Shop OBEX P1 Docs P2 Docs Learn Events
Sensing a Negetive Input on an I/O Pin? — Parallax Forums

Sensing a Negetive Input on an I/O Pin?

Frog ManFrog Man Posts: 6
edited 2011-04-22 21:38 in Propeller 1
The title is slightly unclear, it's common sense how to tell whether an I/O pin is high or low, but a wireless receiver I have sends a negative charge out its data terminal (it's not the Xbee, it is a simple setup I found on http://www.seeedstudio.com/depot/433mhz-rf-link-kit-p-127.html). When connected to an I/O pin and using the simple "if (ina[0] == 0)" command, the Propeller does not respond to its charge.

The receiver runs at 5vdc. I am aware of voltage discrepancies(and have used appropriate resistors) and that I can easily set my system up as illustrated in the book(but thats for sending data to readable monitor), but I am developing my own system of transcending by measuring how many times I can record an input pulse in a 2 second period. Depending on how many pulses the propeller records, is what the response will be by the alarm system. (Just to give you a little context)

If anyone has any experience in possibly external transistors or some peripheral set-up which will allow me to convert that negative pulse into a positive one, I would greatly appreciate it.

Thank You

Module: http://www.seeedstudio.com/depot/433mhz-rf-link-kit-p-127.html

________________
|CURRENT SETUP|

GND o
(-)
DATA o
/\/\/\/\/(3.9k)
>pin0
Vcc o
+5vdc

**Not responding to a "if (ina[0] == 0)" code, when receiving and producing a Negative charge on DATA

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-04-22 17:27
    I think you need to show us all of your code. If a high is Vcc / 2 = 2.5V, and a low is -0.7V, you should be getting the desired response by reading ina, since the Prop's input threshold will be well below 2.5V.

    Don't forget, though, with these simple transmitters and receivers, you may need to transmit equalizing pulses or a long mark ahead of any data, so the receiver's data slicer can operate with the correct threshold. Ideally, you would use a balanced encoding scheme, like Manchester, that has an equal amount of highs and lows to keep the receiver's data slicer straddling the center level.

    -Phil
  • Frog ManFrog Man Posts: 6
    edited 2011-04-22 17:52
    Sorry I wasn't very clear: the propeller chip isn't making the distinction between being LOW(unconnected to power) and having the negative charge of the wireless module sent to it. I am curious if its supposed to make this distinction, if there's a way, or a certain code to use.

    Thank You
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-04-22 17:58
    The Propeller's input logic threshold is approximately Vdd / 2, or 1.65V. The receiver's output "high" level is 2.5V and "low" is -0.7V. Therefore your circuit should work. I suspect the problem lies in the way you are transmitting data, which I explained in my second paragraph.

    But show us your code. Maybe it's something else. As things stand, you haven't given us much to go on.

    -Phil
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2011-04-22 18:40
    Are you sure it is a negative voltage?

    Looking at the link to that RF module it says "Receiver Data Output: High - 1/2 Vcc, Low - 0.7v"

    But I think they are using the - as a "dash" symbol rather than as a "minus" symbol. In other words, with a 5V supply, high is +2.5V and low is +0.7V.

    As such, I think you might be able to feed this into a propeller pin with a current limiting resistor, eg the 3.9k which you already have.

    If it is not working, I suspect this is a code problem. These "raw RF" modules are not the easiest to work with - as PhiPi says, you need to balance the highs and lows, eg Manchester coding, or send a series of ascii "U" characters, (12 works) which is binary 01010101 before the packet and then keep the packets short. There are pages and pages of discussions on this on other forums.
  • Frog ManFrog Man Posts: 6
    edited 2011-04-22 21:31
    YES!!!
    The propeller officially received and acted based upon the 4 dollar transceiver package!

    Now that I take a closer look at the info page, it does appear to say HIGH Vcc/2 and LOW .7v.

    What confused me:
    The other aspect to take into account is that when I connect the negative side of and LED to the DATA and the positive to Vcc, it lights up at the correct frequency of the transmitter. When reversed to the polarity stated in the data(+>DATA, ->GND) it doesn't work.
    ***I also got multiple circuits to function well based on the fact that that was putting out a negative signal...I don't know how...HA!

    For your future use:
    My current coding is very preliminary for testing purposes, it is as follows:
    PUB main
                       
          dira[4] := 1                    
    
    repeat
       if (ina[0] == 0)
    
                     !outa[4]
                     waitcnt(clkfreq/30 + cnt)
                     !outa[4] 
    

    When connected to a Pull-Down Resistor it makes the LED on pin4 blink exactly with the frequency.


    GND o
    >GND_______________pin0
    DAT o
    ^
    /\/\/\/\/(10K)
    >GND
    Vcc o
    +5vdc


    pin4
    |>|
    >GND

    __________________________________________________________________

    Thanks for the help!
    Frog Man
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-04-22 21:38
    attachment.php?attachmentid=78421&d=1297987572
Sign In or Register to comment.