check in
Ongoing

ATtiny13 TinyRemote RF

STDATtiny13 TinyRemote RF

tag

4.5k
0
0
6
Mode:Full

License

CC-BY-SA 3.0

Creation time:2021-01-02 17:24:08Update time:2021-09-30 00:47:39

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.

pic1.jpg

Hardware

The wiring is shown below:

wiring.png

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

schematic diagram
PCB

BOM

IDNameDesignatorFootprintQuantity
113.56MHzX1OSC-SMD_32251
282nHL2L06031
3CR2032-BS-6-1B1BATTERY-31
4ANTH1HDR-M-2.54_1X11
5Tactile Switch 6*6*6mmKEY2,KEY1,KEY3,KEY4,KEY5KEY-6.0*6.05

Attachments

OrderFile nameDownload times
No data
Clone
Add to Album
0
0
Share
Report

Project Members

Comment

All Comments(1)
Sort by time|Sort by popularity
Followers0|Likes0
Related projects
Empty

Bottom Navigation