VirtualWire library for Arduino and other boards

VirtualWire library for Arduino and other boards

This is the VirtualWire library.

VirtualWire is an library for Arduino, Maple and others 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. Can also be used over various analog connections (not just a data radio), such as the audio channel of an A/V sender

It is intended to be compatible with the RF Monolithics (www.rfm.com) Virtual Wire protocol, but this has not been tested.

Does not use the Arduino 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 a 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.

This library provides classes for

  • VirtualWire: unaddressed, unreliable messages

Example Arduino programs are included to show the main modes of use.

The version of the package that this documentation refers to can be downloaded from http://www.airspayce.com/mikem/arduino/VirtualWire/VirtualWire-1.19.zip You can find the latest version at http://www.airspayce.com/mikem/arduino/VirtualWire

You can also find online help and disussion at http://groups.google.com/group/virtualwire Please use that group for all questions and discussions on this topic. Do not contact the author directly, unless it is to discuss commercial licensing.

Supported Hardware
A range of communications hardware is supported. The ones listed below are available in common retail outlets in Australian and other countries for under $10 per unit. Many other modules may also work with this software. Runs on ATmega8/168 (Arduino Diecimila, Uno etc) and ATmega328 and possibly others. Also runs on on Energia with MSP430G2553 / G2452 and Arduino with ATMega328 (courtesy Yannick DEVOS - XV4Y), but untested by us. It also runs on Teensy 3.0 (courtesy of Paul Stoffregen), but untested by us. Also compiles and runs on ATtiny85 in Arduino environment, courtesy r4z0r7o3. Also compiles on maple-ide-v0.0.12, and runs on Maple, flymaple 1.1 etc.
  • Receivers
    • RX-B1 (433.92MHz) (also known as ST-RX04-ASK)
  • Transmitters:
    • TX-C1 (433.92MHz)
  • Transceivers
    • DR3100 (433.92MHz)

For testing purposes you can connect 2 VirtualWire instances directly, by connecting pin 12 of one to 11 of the other and vice versa, like this for a duplex connection:

Arduino 1 wires Arduino 1 D11--------------------------—D12 D12--------------------------—D11 GND--------------------------—GND

You can also connect 2 VirtualWire instances over a suitable analog transmitter/receiver, such as the audio channel of an A/V transmitter/receiver. You may need buffers at each end of the connection to convert the 0-5V digital output to a suitable analog voltage.

Installation
To install, unzip the library into the libraries sub-directory of your Arduino application directory. Then launch the Arduino environment; you should see the library in the Sketch->Import Library menu, and example code in File->Sketchbook->Examples->VirtualWire menu.
Open Source Licensing GPL V2

This is the appropriate option if you want to share the source code of your application with everyone you distribute it to, and you also want to give them the right to share who uses it. If you wish to use this software under Open Source Licensing, you must contribute all your source code to the open source community in accordance with the GPL Version 2 when your application is distributed. See http://www.gnu.org/copyleft/gpl.html

Commercial Licensing

This is the appropriate option if you are creating proprietary applications and you are not prepared to distribute and share the source code of your application. Contact info@airspayce.comfor details.

Revision History
Version
1.0 Original release
1.1 2008-06-24 Now can compile for atmega8 Reported by creatrope
1.2 2009-03-30 Fixed a problem that prevented compiling with arduino-0015 Reported by Jaime Castro
1.3 2009-04-01 Fixed a compatibility problem with ATMEGA328 of the new arduino Now use SIGNAL(TIMER1_COMPA_vect) instead of ISR(SIG_OUTPUT_COMPARE1A) as discussed in http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1237714550/11  and reported by Jaime Castro.
1.4 2010-01-29 Added vx_tx_active(), suggested by Alan Burlison.
1.5 2011-09-09 Added vx_tx_active() function.
1.6 2012-01-10 Fixed a problem where the receiver was always reenabled after transmission. Reported by David Bath
1.9 2012-02-07 Documentation updates Documentation updates
1.10 Updated CHANGES file with changes since 1.4.
1.11 Converted documentation to Doxygen. Moved CHANGES log to this version history. Ensure vw_rx_pin is not accessed unless receiver is enabled
1.12 Compiles and runs on on Energia with MSP430G2553 / G2452 and Arduino with ATMega328. Patches contributed by Yannick DEVOS - XV4Y
1.13 util/crc16.h needed for compiling on Energia with MSP430G2553 / G2452 was accidentally left out of the distribution
1.14 Added support ATtiny85 on Arduino, patch provided by r4z0r7o3.
1.15 Updated author and distribution location details to airspayce.com
1.16 Added support for Teensy 3.0, contributed by Paul Stoffregen.
1.17 Increase default MAX_MESSAGE_LENGTH to 80. Added   vw_get_rx_good()  and   vw_get_rx_bad()  functions.
1.18 Added support for Maple, Flymaple etc with STM32F103RE processor using timer 1. Tested with Flymaple 1.1 and maple-ide-v0.0.12
1.19 Added new function vw_rx_inverted(), to allow the incoming RX to be inverted (normally high). Minor improvements to timer setup for Maple. Name   vw_tx_active()  changed from incorrect vx_tx_active()
Implementation Details
See:   http://www.airspayce.com/mikem/arduino/VirtualWire.pdf
Performance
See:   http://www.airspayce.com/mikem/arduino/VirtualWire.pdf
Connections
See:   http://www.airspayce.com/mikem/arduino/VirtualWire.pdf
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值