Virtual Wire

I have modified this lib originally developped for Arduino in order to be able to run it on PIC32 Microcontrollers The main changes concern the  interruption setup and handling (Timer 2 and Output Compare interrupt OC1)

VirtualWire is an library that provides features to send short messages, without addressing, retransmit or acknowledgment, a bit like UDP over wireless, using ASK (amplitude shift keying). Supports a number of inexpensive radio transmitters and receivers. All that is required is transmit data, receive data and (for transmitters, optionally) a PTT transmitter enable.

Does not use the UART. Messages are sent with a training preamble, message
length and checksum. Messages are sent with 4-to-6 bit encoding for good DC balance,
and a CRC checksum for message integrity.
Why not just use the UART connected directly to the transmitter/receiver? As
discussed in the RFM documentation, ASK receivers require a burst of training pulses
to synchronize the transmitter and receiver, and also requires good balance between 0s
and 1s in the message stream in order to maintain the DC balance of the message.
UARTs do not provide these. They work a bit with ASK wireless, but not as well as this
code.
In addition, I have added 2 functions in the VirtualWire lib, vw_send_float and vw_get_float.
These functions allow to :

  • transmit float values
  • manage source value helpfull in case of one receiver connected to several sources
  • manage the type of data transmitted, currently 2 types of data are defined:
    #define VW_TEMPERATURE_DATA_TYPE 250
    #define VW_LIGHT_DATA_TYPE 251

The messages are formatted as follow:

0: source
1:  ‘#’
2: type of data
3-n: values in char format (0, 1, 2, 3, 4 5, 6, 7,9, 9, -, .)
n: ‘>’

 Connections:

  • Transmitter connected on pin 12 (static uint8_t vw_tx_pin = 12)
  • Receiver connected on pin 11 (static uint8_t vw_rx_pin = 11)

 

The code source is herehttps://github.com/RobotEdh/RobotChipKit/tree/master/libraries/VirtualWire

And the docVirtualWire