433 MHz RF module with Arduino Tutorial 1


There are 4 parts to this tutorial:
To get the most out of this tutorial - it is best to start at tutorial Part 1, and then progress to Part 2 then Part 3 and then do Part 4 last. Doing the RF tutorials in this order will help you to understand the process better.



If you are looking for a way to communicate between Arduinos, but don't have much cash at your disposal, then look no further. These RF modules are not only affordable, but easy to use. They are much easier to set up than an XBee, plus you can use them without the need of a special shield. Before you rush out and buy a ton of these modules, make sure that you are not breaking any radio transmission laws in your country. Do your research, and buy them only if you are allowed to use them in your area. There are a few [OPTIONAL] libraries that can be used to help you and your particular project.


I will mention at this point however, that I did NOT use any libraries in this particular tutorial. That's right. I will show how easy it is to transmit data from one arduino to another using these RF modules WITHOUT libraries.

Also if you are looking for an easy way to record the signals and play them back without a computer - then jump to this tutorial.

Video





Project 1- RF Blink


Firstly we need to test if the RF modules are working. So we will design a very simple transmit and receive sketch to test their functionality. We will use the Arduino's onboard LED to show when the transmitter is transmitting, and when the other Arduino is receiving. There will be a slight delay between the two Arduinos. You can solder an antenna onto these modules, however I did not do this, I just kept the modules close together (1-2cm apart). I also found that I was getting better accuracy when I used 3V instead of 5V to power the receiver. While using 5V for VCC on the receiver, I would get a lot of interference, however with 3V, I hardly got any noise. If you find you are getting unpredictable results, I would suggest you switch to 3V on the receiver and move the transmitter and receiver modules right next to each other. Remember this is just a check... you can experiment with an antenna or a greater distance afterwards.

Here are the parts that you will need to carry out this project:
 

Parts Required



 

The Transmitter and Receiver Fritzing Sketch






The Transmitter

The transmitter has 3 pins




 Notice the pin called "ATAD". It took me a while to figure out what ATAD stood for, when I suddenly realised that this was just a word reversed. It should be DATA (not ATAD). Nevertheless, this is the pin responsible for transmitting the signal. We will make the Arduino's onboard LED illuminate when the transmitter pin is HIGH, and go off when LOW as described in the following table.

 
 



And this is the Arduino Sketch to carry out the data transmission.




Arduino sketch - Transmitter





 

The Receiver



If all goes to plan, the onboard LED on this Arduino should light up (and go off) at the same time as the onboard LED on the transmitting Arduino. There is a chance that the receiver may pick up stray signals from other transmitting devices using that specific frequency. So you may need to play around with the threshold value to eliminate the "noise". But don't make it too big, or you will eliminate the signal in this experiment. You will also notice a small delay between the two Arduinos.


 

Arduino sketch - Receiver




When a HIGH signal is transmitted to the other Arduino. It will produce an AnalogRead = 0.
When a LOW signal is transmitted, it will produce an AnalogRead = 400.
This may vary depending on on your module, and voltage used.
The signals received can be viewed using the Serial Monitor, and can be copied into a spreadsheet to create a chart like this:




You will notice that the HIGH signal (H) is constant, whereas the LOW signal (L) is getting smaller with each cycle. I am not sure why the HIGH signal produces a Analog reading of "0". I would have thought it would have been the other way around. But you can see from the results that a HIGH signal produces a 0 result and a LOW signal produces a value of 400 (roughly).





Tutorial 2

In tutorial 2, we will receive and display a signal from a Mercator RF Remote Controller for Fan/Light.


Tutorial 3

In tutorial 3 - we use the signal acquired from tutorial 2, and transmit the signal to the fan/light to turn the light on and off.


Tutorial 4

In tutorial 4 - we use the information gathered in the first 3 tutorials and do away with the need for a computer. We will listen for a signal, store the signal, and then play it back by pressing a button. Similar to a universal remote ! No libraries, no sound cards, no computer. Just record signal and play it back. Awesome !!


 
 



If you like this page, please do me a favour and show your appreciation :

  Visit my ArduinoBasics Google + page.
Follow me on Twitter by looking for ScottC @ArduinoBasics.
Have a look at my videos on my YouTube channel.


 
 

 
 
 


However, if you do not have a google profile...
Feel free to share this page with your friends in any way you see fit.




© Copyright by ScottC

