I've had the same problem, couldn't get past 2 meters range.
Until i noticed that the TX-Frequency was off by about 150kHz.
I adjusted the RX Frequency (the module has a trimmer) and now 40-50m is possible with a wall in between.
The issue you face is that RCSwitch does not seem to support receive mode for ATtiny.
This is what you can find in RCSwitch.h:
// At least for the ATTiny X4/X5, receiving has to be disabled due to
// missing libm depencies (udivmodhi4)
#if defined( __AVR_ATtinyX5__ ) or defined ( __AVR_ATtinyX4__ )
Then all methods ...
The problem is you send a character of type char, thus exactly one byte.
However, when you send it you have to give the length and you use strlen. However, msg is an array (at least that is what you want), but that array contains only the character to sent. What you want is to send only 1 character, so use 1 instead of strlen.
Also, you can get rid of the ...
On the transmitting side (with cheap AC switches as receiver), I've actually had good results with the cheap green squares, and the equally cheap 5 for a dollar 'Helical antenna 433MHz' you find everywhere on ebay :)
I can reach all three levels of our house with that, and that's with only 5v supply on the green square, and it just sitting on a breadboard.
If you are not getting anything on the receiver, then the receiver is definitely the problem. These units will boost the gain until it get some signal, any signal.
You should be able to power the receiver + and GND (I have one, which ran on 5v, I can't see if these are the same), and put a multimeter from GND to Data, and you should get about half of Vcc, ...
Updated 26-08-2018: added tx(false); at the end of send. Without it, the TX pin could remain high, flooding the 433MHz band and making any other communication on it almost impossible!!!
Although these are all pretty old posts, I've still been struggling to get VirtualWire or its successor RadioHead working on an Attiny85. Typically the problem is that ...
I tried those Tiny cores you are using and had a lot of problems. I switched to http://code.google.com/p/arduino-tiny/ and it seems much better. Create a second Arduino installation folder and add the arduino-tiny cores. The pin name constants are like PIN_A0, PIN_A1,...,PIN_B1, etc. So, try that out.
I looked briefly at the VirtualWire code and there are ...
You could edit the VirtualWire.cpp source to use Timer2 instead of Timer1. For VirtualWire 1.18 the relevant section starts on line 512 with #else // ARDUINO.
On line 515 change (uint16_t)-1 to (uint8_t)-1 since Timer2 is only 8 bit. Then change all the TCCR1A, TCCR1B, OCR1A, TIMSK1 and OCIE1A to their Timer2 equivalent (hint: swap the 1's for 2's). Line ...
The 433mhz modules can be sensible on the power lines, place a cap on the power input. Also a straight antenna works most of the times, but if you want some more distance, look into making a dipole antenna, there is a coil loaded diy antenna you can make that helps a little bit up from straight wire.
I have the same TX/RX modules and two Arduinos and can get pretty good transmission reliability all throughout my house but it took some experimenting to figure out the largest factors in play (for me).
Module pairs should not matter, I got my 5 pairs jumbled up in a plastic bag, think only one was DOA. I use them together with Nexa wireless electric ...
Have you ever tried the Nordic nRF24L01 based modules? They are available on eBay for very low cost, and operate in the 2.4 GHz band. They should offer a range of at least tens of meters indoors. I have had good success with these, and they are very easy to interface to Arduino.
The example with only vw_get_message is the common usage of the VirtualWire library. It returns true if something was received and the checksum was okay.
Yes, each message is seperated from the other messages. Each message gets extra bits (intro bits) and extra bytes (checksum and length).
I don't know, I have never tested that. Looking at the source code, ...
These lines in the ISR in VirtualWire.cpp
if (vw_rx_enabled && !vw_tx_enabled)
vw_rx_sample = vw_digitalRead_rx() ^ vw_rx_inverted;
if (vw_rx_enabled && !vw_tx_enabled)
mean that the receive path code is just not executed while the transmitter is enabled.
It kind of seems from the comment as that ...
However, the actual transmission of the message happens inside vw_Int_Handler(). But this function is never called in vw_send() or vw_tx_start(). So the only way this could be happening is if there was some sort of multi-threading correct? Because by setting vw_tx_enabled to true, the transmission process would begin inside vw_Int_Handler.
I think that is used for receiving. By setting the speed, it knows how often it needs to read the input pin. It does this using timer interrupts, so it will run "in the background" without interfering with the main (loop) code.
The TCCR stuff is the set the interval for the timer interrupt.
If msg1 is of type char* (as is implied by the cast in msg1 = (char*)buf1;), then it seems to me that that statement will copy the address of buf1 to msg1. Then, when you fill buf1 with ascii zeroes (ie, characters '0') msg1 ends up being a string of ascii zeroes.
On the other hand, if msg1 is of type String (to go along with your comment about buf1 being ...
You could look into the RadioHead library - there might be a port for RPi, though I couldn't find one with a (very) quick google. This library works well, I use it actually with RFM69H 433 MHz radios (from Moteinos), a little more expensive than the simple 433 kits, but also supports encryption which might be important down the line. If you can't find a good ...
I have tested with Digispark ATtiny85 and https://github.com/sui77/rc-switch work perfect
just comment #define RCSwitchDisableReceiving
than use in setup code enableReceive(0); and external pin 7 PB2(int0) as RF source
Or you can use other software pin interrupt
PCMSK |= (1<<PCINT0);//here pin number
GIMSK |= (1<<PCIE);
can I use NFR905 based RF modules which is also 434 Mhz to clone any
existing remote working on 434 MHz.
The answer is, inevitably, no, you cannot. Each such remote controlled device might have a different digital modulation scheme. Best if you could focus on one specific product and adjust your design to fit it.
Note that the two products you are ...
You can connect an external antenna to pin 8 on that module. Just use a piece of wire that is 17.3cm long. But since the range is that bad to start with, probably means it isn't tuned very well. I'd return it, or try fiddling with the pot at the back. Not sure why Sparkfun has these crap transceivers for sale. Transceivers without a crystal are very ...
the virtual wire library has been obsoleted, and you should now use the RadioHead library. In this RadioHead Library, you can edit the RH_ASK.cpp file, and uncomment the #define RH_ASK_ARDUINO_USE_TIMER2 near the top.
I spent some time getting VirtualWire to work on attiny84. I see two issues with your code:
Since the tiny85 only has one timer, that one is being used by both VirtualWire and millis/micros. So your delays won't work as expected.
VirtualWire uses default values for vw_ptt_pin (10) and vw_rx_pin (11). Those pins don't exist on the attiny85. When vwsetup ...