
ATtiny13 TinyRemote RF
STDATtiny13 TinyRemote RF
License
:CC-BY-SA 3.0
Description
Overview
TinyRemoteRF is an RF remote control based on an ATtiny13A microcontroller and a SYN115 ASK transmitter IC powered by a CR2032 coin cell battery.
- Firmware (Github): https://github.com/wagiminator/ATtiny13-TinyRemoteRF
Hardware
The wiring is shown below:
If you want to use only four buttons, you can leave KEY5 unsoldered and upload the 4-button version of the firmware. If you want to use all five buttons, you have to disable RESET on PB5 by burning the respective fuses after uploading the 5-button version of the firmware:
avrdude -c usbasp -p t13 -U lfuse:w:0x2a:m -U hfuse:w:0xfe:m
Warning: You will need a high voltage fuse resetter to undo this change!
For a simple breadboard test you can directly connect the DATA pin of an RF module to PB0.
Software
Protocol
The protocol is based on the ones used for infrared remote controls, but also takes into account the special needs of a stable radio connection. It is a simple but robust and DC-free protocol which is easy to decode and does not require precise timing. It operates with ASK/OOK (Amplitude Shift Keying / On-Off Keyed).
Pulse lengths are derived from an adjustable error width (RF_ERR). A "0" bit is a 2 * RF_ERR long burst and an equally long space, a "1" bit is a 4 * RF_ERR long burst and an equally long space. A start bit is a 6 * RF_ERR long burst and an equally long space.
+-------+ +---+ +-----+ +---+ +- ON
| | | | | | | | | start: 6 * ERR
| 6 | 6 | 2 | 2 | 4 | 4 | 2 | 2 | ... bit0: 2 * ERR
| | | | | | | | | bit1: 4 * ERR
--+ +-------+ +---+ +-----+ +---+ OFF
|<--- start --->|<-"0"->|<---"1"--->|<-"0"->|
An RF telegram starts with the preamble in which a defined number of "0" bits are transmitted to wake up the receiver and allow it to set its automatic gain (AGC). The following start bits signify the start of the transmission. Afterwards three data bytes are transmitted, most significant bit first. The three data bytes are in order:
- the 8-bit address of the device,
- the 8-bit key-dependent command and
- the 8-bit logical inverse of the command.
After the last bit a space of at least 8 * RF_ERR signifies the end of the transmission. The transmission can be repeated several times.
Implementation
At the beginning of the code, the framework conditions are set, some of which can also be adapted by the user.
// RF Codes
#define ADDR 0x55 // address of the device
#define CMD1 0x01 // command KEY1
#define CMD2 0x02 // command KEY2
#define CMD3 0x03 // command KEY3
#define CMD4 0x04 // command KEY4
#define CMD5 0x05 // command KEY5
// define RF error width in microseconds; must be the same in the receiver code;
// higher values reduce the error rate, but lengthen the transmission time
#define RF_ERR 150
// define number of preamble bits
#define RF_PRE 32
// define number of start bits; must be the same in the receiver code
#define RF_START 4
// define number of transmission repeats
#define RF_REP 3
// macros ASK/OOK
#define RF_on() PORTB |= (1<
Design Drawing
BOM
ID | Name | Designator | Footprint | Quantity |
---|---|---|---|---|
1 | 13.56MHz | X1 | OSC-SMD_3225 | 1 |
2 | 82nH | L2 | L0603 | 1 |
3 | CR2032-BS-6-1 | B1 | BATTERY-3 | 1 |
4 | ANT | H1 | HDR-M-2.54_1X1 | 1 |
5 | Tactile Switch 6*6*6mm | KEY2,KEY1,KEY3,KEY4,KEY5 | KEY-6.0*6.0 | 5 |

Project Members

Comment