Wireless Modules with Arduino
Tutorial on how to use cheap wireless modules with Arduino 28 Dec 2010
Tutorial on how to use cheap wireless modules with Arduino 28 Dec 2010
I recently ordered a wireless transmitter and receiver, from Sparkfun. They are super cheap, but getting them to work is a little tricky.
Here is the transmitter circuit. In my case, I had to remove the antenna in order to make it work.
Here’s the general receiver circuit.
However, if you are using an Arduino microcontroller board with a built in USB to serial converter, it will pull the Rx pin of the Arduino high through a 1K resistor overpowering the Receiver module.
One solution is to use a different Arduino pin as a serial input and use the softwareserial library to receive data.
If you still want to use the Arduino’s hardware UART, you can add a buffer between the wireless module and the Arduino so that the receiver can overcome the USB to serial connection’s pull-up effect:
You could also use a transistor or op-amp as a buffer.
Data is sent in packets which consist of the following
Byte # | Description |
1 | 0xAA Preamble |
2 | 0x55 Preamble |
3 | Length (number of bytes in data Block) |
4 ... n | Data |
n+1 | Checksum (data bytes summed and truncated) |
First the microcontroller looks for the preamble bytes which mark the start of the packet in the random stream of data the microcontroller is receiving, then the microcontroller reads the length byte so that it knows how many bytes to read. Last, the receiving microcontroller reads the checksum and compares it to the one calculated for the data it received. If the checksums don’t match, then it knows that something was corrupted.
The checksum is calculated by summing the data bytes and truncating the result to one byte: