Coder Social home page Coder Social logo

pouriap / tinyrf Goto Github PK

View Code? Open in Web Editor NEW
56.0 5.0 10.0 165 KB

A small Arduino library for using 315MHz / 433MHz RF modules with ATtiny13 and other low-memory microcontrollers.

License: GNU General Public License v3.0

C 39.91% C++ 60.09%
arduino attiny attiny13 rf-module 315mhz 433mhz arduino-library

tinyrf's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tinyrf's Issues

ESP8266 crashes and restarts

using TinyRF_RX.h to receive string of 55 character. ESP8266 is receiving properly but suddenly once in a while it thorws exception and restarts, below are the exception details. if i comment the lines related to tinyRF, system is working normal.

-------------- CUT HERE FOR EXCEPTION DECODER ---------------

ets Jan 8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 3424, room 16
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8
tail 0
chksum 0x2b
csum 0x2b
v0005e880
~ld

Reading past buffer when showbuffer macro is defined and minor lim* functions stuff

In TinyRF_RX.cpp, line 381, for loop always prints 256 characters regardless of buffer size defined in TRF_RX_BUFFER_SIZE. It suffices to change hardcoded 256 to TRF_RX_BUFFER_SIZE.

In lim_sub function int sub is unnecessary (but probably optimized away) as you can just do if(num < c).
Also is there a reason for "c" parameter in lim_sub and lim_sum to be uint16_t? Only uint8_t is ever passed to those functions.

BTW There are some typos in comments, mainly in Settings.h

I can do PR changing some/all of those things if you want.

Program does not receive messages

the program works normally I should get a value of 1,2 or 0 from ledStatse, but if I uncomment the part of the program in void loop() ledStates is always 0, like I don't get any messages.

In a simple way the commented part together with the colorWipe () function turns on the LEDs of a neopixel in sequence this function uses the millis () to have a non-blocking program.
I don't understand where I'm wrong and if there is any value to change in setting.h .

#include <Adafruit_NeoPixel.h>
#include "TinyRF_RX.h"
#define NUM_PIXELS 16

unsigned long interval = 80;  // the time we need to wait
unsigned long previousMillis=0;

uint32_t currentColor;// current Color in case we need it
uint16_t currentPixel = 0;// what pixel are we operating on


uint8_t rxPin = 2;

char ledStatesChar[2];
byte ledStates = B00;
byte ledState = B00;
byte ledState2 = B00;



Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_PIXELS, 6, NEO_GRB + NEO_KHZ800);

void setup() {

  Serial.begin(115200);

  setupReceiver(rxPin);
  currentColor = strip.Color(100,0,0);
  currentPixel = 0;
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}


void loop(){

const uint8_t bufSize = 30;
  byte buf[bufSize];
  uint8_t numLostMsgs = 0;
  uint8_t numRcvdBytes = 0;

  uint8_t err = getReceivedData(buf, bufSize, numRcvdBytes, numLostMsgs);


 
  if(err == TRF_ERR_SUCCESS){
    digitalWrite(13, true); // Flash a light to show received good message  
    Serial.print("Received: ");
    for(int i=0; i<numRcvdBytes; i++){
      Serial.print((char)buf[i]);
      ledStatesChar[i] = ((char)buf[i]);  //save the data
      //Serial.println(ledStates);
    }
    Serial.println("");
    
        ledStatesChar[numRcvdBytes] = '\0';
        ledStates = atoi(ledStatesChar);
        digitalWrite(13, false);
        Serial.println(ledStates);
    }

Serial.println(ledStates); 

//if (ledStates == 1){
//  if ((unsigned long)(millis() - previousMillis) >= interval) {
//    previousMillis = millis();
//    colorWipe();
//   }
//}
//else {
//  strip.clear();
//  strip.show();
//  currentPixel = 0;
//  }
//
//if(currentPixel == 15){
// strip.clear();
// strip.show();
//}
//
//}


void colorWipe(){
  strip.setPixelColor(currentPixel,currentColor);
  strip.show();
  currentPixel++;
  if(currentPixel == NUM_PIXELS){
    currentPixel = 0;

  }
}

Usage on Attiny85

Hi,
have you ever tried using the Attiny85 as a reciever?
I'm trying to, but cant get it working. I already attached a 16 MHz crystal and tried different pin configurations and used the same code on a Atmega328p and it works. Is there anything left I can try to get it working?

Compiling error!

I got an compiling error:
Arduino: 1.8.15 (Windows Store 1.8.49.0) (Windows 10), Board: "Digispark Pro (Default 16 Mhz)"
....\Documents\Arduino\libraries\TinyRF\src\TinyRF_RX.cpp: In function 'void setupReceiver(uint8_t)':
....\Documents\Arduino\libraries\TinyRF\src\TinyRF_RX.cpp:98:45: error: 'digitalPinToInterrupt' was not declared in this scope

attachInterrupt(digitalPinToInterrupt(rxPin), interrupt_routine, FALLING);

Idea: add support for ch55x family

Hello!
Thank you for your work on this library, as it's one of the best for low memory devices, like the attiny family.
Lately I've been experimenting with the ch55x family of microcontrollers and they're pretty capable low cost devices that are usb oriented.
Unfortunately there's no RF capability developed for the arduino port yet (https://github.com/DeqingSun/ch55xduino) so I was wondering how hard it might be to add support to your library for these devices.
I'm not really capable of doing such a task, so here's hoping that I sparked your interest in checking this idea out :)

