Skip to content

Commit

Permalink
reduced 2500 bitrate speed to eliminate errors with calib. tiny
Browse files Browse the repository at this point in the history
changed delay in example to delayMicroseconds
  • Loading branch information
pouriap committed Sep 21, 2020
1 parent 9ce896f commit 83fa498
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ The transmitter code is small in size making it suitable for microcontrollers wi
## Features
* Built-in error checking
* Built-in sequence numbering
* Data transmission speeds up to 1000bps (2500bps with calibrated clock)
* Data transmission speeds up to 1000bps (2000bps with calibrated oscillator)
* Ability to disable features in order to preserve memory space
* Small memory footprint: 176 bytes Flash, 1 byte RAM with all features enabled. (Using [MicroCore](https://github.com/MCUdude/MicroCore) with LTO enabled)
* Small memory footprint: 176 bytes Flash, 1 byte RAM with all features enabled

**Transmitter MCU support:** ATtiny13 or any other AVR microcontroller you can program with Arduino IDE.

Expand Down Expand Up @@ -61,7 +61,7 @@ void loop(){
// it is socially more responsible to use fewer repetition to minimize your usage of the bandwidth
sendMulti((byte*)msg, strlen(msg), 10);

delay(1000);
delayMicroseconds(TX_DELAY_MICROS);

}
```
Expand Down
2 changes: 1 addition & 1 deletion examples/Transmitter/Transmitter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ void loop(){
// it is socially more responsible to use fewer repetition to minimize your usage of the bandwidth
sendMulti((byte*)msg, strlen(msg), 10);

delay(1000);
delayMicroseconds(TX_DELAY_MICROS);

}
4 changes: 2 additions & 2 deletions src/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@
/**
* Data rate presets
*
* Available presets are: TRF_BITRATE_200, TRF_BITRATE_500, TRF_BITRATE_1000, TRF_BITRATE_2500
* Available presets are: TRF_BITRATE_200, TRF_BITRATE_500, TRF_BITRATE_1000, TRF_BITRATE_2000
* These speeds are estimated speeds, they aren't accurate
*
* According to the datasheet uncalibrated ATtiny13 has 10% frequency error.
* We also need at least 30us of error margin because we use delayMicroseconds() which isn't super accurate.
* So if our 0 pulse period is 500 then our error margin is 500-50-30 to 500+50+30
* In my experience TRF_BITRATE_1000 was a good option with ATtiny13 as TX
* If you are using an Arduino as TX you can go up to TRF_BITRATE_2500 speed.
* If you are using an Arduino as TX you can go up to TRF_BITRATE_2000 speed.
* If you need custom speeds you can define one for yourself in the header file "TinyRF.h"
*
* Preabmle:
Expand Down
10 changes: 5 additions & 5 deletions src/TinyRF.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@
const uint16_t NUM_PREAMBLE_BYTES = 15;
#endif

#ifdef TRF_BITRATE_2500
#ifdef TRF_BITRATE_2000
#ifdef TRF_TX_UNCALIBRATED
#warning "This data rate is too fast for an uncalibrated ATtiny."
#endif
const uint16_t START_PULSE_PERIOD = 1998;
const uint16_t ONE_PULSE_PERIOD = 400;
const uint16_t ZERO_PULSE_PERIOD = 300;
const uint16_t PERIOD_HIGH_DURATION = 200;
const uint16_t TX_INTERVAL_CONST = 8001;
const uint16_t ONE_PULSE_PERIOD = 601;
const uint16_t ZERO_PULSE_PERIOD = 451;
const uint16_t PERIOD_HIGH_DURATION = 298;
const uint16_t TX_INTERVAL_CONST = 8002;
const uint16_t TRIGGER_ERROR = 30;
const uint16_t NUM_PREAMBLE_BYTES = 30;
#endif
Expand Down

0 comments on commit 83fa498

Please sign in to comment.