Shop OBEX P1 Docs P2 Docs Learn Events
Wireless RF with Propeller — Parallax Forums

Wireless RF with Propeller

Brian SmithBrian Smith Posts: 44
edited 2010-08-18 09:53 in Propeller 1
I have a simple project involving controlling two motors wirelessly. The transmitter and receiver/motor driver are both on propeller prototype boards. The goal was to keep things cheap by using an 4800bps rf module. I am able to send serial data through a wire but when i switch to the rf modules i get garbage out of the receiver. Its been a long time since i wrote any code so I've been re-learning a lot of stuff.The following code is just to test the transmitter and receiver, it dosent include the motor driver, which works fine. Im just trying to send a string (but Ive tried sending all kinds of stuff) and debug that string with the receiver. The components are simple to wire up so I dont think the problem is with the wire connections. Could you guys look at the code and give me some advice?



Transmitter: http://www.sparkfun.com/commerce/product_info.php?products_id=8945
Receiver: http://www.sparkfun.com/commerce/product_info.php?products_id=8947




Transmitter code
CON
_clkmode = xtal1 + pll16x ' Feedback and PLL multiplier
_xinfreq = 5_000_000 ' External oscillator = 5 MHz

OBJ
BS2 : "BS2_Functions"

Pub Main
BS2.Start (31,30) '(Debug_rx, Debug_tx)
repeat
BS2.SEROUT_STR (7,string("hello"),4800,1,8) '(Pin,stringptr,Baud,Mode,Bits)




Receiver Code
CON
_clkmode = xtal1 + pll16x ' Feedback and PLL multiplier
_xinfreq = 5_000_000 ' External oscillator = 5 MHz

VAR
Word rxByte
Byte myString[50]

OBJ
BS2 : "BS2_Functions"

Pub Main
BS2.Start (31,30) '(Debug_rx, Debug_tx)
repeat
BS2.Serin_Str(7,@myString,4800,1,8) '(Pin,stringptr,Baud,Mode,Bits) Accept string passing pointer for variable
BS2.SEROUT_STR (30,@myString,4800,1,8)'(Pin,stringptr,Baud,Mode,Bits)

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-08-18 09:31
    These simple transmitter / receiver pairs are too simple to reliably function as a drop-in replacement for a piece of wire.

    1) The receiver is a 5V device. You need a 1K to 2.2K resistor in series with the receiver output pin to protect the Propeller I/O pin from the excess voltage.

    2) You really need some kind of sync pulse and a "sync" character. Look at the sample code for Parallax's 433MHz transceivers for an example of this. The SparkFun devices are very similar to these (except Parallax's are transceivers).

    3) The SparkFun description suggests that these are good up to 4800 Baud. Don't count on it! I'd start with 1200 Baud, experiment for a while, then try 2400 Baud. You're unlikely to be able to run these at 4800 Baud except under only the best conditions (distance, noise level, etc.)
  • LeonLeon Posts: 7,620
    edited 2010-08-18 09:53
    Manchester code is often used with those simple wireless links. It's probably more robust than Parallax's technique, but harder to implement.
Sign In or Register to comment.