Comments

  1. Replies
    1. Nice!!!
      One question....
      Say I wanted to boost the power on the Transmitter so the wave can penetrate a wall or some soil (like a planter box) how would I do it?
      Is it possible?
      Alright, I suppose that's two questions.
      One more....
      Is the frequency of 433Mhz too high of a frequency for Soil penetration? Should it be lower?
      Thanks for the help, and your time Scott.

      Delete
    2. Hi Rob,
      Your questions are way above my level of expertise.... I am by no means an expert in this field... However, I was able to transmit to the fan/light from another room. And from my quick search on google, I would say that the frequency is too high. You would have better success with lower frequencies. As for transmitter power, you would see what voltage you could apply. I found that a greater voltage gave me greater distance, however, you would have to look at the data sheet to see just how high you can go. Not sure why you need to penetrate the soil, would it be possible to bring the RF module up/out into open air?

      Delete
    3. Hi Scott,
      Thanks for the reply!
      I managed to connect a Home Made Yagi to the Receiver Module and received good results. The Yagi is built for a 433MHz Band, and is a Directional Antenna opposed to an Omnidirectional, so the energy transmitted/ received is directed.
      The Gain is 7.1DB, so the Band is still wide but still focused, this way more distance can be gained with lower Transmit Power.
      So far I've learned lots from this project, I have more notes on my website if interested.
      Thanks for the help Scott.
      let me know if you want the link.

      Delete
    4. Hi Rob,
      That is great news.
      Yes I would love to see your project.
      Feel free to post a link below

      Delete
    5. Here it is!
      http://www.whatisacnc.com/pages/Antenna-Radio.PHP

      Delete
    6. That is cool. I could not tell if you managed to get it to find gold or silver ?
      I could not tell from the results at the end?
      Did it work ?
      Anyway - I thought the project concept and idea was brilliant.
      If I get time one day - I might try to replicate your project myself.

      Thanks for posting your project link above.

      Delete
    7. Can you tell the maximum voltage for the transmitter and the reciever.

      Delete
    8. A 2 second google search suggests that the maximum voltage for the transmitter is 12V, and the receiver is 5V. But it would be best if you check the datasheet or ask your supplier for that information, because you cannot always trust google.

      Delete
  2. thankyou for breaking it down so simply!

    ReplyDelete
    Replies
    1. I got it working on trinket transmitter and arduino receiver exactly as you laid it out here.

      Delete
  3. RF tech dose not working with Tx and Rx ?

    ReplyDelete
    Replies
    1. Hi Fazlul,
      Am not sure I understand your question.

      Delete
  4. why does the receiver have 2 data pins?

    ReplyDelete
    Replies
    1. Cause you can connect it to more than one Microcontroller (for example it's easy to connect receiver to two Arduinos without a breadboard!).

      Delete
    2. Antenna diversity and error correction, as it uses ASK modulation, we can use two data pins to correct errors in data

      Delete
    3. I think the author has misunderstood and the "Data" pin they are using is actually a RSSI (signal strength) pin. The real "Data" pins on these devices always put out digital signals and you don't need the ADC to read them.

      Delete
    4. Thanks Anonymous. When I made this tutorial a while back, I had no idea how this module worked, so I used a bit of trial and error to help me understand. You can tell from the signal pattern that the output is digital, the analog pins help to confirm this.

      But I would like to know a bit more about your statement that the "data" pin is actually a RSSI pin.
      How is the signal strength determined from this pin, and how is it that I can transmit "Data" through this pin? Please elaborate, as I would like to know more about how this thing works.

      Delete
  5. Hei, thanks for your nice tutorial. I was initially thinking about bluetooth communication between two Arduinos. How is it different when you use 433mhz rf module? (I know that you don't kneed a shield...)

    ReplyDelete
    Replies
    1. 433mHz modules can have a longer range if you choose to use a wire antenna.
      I would say that using RF is easier than Bluetooth, however it depends on what you are trying to do. If you are trying to communicate between one Arduino and another, then I would personally choose the RF option. If you want to control an Arduino with your phone, then I would choose Bluetooth. It really depends on what you are trying to do and the maximum distance required between devices.

      Delete
    2. Hi Scott,

      thanks for the tutorial.

      I tried things out but get some results I would not expect.

      On my receiver the LED is constantly on and only goes off for a very short period of time (20-21 values in the serial monitor) when the transmitter starts to send.

      I tried different RF modules and arduino boards but it is always the same behaviour. The transmitter and the receiver are very close to each other (about 1 cm).

      My frequency counter (from gooit) shows a frequency of about 433.9MHz during the hole sending time of the transmitter and the LED is constantly on while the transmitter sends and constantly off when the transmitter does not send. So the transmitter should work well.

      Do you have any idea what the problem could be.

      Thanks and kind regard
      Michael

      Delete
    3. Check to make sure you are not near an interfering source. Keep the receiver away from other electronic items. You may want to try a transmitter and receiver of a different frequency (e.g. 315 MHz) - depending on where you are in the world, I think the 315Mhz frequency is more common in the USA...

      Delete
  6. Have you tried changing the LOW output time to a constant, like the HIGH value is? rather than using i?

    ReplyDelete
    Replies
    1. Yes I tried - however, I designed the variable LOW output time to easily differentiate the two signals being received - that's all.

      Delete
  7. an idea about "DATA" vs "ATAD" : one is reverse of the other. Perhaps, this is because 1 level is UP (for DATA) and DOWN (for ATAD module).

    ReplyDelete
    Replies
    1. I am not sure what you mean ?

      Delete
    2. That's what I was thinking. It isn't backwards, it is upside down, signifying that the signal is inverted.

      Delete
  8. The tutorial very good...
    But, how with use KYL 210
    Please help me, i need coding and tutorial...
    Thanks Master

    ReplyDelete
    Replies
    1. Hi Pances,
      I don't have that module.
      Best to ask that question in the Arduino Forums. Perhaps someone else has already gone through the process.

      Delete
  9. Hi Scott,
    i have a 17 dof robot controlled by a torobot usc32 servo controller, running the torobot software through a usb cable. i have two arduino megas and the FS1000A tran/rec. i have fitted one mega to the robot servo controller,arduino tx to controller rx, a common gnd plus power to each, could you show me a mod to your sketch to run the servos through the FS1000A tran/rec. cutting the usb cable out of the picture.
    thanks Scott,
    regards Peter.

    ReplyDelete
    Replies
    1. Hi Peter,
      Thank you for your question, but these requests are best served on an Arduino forum.
      I get many requests for help, and either don't have the required experience or the time.
      You will find the forums much more useful.

      Regards
      Scott

      Delete
  10. hi i understood what u have posted, and i need to use many reciever with one transmitter with the same arduino, how can i do this, explain

    ReplyDelete
    Replies
    1. It depends on what you are trying to do? And why you would use many receivers on the same Arduino... This does not really make sense to me??

      Delete
  11. Hi Scott, a very clear tutorial. I understand you are tight for time, but I wondered if you thought it was possible for the LED connected to the receiver to get brighter after each signal from the transmitter?

    ReplyDelete
    Replies
    1. Yes - that would be possible. When the signal goes above or below a certain threshold, you could make the LED get brighter. You would have to use PWM to achieve this.

      Delete
  12. Hi
    Do you know if these ca be used on the 868MHz band?

    ReplyDelete
  13. I am not sure. It seems like it was made specifically for the 433MHz range,and I would not know how to change it.

    ReplyDelete
  14. Very helpful tutorial Scott. Thank you for sharing!

    erco/ parallax & picaxe user

    ReplyDelete
  15. Hi.

    Your tutorial is very usefull
    I was using serial communication by this module, and it's failed.
    Could you tell me why you use analoug input?

    One request:
    Could you make a tutorial for nRF24L01(+) 2.4GHz Wireless Transceiver module?
    It's using SPI communication

    Thanks a lot
    http://yoyosukardi.blogspot.com

    ReplyDelete
    Replies
    1. Hi Yoyo,
      I use analog input so that I have full control of the threshold value.

      Thank you for your request, however, I do not have those components. But if I ever buy them, then I will look into it.

      Regards
      Scott

      Delete
  16. Nice work. Thank you for putting this together for newbies like me.

    ReplyDelete
  17. Hi, Can the Arduino boards be removed once the programme and link is established? Will it still work?
    Sorry if this sounds like a strange question...

    Thanks, Ste

    ReplyDelete
    Replies
    1. Not sure what you mean... but if you are asking if the RF modules will still work without the Arduino boards, then the answer is no.

      If you are asking if the sketch will still work if you disconnect the Arduino boards from the computer, the answer is yes and no. Yes, the code will execute, but there are Serial commands which will be useless. But you could write the signals to an SD card instead, or use some other method to capture the signals ??

      Not sure if this answered your question.

      Delete
    2. Scott C. Thanks for that. I was asking if it will still work with arduino removed. Question answered, thank you.

      Delete
  18. Hi there...
    This is the only SKETCH for RX and TX that worked for me...

    I my trying to make this work with a VirtualWire library , but there is no way to do it....this is my code..

    this is a link from the code that i am trying to get it work with the XY-MK-5V 433Mhz RF Receiver AND FS1000A/XY-FST RF 433Mhz Transmitter

    http://forum.arduino.cc/index.php?topic=296564.new#new

    ReplyDelete
    Replies
    1. I have no experience with the virtual library. However, my advice would be to start with the basics. Start small, and get the basic functionality working. Then start adding complexity step by step.
      Right now, you have so many places where your sketch could be failing, so go back and start with a simple sketch and then go from there.

      Delete
  19. I am working on a project-sign language translator.So I am using flex sensors to gesture various alphabets.Thus I need to transmit these alphabets wirelessly and display them in another ARDUINO UNO.Could you help me with the coding part for transmission and reception ?RF module:WX-TX-01 and WS-RX-02.

    ReplyDelete
    Replies
    1. Hi Roshan,
      I don't have those sensors, but you can post this to my forum section and I will do my best.

      Delete
    2. @roshanBalachandar
      hello, i do have the same problem. in my case i will be using 434MHz RF transmitter , so can you plz provide me the logic and code of the problem

      Delete
    3. Please post your own project related questions in the forum.

      Delete
  20. Thank you Scott for the nice and helpful tutorial.
    Can we use this device for two way communication? So the reciever will send back the data to the transmitter after reiceving it.
    I need to measure time interval for the data transferring between them, to see how fast and how much packet size can be send.
    to know about the maximum data and speed.

    Thanks

    ReplyDelete
    Replies
    1. Hi Nabeel.
      You would need two transmitters and two receivers to have two-way communication between two arduinos. The receiver module only receives - it does not transmit.
      If you want a module that transmits and receives - you will need to search for a "433Mhz transceiver".

      As for the speed and packet sizes that can be sent on the modules that I have - I am afraid that is beyond my knowledge level, and you would have to research the datasheet for that one.
      However, I have read that the success rate of data transmission between Arduino's can be hit and miss (especially as the distance increases). Some people get really frustrated, and spend quite some time trying to sort this out.
      As you can see from my 4 tutorials on these modules, my end goal was to copy the RF signal from my RF remote. And it worked very well for this project.

      Delete
  21. Is t possible to send a fixed code to the receiver to eliminate the noise ( so the receiver only reacts on that code) I can't figure it out . Pleaze help

    ReplyDelete
    Replies
    1. Hi Wesley,
      I am not sure how sending a code will eliminate noise.
      My guess is that the noise will still be there.

      Have you looked at the VirtualWire or RadioHead library ?
      http://www.instructables.com/id/RF-315433-MHz-Transmitter-receiver-Module-and-Ardu/?ALLSTEPS

      http://www.airspayce.com/mikem/arduino/RadioHead/

      If these do not help and you want to start from scratch, then you could look to send a code to the receiver, but I would send it multiple times and maybe with some sort of checksum method to ensure that you have received all the data. The trick is how do you let the transmitter know whether you have been successful or not in receiving it's message.

      Hard to know the best way to tackle your issue without knowing your setup/layout/requirements/equipment etc etc. These problems are always best served in a forum.
      If you need further help - then either post in the ArduinoBasics forum - in the section called "Help me with my project" - and I will try my best to help you when I can. But if you really want some good help, then look to the Arduino forum

      Delete
  22. Hi, Im doing a project using RF module to track a parked vehicle. I need some assist.

    ReplyDelete
    Replies
    1. Hi Colin,
      Post your query in the ArduinoBasics forum in the section "help me with my project".
      I get a lot of requests for help, and will try my best to help you in some form or fashion.
      But please do not expect me to write out your code for you. You will have to do most of the work/research/coding yourself. I will give advice or guidance where I can.
      If this is not suitable, then I recommend the Arduino Forum.

      Delete
    2. Hi Colin,
      Just letting you know that I rellocated your post in the forum to the "Help me with my project section"
      Regards
      Scott

      Delete
  23. Hello Scott,
    Thanks you for this nice tutorial and the help that you provide in comments.
    I have a Raspberry Pi, 2 ATtiny85 and the same 433 Mhz reciever/emitter as you.
    I can programs my 8Mhz ATtiny throught the Raspberry with arduino libs (it works fine for blink led or Serial.println("Hello") with the raspberry at 2400bps) but when I use your program or other "Virtual wire" program found on the web it not work at all...
    The reciever analog value is extremely noisy (0, 100, 600, 32, 200, ...) where ever I am. And whatever I send with the emiter 1 or 0, it dosent seem to affect the reciever.
    Technicaly, both reciever and emiter VCC are plug on the 5V GPIO of Raspberry. GND on Raspberry GND and data each on a pin of one of the two Attiny85.
    Do you have any idea of the potential mistake ?

    And could you please tell me if it works for you if you do this scheme without microcontroller or Arduino :
    Emitter VCC (5V) GND (GND) DATA (5V)
    Reciever VCC (5V) GND (GND) DATA (resistor -->LED --> GND)
    Led must be ON 100% of the time, right ? (in my case led blink randomly)

    And
    Emitter VCC (5V) GND (GND) DATA (GND)
    Reciever VCC (5V) GND (GND) DATA (resistor -->LED --> GND)
    Led must be OFF major part of the time (noise) , right ? (in my case led blink randomly)

    Thanks :)

    ReplyDelete
    Replies
    1. Hi Damien,
      I am not sure what you mean that when you use my sketch, that it does not work at all?
      What doesn't work ? Are you getting high and low signals ? How is it that you can get a blink sketch to work and not this sketch (which alternates the high and low signals like a blink sketch).
      Also, when using these modules, I too experienced some interference and noise. So I reduced the voltage of the receiver to 3.3V. I think the noise issue is a common one with these modules - plus it also depends on where you live. You may need to opt for a different frequency depending on your country.
      From what I have read, and from what I have noticed, is that people are trying to use them in a way that is different from what they were designed to do.
      When I transmitted signals from my remote control to my receiver, I had no issues. When I transmitted that recorded signal to my fan's receiver, I had no issues. But sending a high value or low value for an extended amount of time, seems to cause issues. So rather than try to see if it is working by sending a continuous high or continuous low signal... try sending a sequence of highs and lows in quick succession, and repeat this signal a number of times.
      I might try and write a tutorial to explain this better, but it won't be for a couple of months, because I am in the middle of some other projects.

      Delete
    2. Thanks for your quick answer, I'm from France.
      When I talk about "blink" it's just to say that I succed to program my ATtiny with the "hello world" program for a microcontroller : flash a LED on a pin...
      So when I use your program my LED flash very quickly without any reason... (Same effect if I disconnect the emiter, and same effect if I connect the LED directly to the data of the receiver). So I get high and low signals but randomly.
      So I will try to turn ON and OFF the emiter quickly, witch delay do you advise me, 200ms ?
      I will try also to reduced the voltage of the receiver to 3.3V.
      Can I do something on these modules to change frequency ?
      One more important thinks... I am not using antenna because module are 5 cm far away and I am not very good with soldering iron. Do you think it could be the problem ?

      Delete
    3. Ok - I understand.
      Instead of modifying the frequency of the module, I meant for you to get a different frequency module to try out (eg 315Mhz or something else)... but not sure if that will help you or not.
      You will get interference on the receiver due to the variable gain. You might benefit from reading this site.
      However, I overlooked that you were using an ATtiny. I don't have one of them and have never used one of them. Do you have an Arduino UNO that you could use to test the RF modules ? This may eliminate some of the guess work you are doing at the moment???
      And I just read this blog post from a person who might be having the same problems you are - and my guess is that you might want to reconsider your choice of microcontroller.

      If you want to communicate between the two modules at a distance greater than 5cm, then yes - I would highly recommend for you to use an antenna on the receiver. My transmitter was able to transmit a signal to my fan at quite a distance without an antenna, however if I were to add an antenna, I am sure the distance would be greater.

      As for the the amount of delay to choose... I would say, start low (20ms) and then increase it. If you have a potentiometer or button that you can use to modify the time in your program, it will save you the hassle of uploading and re-uploading for every change in time.
      The serial monitor is also very useful for this type of troubleshooting.

      Delete
    4. However - you might also want to look at this instructable. They seemed to get it to work.

      Delete
    5. No arduino for the moment... just a Raspberry, 2x Attiny and some cable, led, ...
      Thanks you for all this stuff, I will try all this !

      Delete
    6. All works fine !
      Problems was :
      My first ebay receiver was broken (maybe my mistake :-) )
      Second, the antenna is mandatory... without, even few centimeters, it not work at all.
      I have bought it here : http://r.ebay.com/zyjuge 10 for 1.5 € delivery fee included.

      Delete
    7. Good to hear that you got it to work. I have heard a few people mention that their receivers did not perform, however when purchased elsewhere it worked fine (like you have just experienced)... I think there must be a quality issue in manufacturing these cheap devices.

      Delete
  24. Hi scott c , I highly appreciate your video , i have used the same code but including the virtual wire library to it and i have use one arduino uno and an arduino mega the code did compile everything but at the it didn't work .
    well i need a bit of help , can you guide me how i can use RFID to trigger an servo onto another arduino , your guidance would highly be appreciated.

    ReplyDelete
    Replies
    1. I have made my reply on the forum post you submitted.

      Delete
  25. Thank you for this tutorial. I have been using the virtual wire libraries, but i believe that a project should be as simple as possible without sacrificing functionality.

    ReplyDelete
  26. if two rm module is used in same location then is there may b interfearence?

    ReplyDelete
    Replies
    1. Yes. So you would have to either identify the transmitter in some way or use different frequencies.

      Delete
  27. here is it possible to catch a signal if the distance is 10m?
    we are going to transmit different data signals from several transmitters? These data signals should be caught by one transmitter. one proper data signal is enough to be caught from one transmitter
    How should i do that?
    Please Help..!!
    Thank you

    ReplyDelete
    Replies
    1. Hi Niranga,
      I assume you mean to catch the signal using a receiver ?
      Is it possible to catch a signal if the distance is 10m? The answer is: it depends.

      It depends on:
      1) Frequency being used.
      2) Objects/walls/obstructions or clear path
      3) Antenna being used or not (on transmitter and/or receiver)
      4) Signals being sent at different times or at the same time
      5) Strength of the signal being transmitted (ie. power of the transmitter)
      6) Length of the signal being transmitted
      7) Interfering signals from undesired sources
      I am sure there are other factors, but I think you get the point.

      How should you do that? First try with one transmitter. If that works, then try more.
      Please help: well I'm not sure if that helped, but my tutorials might. Try them and see how you go.

      Delete
  28. Hi,
    Quick question, what's the point of the rolling LOW signal value, are you experimenting with some sort of analogue signal or just seeing how it reacts? (it seems overly complex for the simple on/off scheme I thought it required).

    How do you handle the clock speed of the signal? it seems like you would need to make sure that RX and TX devices both clock bits out at the same speed?

    ReplyDelete
    Replies
    1. Hi Mitchell,

      This was just an experiment to test the transmitter and receiver.
      Without really knowing how these modules worked, I thought that I would just send a signal using the transmitter and just listen with the receiver to see what would happen.
      By sending a typical blink pattern, I noticed that when I sent a high signal, the receiver would provide an analog reading of zero, and a low signal would produce an analog reading of around 400. This seemed very anti-intuitive to me. So then I thought, maybe there is a delay, and that the high signal is actually producing a value of 400 ?? So how could I test this ??
      I decided to change one variable - and keep the rest constant. I changed the duration of the low value, and kept the high value duration the same... and you can see the results in the chart above....
      My end goal was to receive a signal from my RF remote (store this signal), and then play it back. I managed to do it in the end, but you have to read the other tutorials to see how.

      Delete
  29. Hi,
    Thanks for the sharing!

    I've followed your idea exactly, however the receiving LED is flashing when the transmitter LED is off, Do you know how can I avoid it as it's sign of noise.

    Suli

    Cheers!

    ReplyDelete
    Replies
    1. Hi Suli,
      You may get some noise with this sketch. The Receiver will increase it's gain automatically until it receives a signal. So to reduce noise, you should transmit at a faster rate or perhaps change your location and move away from interfering signals.

      Delete
  30. Hello! Thanks for your tutorial!
    I´m kind new with arduinos, but I was thinking of using just one arduino with the transmitter, and none with the receiver. The receiver would simply connect to a led, and depending on the information that arrived it would blink or just turn on and off, for example. Is that possible?
    Thanks in advance!

    ReplyDelete
    Replies
    1. If I only had one arduino, I would do it the other way around. I would transmit without the Arduino and attach the receiver to the Arduino. I am not sure if the receiver would be able to drive an LED... it might be able to, but I haven't tried. I guess it depends on what you are trying to transmit, and why you would want to do this?


      Delete
    2. I´m trying to communicate wirelessly a pushbutton to an electric toy. But I wanted the pushbutton to work under different modes, for example working while pressed, or starting to work when pushed, stopping x minutes later.... But I´m not sure if the receiver would receive that information if i don´t use an arduino...

      Delete
    3. As you can see from my tutorial, when you apply voltage to the transmitter, the receiver will respond accordingly. If the electric toy has an RF receiver built in, then I would use the Arduino on the transmitter side. If you wanted to trigger a push button on the toy, you could possibly do all of this without an Arduino altogether, however, you may get false triggers through interference. While my tutorial makes it look like the receiver will only trigger when the transmitter sends information, this is not true. It will also trigger when it picks up stray signals from other devices or electrical equipment. I don't think these modules were designed to work in the way you imagine it to... as the receiver will increase the gain and become more sensitive to stray signals if it hasn't received anything for some time...
      So I personally think you would need two Arduino's for this to work properly, and you would have to send a sequence of commands which the receiving Arduino would have to interpet, decode and then act in the way you want it to.

      Delete
    4. I was just thinking of use one, to reduce costs and space in the toy.. But I understand what you´re saying. Thank you very much for your answer!

      Delete
  31. Thanks Scott, for such a simple solution. I have noticed that It works better with:

    else if(data<lowerThreshold) { ... rather than

    if(data<lowerThreshold) { ...

    for the receiving end for lower threshold check, eliminating some noise.

    ReplyDelete
    Replies
    1. Hi Kadir,

      Thanks for the tip, however, can you explain how your modification would change the outcome?
      For example, if data=0, both statements would trigger
      If data=40, neither statement would trigger...

      If I were looking to eliminate noise, I would modify the range of the upper and lower Threshold values, but I can't see how your modification changes anything?? Maybe I am missing something? But I am interested in what you have to say.

      Delete
  32. Hello , are these rf modules compatible with Arduino 2 (3,3V) or UDOO? Thank you

    ReplyDelete
    Replies
    1. Hi Sergio, As per the manufacturer website, it appears that it needs at least 3.5V, but normal operating voltage is 5V.
      Having said that, I found that the receiver worked fine at 3.3V, the transmitter may be a different story.

      Delete
  33. Can you please tell me if we use multiple transmitters to transmit a signal to a single receiver can there be any interference or data loss? can you give me an idea about how many channels are in transmitters and how they work in an above mentioned scenario ?

    ReplyDelete
    Replies
    1. Hi Niranga,

      The receivers are indiscriminate. Meaning -> If you send a signal at that frequency, it will receive it. It will receive stray signals from other sources also...
      So if you you are using multiple transmitters, you will need to ensure that they are not transmitting at the same time or are using different frequencies..... similar to a walkie-talkie.
      If you are transmitting at 2 different frequencies, you will need 2 matching receivers.

      Can there be data loss - yes - of course... there can be data loss even with one transmitter.
      Will it get worse with two ? Depends on whether the signals over-lap or not.

      Delete
    2. Thank you very much for the information. This means a lot to me
      i also want to know that is there a specific number of channels in the transmitter. I saw somewhere that there are 4 channels. if there are channels. so transmitters can use different channels to transmit. Am i right ? (I'm not sure)
      So if i transmit the signal with different delays in different transmitters. Will it solve the problem ?

      Delete
    3. I don't know anything about the number of channels. You would have to ask the site where you read that... I am guessing there would some additional hardware required, but that is just a guess. With regard to the delays, I am not sure what you are doing or how you are hooking these transmitters up? But as long as each transmitter transmits their complete signal un-interrupted by any other transmitter/signal you should be fine. The way that you choose to do this will depend on your particular set-up and personal preference.

      Delete
  34. How can I use that module to remotely control a device or switch on/off an led?
    or
    How can I use the transmitter as a remote control for the receiver?

    Please Help Me! Im just a student and I really need this for my project....

    ReplyDelete
    Replies
    1. Any requests for help or questions about your own project are best served in the ArduinoBasics forum

      Just copy and paste your query into the forum, and we can discuss further.

      Delete
  35. hi scott i want to a project on arduino which sends the alert message when the sensor senses the object via rf module to another arduino which sends the alert message to java front end application on computer

    ReplyDelete
    Replies
    1. Hi Vishal -
      This particular tutorial is not geared towards that kind of communication.
      If you would like help with your project - please post your question in the ArduinoBasics forum
      I don't have time to write code for you, but I am happy to point you in the right direction.
      Just post your circuit connections and your code to the forum - include pictures (<2MB) if you like... and I will guide you...

      Delete
  36. it didn't work for me , i had tried changing the value of the upper and lowerThreshold value. while the transmitter led lights up , the receiver will receive messy data and start to blink crazily , sometimes it will start blinking even though the transmitter if OFF. what should i do :(

    ReplyDelete
    Replies
    1. These Receivers are very sensitive to noise. They will increase their gain until they receive a signal. You could try to connect it to a digital pin instead of an analog pin... also you want to transmit data as soon as possible, to limit the amount of noise.

      Try powering the receiver using 3V instead of 5V. This also helps to prevent noise.
      Also reduce the delay value to a number that is smaller. These receivers were not really designed to undergo this blink sketch that I designed... they are better with a much faster rate of data transmission.

      Delete
  37. very usefull tutorial. thanks
    in my case, it work upperThreshold=900 lowerThreshold=895

    ReplyDelete
    Replies
    1. Yes - some modification to the code may be necessary to suit your specific module.
      Thanks for the feedback.

      Delete
  38. Hi Scott

    I have a problem in testing my Rf Trans. and Rec. I followed your connections and used your code. On my transmitter Arduino the LED blinks as programmed. But in my receiver the LED just keeps on blinking randomly, the Serial monitor shows
    0
    0
    0
    0
    703
    301
    700
    0
    0
    0
    704
    701
    470
    0
    0
    0


    And goes on. I tried turning off my transmitter Arduino and no changes were found in Transmitter side, Then i tried removing the data pin(A0) of transmitter the LED was stable, connecting if back i removed the power wire(vcc) of transmitter and LED went off. What is the problem?

    -> I checked the connections, no wiring mistake was observed
    -> Codes are same as yours
    -> The trans. and rec. module is brand new from ebay.
    -> The distance between trans.and rec. is less than 1cm

    PLEASE HELP!!
    Thank you!
    Regards!
    B.Aswinth Raj

    ReplyDelete
    Replies
    1. Hi B.Aswinth Raj,
      You may get some noise with this sketch. The Receiver will increase it's gain automatically until it receives a signal. So if it blinks as expected while using the transmission sketch, that is all you need at this point. It just checks to make sure that you are able to transmit and receive. Continue onto tutorial # 2.

      Delete
  39. Hi Scott,

    I bought different transmitter (SYN115/F115) and receiver (SYN480R) modules on eBay. Both modules work at 433MHz but look different from your modules. Your instructions still work.

    I wanted to have something quick and easy to verify that the modules are working.

    Thank you.

    ReplyDelete
    Replies
    1. That is good to know - thank you for your feedback Anonymous !!

      Delete
  40. Thank you for this tutorial. The operating voltage for the receiver seems to be 5V...if it works powered by 3.3V like you did, I should be able to use this RF receiver on Arduino Mini 3.3V Pro ?

    ReplyDelete
    Replies
    1. Yes for the receiver, but not sure about the transmitter.

      Delete
  41. I've found that using a 9V battery pack opposed to using the USB cord show different observations. When the USB cord is plug into the receiver, the LED blinks at a constant rate different to when the 9V battery pack is plugged into the receiver.

    Any thoughts on this?

    I've tested the code and found, at least to my speculation that everything in the code is ok.

    ReplyDelete
    Replies
    1. Most differences that I have observed in terms of 9V batteries vs USB connections have been due to a)grounding and b)current supply

      This article may also interest you:
      https://www.baldengineer.com/9v-batteries-suck.html

      Delete
  42. Hello there. Can someone explain to me about the i=4000? Whre did you get the value? Sorry im newbie.

    ReplyDelete
    Replies
    1. The 4000 was just made up. You can change it to 5000, and it won't make that much of a difference.

      Delete
  43. Hi.
    I have a Mindwave headset from Neurosky.
    It comes with a USB RF dongle and by using a software you can check some brain activity on the computer.
    I don't have the dongle anymore so i want to use an RF module.
    I would like to know which RF module can work with this Mindwave headset so that i can directly connect it to an Arduino without using a computer.

    Regards,

    ReplyDelete
    Replies
    1. You will need to check the RF frequency being used.

      Delete
  44. I wont to connect two Rf transmitter to one Rf resever !! Every transmitter is connected to button.. and the recever connected to the arduino .. and the arduino connected to the lef...
    One button is On a d the other is off...
    How can i do that ??? Help please

    ReplyDelete
  45. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. I don't think I understand what you are trying to do ??
      Do you want the Receiver to turn an LED off when it receives a HIGH signal ? Or do you want it to blink when it receives a high signal ? What happens when it receives a low signal? What do you want it to do then ? Or will the signal always be HIGH? If you could explain a bit more, maybe I might understand.

      Delete
  46. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. I would send a combination of highs and lows very quickly.
      Or I would actually transmit a number or letter repeatedly.
      If you do not receive the expected signal or letter or number within a specified time-frame, make the LED go high.

      Delete
    2. This comment has been removed by the author.

      Delete
    3. That will be a long wait. Have a go at writing the code yourself, and see how you go.

      Delete
  47. It's weird how your analogRead function works. I'd think you should get a value between 0-1023 since the arduino ADC has a 10-bit resolution. Of course, maybe for the HIGH state you're not gonna get 1023 but at least anything north of 600. I don't know why you get a 0 reading. Interesting!

    ReplyDelete
  48. Is the output of the data pin on the receiver side (in terms of power) proportional to the power received? I ask because you are using analogRead, and if the receiver had some type of symbol detection I'd think you should get a clean 0 (0V) or 1 (3.3V) and there shouldn't be a need to read that with analogRead. Also, since the arduino UNO by default uses a 5V reference for its ADC, the max value using analogRead should be 676 since your receiver runs off a 3.3V supply. And it is weird how HIGH is read as a 0 instead of something more like 500.

    ReplyDelete
    Replies
    1. Hi Sixto,
      When I get some more time, I will be revisiting this project. I don't know why I get inverted values for highs and lows when transmitting really slowly. I think when transmitting a signal in the correct manner, the readings should be as you would expect them to be... And I used analog readings out of curiosity. You could use a digital read if you wanted to. This was all just an experiment / proof of concept - and it seems to work :)

      Delete
    2. Good, I was just curious about it since I might use something like that for a project I am thinking about. Keep the good work up!

      Delete
  49. Hi ! thank you for the tuto ! here is my probleme, I'm trying, by using your first two programs to transmitt not an analog signal but int, I'm working on a project that transmit the values of a ECG and I'm wondering what is supposed to change in the programs. Thank you for this help (and sorry for the bad english ^^).

    ReplyDelete
    Replies
    1. Hi Anonymous,
      One day I will get around to using this module to transmit values to and from an Arduino... but that is a whole other tutorial. There is no way I am going to try and do that in these comments. My advice is to treat the module like you would if you were using a piece of wire to communicate between arduinos, and use serial communication to transmit between the two. I am sorry - but that is about as much detail that I have time to give you... I am sure others on the internet have done what you are trying to do... but the method used in this tutorial is not the one I would use for your project.

      Delete
  50. This project :http://dreamgreenhouse.com/projects/2016/433/index.php referenced my tutorial.

    It is interesting to see how they took my tutorial and moulded it to suit their own needs.... This is what a community is all about. Helping each other achieve their goals !

    ReplyDelete
  51. What a great tutorial for such a useful set of tools! Well done! I'm doing this in C but I find most of the C tutorials are generally written by people who are full of themselves..haha. What a breath of fresh air!

    ReplyDelete
  52. Scott C's tutorial, this tutorial and the gold scanner tutorial linked above are some of the most level headed no nonsense nicest cleanest MCU tutorials I have come by!!! This topic is so crucial to MCU projects but never properly addressed. I couldn't find the datasheet for these rf links online and luckily landed here. Having gone the C route I often find only salty high horse C programmers who shoot down questions that are asked because of lazily written tuts. You all are what makes this stuff great! Bravo guys!

    ReplyDelete
  53. My RF's signal can't go any further than 10 cm plz help

    ReplyDelete
  54. Will the arduino setup work with different transceiver system at different frequency (13.56MHz)?

    ReplyDelete
  55. Is it possible to use one arduino uno for both transmitter and receiver? Also will the code work for other systems at different frequencies?

    ReplyDelete
    Replies
    1. You could set it up so that the one Arduino transmits and also receives. However, you would need to have a system whereby the Arduino would need to know when it was expecting to receive information. But it could be done. Just take it in turns transmitting and receiving. e.g Send message, await for acknowledgement. If timeout - send message again. etc etc.
      If you are asking this question to see if you could transmit a message to itself - then I would say there is no point in doing this.
      Can it work for different frequencies - well - in the parts section, I did mention that this should work for both the 433Mhz and 315Mhz frequency. I have not tried it with the 13.56MHz frequency - but perhaps if you do, then you could let me know. But the transmitter and receiver pair need to be at the same frequency.

      Delete
  56. I m having trouble with blinking that is by the noise I cannot get what I want to have... I m transmitting something and I m getting it but these noise are making my output rich of errors.. I have tried alot of codes but still I m bot satisfied... Plzz help me out ..

    ReplyDelete
  57. Would hooking up an led (+1k resistor) off the data op of the receiver kill it? I only get readings less than 10 off the analog pin.

    Gone through 2 pairs now and neither work. At 5v and 3.3v

    ReplyDelete
    Replies
    1. Hi Chris - when you say you get readings less that 10 - is that with or without the LED connected to the data pin?

      If you have it set up in the same way that I have - then there are 2 possibilities:
      a) The type of module you are using is different from mine.
      b) Possibility of faulty module.
      c) Double-check ALL of your connections

      How are you powering the Arduino?
      Are you using an antenna?
      Distance between transmitter and receiver?
      Frequency of the module?
      Does transmitter frequency match that of receiver?

      Not sure if hooking up an LED directly to module would work. Depends on the LED and your specific module - any reason why you need to do it this way - as opposed to the way I describe in this tutorial ?

      Delete
    2. Also - perhaps try a lower value resistor attached to LED - like 330 ohms?

      Do some experiments with analogWrite and find out the value at which the LED will (visually) turn ON or OFF. This may help you to choose the right resistor for your application.

      Delete
    3. Hi Scott,

      Thats less than 10 without an LED.
      Arduino is powered off my MacBook
      No antenna
      Transmitter/Reciever distances are (furtherst at the other end of a breadboard, or on top of each other at the nearest)
      433Mhz
      They were bought as a pair so I'd assume they'd match.

      Im not bothered about the LED, just the reading back in to the Arduino sits low.

      Delete
    4. Hi Chris,
      Sending very long LOW and HIGH values as I do in this tutorial is not exactly the best way to test the module. Try to perform a serial transmission (using SoftwareSerial) from transmitter to the receiver, and see if you are able to accurately receive what you sent.
      Make sure to consistently send values in an endless loop.
      I think this would be a better test.

      Delete
  58. Hi Scott,

    Did you ever have problems with getting continuous high readings. My serial monitor just keeps outputting high values even when the transmitting arduino is off?

    ReplyDelete
    Replies
    1. The receiver module has an automatic gain... so if it is not receiving anything, the gain will increase and increase and increase, until it starts to get false positive readings.
      The best way to test the module is with rapid on/off cycles, with very short delays inbetween. One second delays between on and off, are way too long, despite what you see in the video. These modules were not designed to be used in the manner I have shown in this tutorial... but work well when the delays between HIGH and LOW are much faster (as you will see in tutorials 2-4 in this series)

      Delete
  59. Hello
    Thanks for the tutorial!
    is it possible to display the signalstrength maybe on a lcd?
    i cant find any examples :(
    Thank you

    ReplyDelete
    Replies
    1. I don't know how you could determine the signal strength using this module.

      Delete
  60. Hi,

    Very nice tutorial! However, I tried using an ARM MBED board on the transmitting side, where the "high" voltage is only 3.3V. (Your code is easily translated into ARM code.) All I get on the receiving end is noise. Is it the case that the transmitter transmits only rough "high" and "low" signals and that an input of 3.3V for a high is not enough? Or does the transmitter transmit analog levels? Thanks!!

    ReplyDelete
    Replies
    1. Hi Vitit,
      The transmitter is transmitting a digital signal, and there are a couple of reasons you may be getting noise.
      1. Make sure to use an RF module that is suitable for your country.
      2. There may be many devices around you using that frequency.
      3. Electrical interference.
      4. An antenna should help
      5. Make sure that the delay between high and low signals is small. The longer you have the device in HIGH/LOW, the more likely that you will get interference creeping in. In this tutorial, I should not have started with a delay as large as that. It would be better if I used PWM (Analogwrite) instead.
      It is recommended to use 5V on the transmitter. An optoisolator breakout board may be useful here. You can some relatively cheaply from ebay.

      Delete
  61. everything is working fine but I did not understand the use of the for loop iteration in the program . could you please explain it to me.

    ReplyDelete
    Replies
    1. The for-loop provides a constant high signal and a variable low signal. This helps to differentiate one signal from the other.
      I would probably set up this experiment differently now, but it seemed to work fine back then.

      Delete
  62. Thanks for your tutorials! They were very helpful for my project which interfaces my Byron SX doorbell to my Synology NAS and triggers an email/photo to be sent when the button is pressed.

    Using this RF Module connected to an arduino Uno I 'listen' for the doorbell to be pressed. Once the Arduino recives a pressed signal I use an esp8266 running ESPEASY to send a message to my Synology NAS on which I am running Domoticz. I also have a security camera running on my Synology NAS and when Domoticz receives a message to say the doorbell has been pressed it captures an image from the camera and emails it to me.

    The Byron SX doorbells work with a 42 state code (ie 21 high pulses with 21 low pulses separating them). This code is transmitted perhaps 12 or so times every bell push. During this time I am able to capture the code perhaps 6 or so times processing it on the fly. I also have a button on my Arduino that can be held down at power-up and the Arduino then enters a learning mode, looking for the doorbell pattern to be repeated. This makes it easy to learn new bell push codes(which are generated whenever a battery is changed of a different tune on the bell is chosen). The newly learnt code is than stored in the Arduino eeprom and is used as the key when listening for bell pushes in future.

    I run the receiver from 5V as 3.3V only gave me a range of 1 to 2 metres. When running it on 5V I can receive a good bell press pretty much anywhere in the house or garden.

    ReplyDelete
    Replies
    1. That is awesome Nigel. I am glad these tutorials helped you.
      Sounds like a very interesting project.

      Delete
    2. Hello Nigel,

      Interesting your decoding of byron doorbell, could you point me out the library that you used? Or is it a code from your work?
      I'm working on a gateway that integrated different wireless signals with mqtt (openmqttgateway) https://github.com/1technophile/OpenMQTTGateway and one user asked if Byron doorbell could be added to the gateway. I found your comment and was asking myself how you decoded it.

      Delete
    3. Hi Flo
      I don't use any library functions.
      My code is a development of the code and technique used in these tutorials.
      Basically on power-up I look to see if the 'learn' button is pressed. If it is I read the RF module and look for repeating codes (the doorbell push sends the same code around 12 times every time you press the doorbell). Once a repeating code is found I store this in NVR. Then the arduino continuously scans the RF module for the pattern. If it receives a matching code the WiFi module sends a message to my Domoticz server.
      I have spent some time recently playing with the ESP8266. If and when I get time I plan to port everything over to the ESP module and have it do all the work, rather than use the Aduino.
      My code could really do with a good clean-up, but your quite welcome to have a copy of it.

      Delete
  63. Hi Sir Scott C, I can't seem to make mine work. I used a 315Mhz RF module but I've been getting an unstable reading(40-500, randomly) in my receiver. Help? Thanks. Nice video btw. Thumbs up!

    ReplyDelete
    Replies
    1. Getting stray signals in the receiver is not uncommon. Stray signals come from everywhere. Try sending a PWM signal instead. And see how you go. You may want to have a look at my review of the EspoTek Labrador whereby I do a bit more investigating of these RF modules. It may help you understand what is going on.

      Delete
    2. Oh I forgot to say I was trying to make my arduino board as a transmitter and receiver, simultaneously. Do you think it's possible sir? Thank you.

      Delete
    3. Do I think it is possible that this was the reason for your issues or do I think it is possible to have one Arduino be responsible for transmitting and receiving ?

      The Arduino does not multiprocess, so if you plan to receive messages while at the same time send messages, then probably not possible. But if they can occur one after the other, then I cannot see why not.

      Problems associated with your particular project are best served in the ArduinoBasics forum. These comments are only really meant for questions about this specific tutorial.

      Delete
  64. I can't get his transmitter/receiver pair to work - bought 6 pairs and nothing. I have used the code exactly as above and when I directly wire the transmit pin of one arduino to the receive pin of the other - I get the correct behavior. However when I try to use the transmitter and receiver - the receiver either gets low values 0-5 or random noise (values of 500-800). It's not a matter of threshold (as I've now removed that bit of logic and am just inspecting raw receive values via serial monitor). The receiver behave does not change - regardless of what the transmitter is generating.

    I tried as-is and then with antennas soldered on (~ 10 inches). Both the transmitter and receiver are within 2 inches of each other. I'm not an Arduino expert - but I've built quite a few projects without trouble... Any suggestions?

    ReplyDelete
  65. I have had it work really well connecting things to the tx and rx pins on the uart. It does not seem to work over 4800 bps though.
    You need to put the data into a frame of sorts (i used 16 bytes) and add a checksum, because they will constantly receive random data. I used 20cm pieces of wire for the antenna and got well over 30m range.
    If you are just interested in testing them, hook them directly to 2 usb-ttl adapters and open up a serial terminal on 2 laptops.
    cheers

    ReplyDelete
  66. I am trying to setup lesson 1 and have followed all your direction, and I'm fairly sure the receiver part isn't working.
    I have two UNO boards attached to a Paspberry PI 3 and am using the Arduino IDE.
    When I upload the two sketches, the transmitter seems to work, (TX flashing) but on the receiver board, just the on and blinking lights.
    Whe I upload the sketches, I get a stk500v2:ReceiveMessage (): timeout and getsync() timeout errors.
    In the lesson it was supposed to be lib free so I am not sure where the stk500v2 is coming from for starters and am not sure if anything needs to be done to ID separate UNO boards. Is there anything I have to configure to use two boards. How does the sketch know to load on on one board and not the other.
    I am fairly new to this but not programming or electrical engineering so any info would be helpful.
    Thanks

    ReplyDelete
    Replies
    1. Amnot familiar with uploading code from a RPi3 to an Arduino. Not sure if there are any special considerations. Do you have both Arduinos connected to the RPi at the same time ?
      Can you upload to each Arduino independantly. ie. Only connecting one board at a time ?

      Delete
  67. Hello Scott,

    I love your blog and how you present it. In this tutorial, I'd like to know more about RF, and how do RF receiver and transmitter work.
    I wonder if you know any source or book that relate to RF for beginner like me. Thank you so much.

    ReplyDelete
    Replies
    1. No - not aware of any book.
      I learnt everything I know about this topic from "googling around"

      Delete
  68. How could I light up three independent LEDs using this project? Like, is it possible to send a different code of lighting for each one of the LEDs?

    ReplyDelete
    Replies
    1. Questions about your own projects should be asked within the forum section. Thanks

      Delete
  69. IS any library required for this...? If yes, then plz give me the link or something else related to that....

    ReplyDelete
    Replies
    1. Raman,

      Your question is actually answered near the beginning of the tutorial. ????

      Regards
      Scott

      Delete
  70. M goInG to make a simple remote with it and use it as a remote alarm........... its possible or not....???????

    ReplyDelete
    Replies
    1. Yes - possible. But depending on your code - you may get false alarms.

      Delete
  71. Can u send an analog value?? for example the brightness of a LED.

    ReplyDelete
    Replies
    1. Yes - send a PWM signal. Then use the PWM signal to derive the brightness.

      Delete
  72. Hi Scott,

    Great Tutorial.
    Is it possible to add a GSM module on this project?


    Thanks & Regards,



    ReplyDelete
    Replies
    1. Hi Myron,
      I guess so ?
      Not sure if the GSM would interfere with the RF signal in anyway??
      I have never tried, so it would be trial and error.

      Delete
  73. Hi Scott

    I am trying to create an infant security system that will allow the mother to know the location of her child if he gets lost. So I wanted to ask if the radio frequency would allow the mother to track the child if he goes missing by transmitting gps coordinates using a gps module I have? Plus the maximum distance the radio frequencies could reach (I'm talking about 7-8 km)?
    Thank You

    ReplyDelete
    Replies
    1. Using a library - you may be able to accurately transmit GPS coordinates, however 7-8km is unlikely with this particular module.
      If you had an antenna properly configured etc, you would probably not see ranges above 1-2km. I might be wrong about that, but that is my understanding of this module.

      Delete
  74. Hello Scott, is it normal that my DATA PIN on receiver module normally blinking even without any transmission? Thanks

    ReplyDelete
    Replies
    1. Yes - that is normal. The receiver has an automatic gain, that will cause it to pick up stray/random signals. Once you start transmitting with your transmitter, the receiver will "lock" on to the transmitting signal. There is still a chance that it will pick up stray signals, but a lot less likely than when there is actually a signal being transmitted from the transmitter.

      Delete
    2. Yes - that is normal. The receiver has an automatic gain, that will cause it to pick up stray/random signals. Once you start transmitting with your transmitter, the receiver will "lock" on to the transmitting signal. There is still a chance that it will pick up stray signals, but a lot less likely than when there is actually a signal being transmitted from the transmitter.

      Delete
  75. Hello, I have siren alarm with freq 315 MHz. Is it possible to change the Freq to 433MHZ? The receiver module is FY-RX01.

    ReplyDelete
    Replies
    1. If your siren alarm is 315MHz, why not just use the 315MHz RF modules : http://www.icstation.com/product_info.php?aid=10&products_id=1554.
      They are not that expensive, and would be a whole lot easier.

      Delete
  76. Replies
    1. I am not using any libraries in this tutorial. So there is no need to #include.

      Delete
  77. Thank you for the tutorial. I watched the same implementation in the arduino rfid, however, I tried to get this running with a different RF ID card without success. Do you know if there are many different types of cards and if the "newer" standards are more difficult to read or require different hardware?

    Cheers,
    Stan

    ReplyDelete
    Replies
    1. I think RFID is a bit more complicated.
      Look at this page - and you will see what I mean.

      Delete
  78. Hi,
    I would like to use something more compact like only the microcontroller chip rather than an Arduino UNO with the receiver and transmitter. So, could you please tell me if it's possible to program an ATmega328 microcontroller with receiver and transmitter for the Project 1 instead of the Arduino (complete system) in order to make the project more compact, while having the same communication between receiver and transmitter in the end?
    Thank you

    ReplyDelete
  79. The ATMega328 is just the processor that is used on the Arduino and it can be used on its own with minimum auxiliary components. Search for ATMega328 on YouTube for examples. If you want a smaller system the code will run on an Arduino nano. I now have my doorbell repeater code working on a Wemos D1 Mini, and could run it directly on an any of the esp8266 modules that have access to the analogue pin.

    ReplyDelete
  80. Can you please tell me how many PWM, ADC and timers do we use or need for TC and RX code for the ''433 MHz RF module with Arduino Tutorial 1 '' ? and which instruction from the code is for a timer usage, which one for pwm usage and which one for adc usage ? I want to make shure because I am new with arduino and microcontrollers.

    Best regards

    ReplyDelete
    Replies
    1. I would recommend that you read the tutorial, watch the video, and read the code. Make sure you look at all 4 tutorials. These tutorials have a specific objective in mind. Once you go through each tutorial, you will understand my objective. It is not an exhaustive tutorial on how to transmit data via RF. Read the tutorials and you will see what I mean.

      Delete
  81. Hey Scott,

    I followed your tutorial and after completing it I noticed that the LED on the receiving would just blink randomly as though it was picking up random signals is this possible? It would follow the signal of the transmitter and turn on when the receiver sent the signal, but when the receiver sent a low signal the LED on the receiver side would blink.

    ReplyDelete
    Replies
    1. Hi Patrick,
      These RF modules are not really designed to blink an LED like this. Not this slowly.
      You would be better off trying to send a PWM signal from the transmitter to the receiver, and get the LED to fade on and off. When you send a "LOW" signal, you are essentially sending "Nothing". The Receiver module will automatically increase the Gain to re-establish a link to the transmitter. And in doing so, may pick up noise.
      If you send a PWM signal with varying duty cycles - you will have better luck (providing the duty cycle doesn't get too low).
      This is the start of a 4 part tutorial, with the aim to record and play back an RF signal from my RF remote. If you plan to communicate between one Arduino and another, then you would be much better off using a library. As there are some really good libraries out there that are made for this purpose.
      I hope that answers your question.

      Delete
  82. Hi Patrick
    What you describe is correct. There can be (and usually is) a lot of background noise. There are also many other devices that use same band. What you are looking for is a known pattern within this noise. There will be lost of high and low signals but the processor on the receiver needs to look for a predefined pattern of ones and zeros that your transmitter processor has sent.

    ReplyDelete
  83. best way to totally eliminate noise is add 10UF capacitor on receivers DATA and GND pins (Decoupling capacitor).....enjoy

    ReplyDelete
  84. Hi,

    I tried your code&circuit and I am not happy about the result because the led on the receiver side is almost always ON. When the transmitter sends a signal the receiver , the receiver's Arduino led is lit with high power but for some very short period of time. After that, it's lit but with low power even if the transmitter doesn't send a signal. It's only OFF (not lit) for some very short period of time, which happens sometimes ( not always) right after the receiver's gets a HIGH signal from the transmitter. After that, even if the transmitter doesn't send a signal, the receiver's led will be ON (with low power). I was expecting this to be OFF when there is no signal transmission. I don't understand why it's ON (low power) in that case.

    I am interested for the model that when
    1)the transmitter's Arduino led is ON, I would like the receiver's Arduino led to be ON and
    2) the transmitter's Arduino led is OFF, I would like the receiver's Arduino led to be OFF

    However, this doesn't happen with this code&circuit because the receiver's Arduino led can be ON (low power) even if the transmitter doesn't send a signal.( and to me it looks like it's not only because of noise that it's ON since it stays like that for the majority of time)

    Is there a way to solve this?

    Thank you

    ReplyDelete
  85. Hi Scott, great tutorial. I'm trying to replicate the output using similar components, 2 arduino uno, 1 breadboard, 433 Arduino UNO receiver and transmitter. Follow the codes and schematics. But the output is different. The transmitter LED is blinking according to code but the receiver LED is blinking fast. And even if transmitter is not powered on, the receiver LED still blinks fast. I checked through serial print for the receiver and it is reading: 0 0 0 1 0 0 0 7xx 7xx 7xx 7xx 7xx. Why can't I get the same output as in your video? Is my receiver broken? Will it affect the result for part 2, 3, and 4?

    ReplyDelete
    Replies
    1. Probably getting interference.
      It may affect the other tutorials, but it might be ok.
      Try it and see.

      Delete
  86. Hello everyone,

    I realized that delays which are longer than 130 ms are not suitable for this communication.

    When I put one-second delays between led on/off state, there are some uncertain values on the receiver side. And when I observe this using a logic analyzer; 120 ms after the transmitter start to send 1, the receiver falls to 0 automatically while the transmitter is still 1.

    I tried the same example using 120ms delays, everything is ok. It is really synchronous.

    What is the reason?

    ReplyDelete
    Replies
    1. Hi everyone,

      So sorry! I wired wrongly. For transceiver side, analog pin was used; for receiver side, digital pin was used. I wired again and set threshold values, everything is ok!

      However, when I observe the communication via logic analyzer; while D4 pin is 0 during 1 second, there are many peaks like noise. Is it related to RF? When we consider threshold values, it must be normal and related to RF communication.

      Delete
  87. I've LOVED this tutorial! I started working with these modules a few days ago, and this was instrumental in helping me debug and understand what was going on. I realize the original post is over four years old at this point, but it is still very valid and useful. Thank you!

    ReplyDelete

Post a Comment

Feel free to leave a comment about this tutorial below.
Any questions about your particular project should be asked on my Arduino Tutorials Discord Server.

Comments are moderated due to large amount of spam.

Popular Posts