Best regards

TinyRF on ESP-12F

High not sure if this is the place to put it. But i'm trying to build a sensor with Attiny13 which sends it's values over 433MHZ to a Bridge which will put it on MQTT. The transmitter part works perfectly i've tested it using a Arduino Nano as a receiver. But when i try to upload the receiver code to an ESP-12F it keeps on rebooting and gives me the following feedback:

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3584, room 16
tail 0
chksum 0xb0
csum 0xb0
v2843a5ac
~ld

I have the feeling it has something todo with the interrupts or something. Can somebody please share if it should be working with an ESP-12F and if so what can i be doing wrong?

TinyRf for ATtiny85 with 1Mhz

I used the TinyRF on an ESP8266 with the example of the library "Receiver" as an receiver.
As Transmitter I want to use a ATtiny85 with a battery.
To test the communication between ATtiny85 (transmitter) and ESP8266 as receiver I use on the ATtin85 your example "Transmitter" from the TinyRF_85-library.
The test was ok. The ESP8266 shows "Received: Hello!". The bootloader was burned with 8Mhz in the Arduino-IDE.
Next step I want the ATtiny85 with 1Mhz (lower energy for battery).
So I burned the bootloader with 1Mhz and I used the same sketch as with 8Mhz.
Now there was no output on the ESP8266.
What can I do to use the ATtiny with 1 Mhz.

Thanks for support!

TinyRF85 example does not compile

I tried compiling the TinyRF85 Receiver example with board "Digispark (Default - 16.5MHz)" which is my digispark ATtiny85 board. I chaged the line #include <SoftwareSerial.h> to #include <SoftSerial.h> because the compiler thought it should use the ESP8266/ESP32 SoftwareSerial library. Still, I am getting the error 'SoftwareSerial' does not name a type.

C:\Users\theme_9p6cezr\OneDrive\Arduino\Tiny85_RC_car_receiver\Tiny85_RC_car_receiver.ino:13:1: error: 'SoftwareSerial' does not name a type
SoftwareSerial mySerial(3, 4); //rx, tx
^
C:\Users\theme_9p6cezr\OneDrive\Arduino\Tiny85_RC_car_receiver\Tiny85_RC_car_receiver.ino: In function 'void setup()':
C:\Users\theme_9p6cezr\OneDrive\Arduino\Tiny85_RC_car_receiver\Tiny85_RC_car_receiver.ino:31:3: error: 'mySerial' was not declared in this scope
mySerial.begin(115200);
^
C:\Users\theme_9p6cezr\OneDrive\Arduino\Tiny85_RC_car_receiver\Tiny85_RC_car_receiver.ino: In function 'void loop()':
C:\Users\theme_9p6cezr\OneDrive\Arduino\Tiny85_RC_car_receiver\Tiny85_RC_car_receiver.ino:54:5: error: 'mySerial' was not declared in this scope
mySerial.println("Buffer too small for received data!");
^
C:\Users\theme_9p6cezr\OneDrive\Arduino\Tiny85_RC_car_receiver\Tiny85_RC_car_receiver.ino:59:5: error: 'mySerial' was not declared in this scope
mySerial.println("Received corrupted data.");
^
C:\Users\theme_9p6cezr\OneDrive\Arduino\Tiny85_RC_car_receiver\Tiny85_RC_car_receiver.ino:66:5: error: 'mySerial' was not declared in this scope
mySerial.print("Received: ");
^

exit status 1

Compilation error: 'SoftwareSerial' does not name a type

Uno + TX Speed

Hi,
I'm using TinyRF on an UNO and when using the following snippet:

  const char* msg = "Hello!";
  sendMulti((byte*)msg, strlen(msg), 2);

I noticed that its taking upwards of 330ms to perform the transmission. Is that expected? When using the radiohead library, transmission seems to be much faster, just curious as to what might be the reason.

Library not importable to arduino IDE via "Add .ZIP Library..."

Hi, during attempt to import this library using TinyRF-v1.7.zip I got following error:
image
Arduino library specification mandates that there should be root folder in zip file. The only change necessary to seamlessly import this library is to put all files in release zip to root folder with library name. I tested it in Arduino IDE 2.1.1, CLI version 0.32.3, but the same should be the case at least from version 1.8.10 when library specification rev.2.2 was introduced.
Source: https://arduino.github.io/arduino-cli/0.33/library-specification/#15-library-format-rev-22

I don't know if it's possible to add root folder to release without modifying repo in the same way (quick reasearch doesn't indicate that). If not then removal of installation method via arduino's ' "Add .ZIP Library..." from "How to install the library" section should be good enough.
EDIT: "Source code (zip)" and "Source code (tar.gz)" releases have mentioned root directory but "TinyRF-v1.7.zip" and "TinyRF_85-v1.7.zip" don't. Source code releases on the other hand have unnecessary, from Arduino's point of view, VS code files but they don't seem to do any harm.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.