Shop OBEX P1 Docs P2 Docs Learn Events
Sending sensor Data over 433Mhz (P/N 27982) — Parallax Forums

Sending sensor Data over 433Mhz (P/N 27982)

rushrvrushrv Posts: 8
edited 2012-10-07 22:03 in Accessories
Good Morning all;

I am having some trouble with a project i am working on. This is my fist post so please bare that in mind.

Here is what i have and trying to pull off. I have a LV-MaxSonar-EZ1 (www.maxbotix.com/documents/MB1010_Datasheet.pdf) a basic stamp 2 and a parallax transceiver (P/N 27982). I also have a serial LCD (parallax Item code 27977) on the unit transmitting. I aslo have a second basic stamp 2 for a receiver with the same transceiver unit (P/N 27982).
I have the program for setting up and reading the range with the sonar head (complete and works), but i want to be able to transmit the readings via wireless. The transmit/receiver code is what hanging me up. The range data is not critical but does need to be accurate, I have tried modify the codes for the transceiver with the check sum off the parallax website but when i try to add the sonar range code I run out of variable room. there for i at a loss on what to try next.

here is a sample of the codes i am using, any help or suggestions would be greatly appreciated.

Transmit code:

'{$STAMP BS2} com port 4
'{$PBASIC 2.5}

'---Set up Variables---
Value VAR Byte 'Holds data value being transmitted
realDistance VAR Word
echoTime VAR Word
value = realdistance

'---Set up Constants---
Tx CON 14 'Transmit I/O pin number
TxFlow CON 15 'Transmit flow control I/O pin number
N9600 CON $4054 'Baud mode value for 9600 baud, 8,N,1

value = realdistance
' Constants
DelayTime CON 500
Initialize:
HIGH Tx

'
Main Routine
'Transmit data
DO
sendermain:
PULSIN 12, 1, echoTime
realDistance = 2*echoTime/147 + 7
DEBUG DEC realDistance
DEBUG CR
SEROUT 11,84, [148, DEC3 realdistance, "in"]
PAUSE DelayTime

SEROUT TxFlow,N9600,[Value]
PAUSE 1000
GOTO SenderMain
SEROUT 11,84, [22,12,17]
PAUSE 5


LOOP




Receiver Code:


'{$STAMP BS2} com port 3
'{$PBASIC 2.5}
'
'---Set up Variables---
Value VAR Byte 'Holds data value being transmitted

'---Set up Constants---
Rx CON 15 'Receive I/O pin number
N9600 CON $4054 'Baud mode value for 9600 baud, 8,N,1


'
Main Routine


LOW rx
'Receive data
ReceiverMain:
SERIN Rx,N9600,[Value] 'Receive one byte
DEBUG "Receiving: ",DEC3 Value,CR
GOTO ReceiverMain 'Then start over again

Comments

  • FranklinFranklin Posts: 4,747
    edited 2012-09-25 13:20
    If you want to use LOOP you should not have a GOTO in the middle of it unless you have a conditional statement like IF THEN.
  • rushrvrushrv Posts: 8
    edited 2012-09-26 08:44
    Franklin wrote: »
    If you want to use LOOP you should not have a GOTO in the middle of it unless you have a conditional statement like IF THEN.

    i have changed the transmit program. once i get it back home i am going to attatch it to the response, if you don't mind looking at it.
  • FranklinFranklin Posts: 4,747
    edited 2012-09-26 13:28
    SEROUT 11,84, [148, DEC3 realdistance, "in"]PAUSE DelayTime
    
    
    SEROUT TxFlow,N9600,[Value]
    PAUSE 1000
    
    not sure what you are doing here.
    Serout 11 outputs on pin 11
    Serout TxFlow outputs on pin 15
    you still have the goto in your code.
    you also may need a wait in your serin if you are having flow problems.
  • rushrvrushrv Posts: 8
    edited 2012-10-05 20:27
    Sorry I haven't been back on here lately. Life has gotten hectic around my place.
    I figured it out and got the programing doing what i needed it to. but now i am on to overhauling the program again to attempt to add more than one data source (multiple transmitters to one receiver unit.) Getting it to work was simple once i read up a little more about data transmission i just need to put a sync line in the code.

    Serout 11,84, [148, DEC realdistance, "in"] ***that is to send the sensor data to the LCD display on pin 11.**

    Thank you for your insights and help.
    If you have any thoughts on where to find research on receiving data from multiple sources into one receiver i would be great-full.
  • SapphireSapphire Posts: 496
    edited 2012-10-07 22:03
    Receiving from more than one source is not much more difficult than receiving from one source. The RF module doesn't care where the signal came from, it just receives it and you get data at your SERIN line. It is the transmitters that you will have to reconfigure to send an ID so your receiver will know which transmitter sent the message. That means you will need to send more than one byte, and also make sure the two transmitters are running at different intervals so they don't step on each-other.

    You could add a one-byte header to your message with the address of each transmitter, followed by the data. At the receiver, your SERIN command would now read in two bytes and then based on the value of the first one (the ID), you'll know which transmitter sent the message.
Sign In or Register to comment.