PDA

View Full Version : Simple Wireless Communication



jhorsburgh
- 25th March 2008, 23:16
Hi All,
I am trying to setup very simple wireless communication between 2 PIC's (preferably 16F628A as they are abundant in my area).

What i would like to do is when a button is pushed on the "transmitter PIC" a number is sent to the "receiver PIC" (01153001), the number itself contains three groups of numbers which the PIC will recognise. "01" is a valid code (this code must match a code pre programmed in the receiver, so that the transmitter and receivers can be addressed), "15" is a action code (determines what the receiver will do, e.g. turn on light A) and "3001" is the unit code (this code is unique to the transmitting PIC, at this point the receiver should ignore it)

The transmitter and receiver i have in mind are:
Transmitter: http://jaycar.com.au/productView.asp?ID=ZW3100
Receiver: http://jaycar.com.au/productView.asp?ID=ZW3102
I have used them before on a similar project and they worked perfectly.

If anyone can help or point me in the right direction that would be great,
Thanks for your help in advance,
Jeremy

mister_e
- 25th March 2008, 23:27
use DEC2 and 2 X bytes variable, and probably a last WORD sized one

HSERIN [DEC2 UnitNumber, DEC2 Action, DEC4 Trash]
and then you check UnitNumber to see if it fit your requirement.

jhorsburgh
- 26th March 2008, 01:42
Hi Mister_E
I am really quite new to basic and have no clue where to start, i have attached a schematic of what i think the wiring should be (if there is anything wrong please point it out) but apart from that i would not have a clue.

Are there any similar projects or is this more complicated than i think?

Regards,
Jeremy

mister_e
- 26th March 2008, 02:28
Start small. For now, forget the RF module. Do some PIC to PC communication first, then PIC to PIC communication. Once you're done, add the RF modules.

There's a lot of Serial communication example here. Same for RF.

dhouston
- 26th March 2008, 10:37
1. Your schematic says RX Module & Receiver but shows the transmitter.

2. Don't forget a 0.1µF bypass capacitor on Vdd.

3. Your question is asked frequently and usually devolves into a long, confused thread. I've put together a very short web page that covers simple wireless communication, including a link to sample PBP code. See...http://davehouston.org/RFTipsTricks.htm

jhorsburgh
- 27th March 2008, 03:22
Hi Dave,
I made some changes to the schematic to include the capacitor, ideally what i am trying to do is have the transmitter send a code when SW1 is pushed and if that code is the same as the code in the receiver then the LED is turned on.

I also had a look at your PIC RX-TX code http://davehouston.org/PIC-RX-TX.TXT
can it be adapted to work on a 16F628A?

Thank you very much for your time,
Jeremy

dhouston
- 27th March 2008, 11:02
It should be simple to convert. The example is for an 8-pin PIC so pin designations will differ. I would start by comparing pin designations in the datasheets for the 12F629 and the PIC you want to use. Also, the example assumes an internal 4MHz oscillator. If you use a different oscillator frequency you need to adjust the values used with PulsIn/PulsOut accordingly. See the PBP manual entries for these commands.

You are still showing a 4-pin module as the receiver. The receiver has 8 pins. The datasheet for your receiver indicates its output for Logic HI is 0.7Vdd (3.5V with Vdd=5V). Table 17.4 of the PIC16F628A datasheet indicates that pins with Schmitt Trigger inputs need 0.8*Vdd (4V with Vdd=5V) for Logic HI while pins with TTL inputs only need 2.0V for Logic HI. Tables 5.2 & 5.3 of the PIC16F628A datasheet give the types of input buffers for the pins. I suggest you use a TTL input on Port B.

Also, RA5 is input only so your transmitter circuit isn't going to work as drawn. You need to choose another pin.