PDA

View Full Version : GPS and RF Problem



Jose Porto
08-18-2011, 08:53 AM
Hi there, I bought a GPS module, plus a 433 Mhz RF Module from Parallax. Exactly the ones in the following pages:

http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/gps/List/0/SortField/4/ProductID/757/Default.aspx

http://www.parallax.com/Store/Accessories/CommunicationRF/tabid/161/CategoryID/36/List/0/SortField/0/Level/a/ProductID/582/Default.aspx

Only when they arrived did I noticed that there is no spin code examples of their operation. I also have a Propeller Professional Development Board Rev A, everything is connected has it should, but I have no clue. It seams that the basic stamp code that they have as example depends a lot on serout and serin.. well this is not available in spin, and honestly I've tried the BS2SPIN library but it gets even more complicated.

Can anyone help me and teach me how to write a simple program to interface with the GPS antenna that does the following.

START
SEND a request to de Sio port, currently 24 in my development board.
LISTEN for a response from the Sio port since this component seams to work tx and rx on the same port.
STORE the response in a string so that it can then be treated and read by the user (me in this case)

As far has the 433 RF module... I have no clue on how this works... really, they forgot about spin developers. I'm new to this type of coding and parallax has no documentation, asides from the dimension of the PCB, the power consumption. I have no clue on how to simply send "test" from A to B and get that same string in B for processing!

Please help me or I will be stuck on this for a long long time... since I do a search on OBEX for GPS and I get 3 entries or so... all of them for discontinued hardware or basic stamp!

Leon
08-18-2011, 09:55 AM
There are a few threads on using those RF modules for data transmission with the Propeller. They aren't all that suitable (the nRF24L01+ is much better), but they can be persuaded to work.

SRLM
08-18-2011, 06:48 PM
You can use FullDuplexSerialPlus (available in the obex {edit: it's for some reason not available in the obex, but a google search will turn it up.}) as a serial communication object (like SEROUT and SERIN).

For the transceiver, anything that you send on the serial line will be replicated by the receiver unit on it's RX line. From the documentation, for BS2:



DO
PULSOUT 0, 1200 'Sync pulse for the receiver
SEROUT 0, 16468, [ "!", x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE ]
x = x + 1
y = y + 1
PAUSE 10
LOOP


So, in this example the transmitter sends 5 bytes: a ! and two two-byte numbers.

Most objects in Spin will require some sort of initialization at the beginning of the program, and FullDuplexSerial plus is no different. To send it in Spin using the FullDuplexSerialPlus object would be something like:



serialobj.start(rxpin, txpin, 0, 9600)
DIRA[radio_pulse_pin]~~ 'set the pin to output

'somewhere later...
OUTA[radio_pulse_pin]~~ 'set the pin high
waitcnt(clkfreq/1000*100 + cnt) 'pulse high time
OUTA[radio_pulse_pin]~ 'set the pin low
serialobj.tx("!")
serialobj.tx( (x&$FF00)>>8) 'get the high byte of x
serialobj.tx( (x&$FF) ) 'get the low byte of x


The GPS module will use a similar procedure, but you'll probably want to have the bs2 code open so you can just mechanically translate it to spin.

Jose Porto
08-19-2011, 01:57 PM
I found a great library called GPS_SmartMode by Gary Noel Boon, PhD that simply did the trick. All I needed was something to point me in the right direction and I am now working with the GPS at full throttle. Thanks SRLM for your post also, that's probably all I need to know to figure the rest out for my self. I will, however, try to find time to make some sort of object that simplifies the whole process in the future so that I can build a two way, radio communication device. If I ever get that done I will post it here.

Jorge P
08-27-2011, 01:33 PM
You can get more data out of any GPS that uses the SirfStar III chipset. You can download the SirfDemo software if your module can be connect directly to a PC and play with it to understand what the various commands do and say. The SiRF commands for the binary protocol are not all supported in each SiRFStar III, it all depends on the software version embedded in the GPS. For instance, my GPS has SiRF GSC3e/LP, and you also have SiRF GSC3e/LP.

All that is only relevant if you want to use the binary protocol. And if you choose to use the binary protocol, make sure you know how to reset the GPS unit back to defaults, or how to set it back to NMEA Text strings.

SirfDemo http://www.falcom.de/support/software-tools/sirf/
SirfDemo User Guide http://www.falcom.de/uploads/media/Manual_SiRFDemo3.87.pdf
SiRF Binary Protocol Reference Manual http://gpsd.googlecode.com/files/SiRF-SiRF-v2_4.pdf
NMEA 0183 Protocol http://www.sparkfun.com/datasheets/GPS/NMEA%20Reference%20Manual1.pdf

Or you can avoid all that and just use the commands described in the Parallax documentation. I am playing with this and will connect it to the Propeller when I get part of another project working right, might be a few weeks.

NOTE: any GPS code in OBEX should work with almost any GPS unit set to factory defaults, provided it is properly connected. Its just a matter of parsing standard GPS strings from serial input..

http://obex.parallax.com/objects/347/ should get you started, you just need to change the RX, TX, and BPS settings to mach your setup, load the propeller, then open the serial terminal to see the debug output from your GPS.