RF based remote controlled car. RF not responding... NEED HELP

Go To Last Post
17 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

I am a newbie and have been trying to make a remote controlled car for a while using ATmega 8 and controlling using a THUMB JOYSTICK and 433Mhz rf module
.
I am using Atmega 8 to do the project. I am trying to use one ATmega 8 as transmitter and a another as receiver.
 

As transmitter , i have connected an ATmega 8 with the JOYSTICK and converted the x and y axis values using ADC conversion. Then transmitted the data and command (for moving the car) to the RX pin of my
receiver ATmega 8. in the receiver I used the command to move the car. I have used L293D motor driver to move the motors of my car,
 

now i am facing a problem. The problem is the communication is perfect when i use a wire between the RX and TX pins of the receiver and the transmitter . But when I am trying to so this with my RF module there
rises problem.
 

When I power up the circuit the transmitter perfectly converts the ADC values but the receiver doesn't get anything. but when I reset the receiver again and again certainly (don'T know when) the transmitter begins to
work and it keeps working. BUT Again if I turn off the power and again power it up, the Receiver is not responding again until I reset it again and again (don't
know how many times) .. Again sometimes the transmitter is hanged and do not response to new signals. It keeps running an older signal automatically..  NEED THE SOLUTION
 

I am using 1MHz internal oscillator and a baud rate of 4800bps. I am using WINAVR(GCC ) as compiler.
 

THE CODES AND CIRCUIT DIAGRAM IN PROTEUS(HERE WIRED DIAGRAM IS SHOWN BUT I USED RF TRANSMITTER IN TX OF TRANSMITTER ATmega 8 AND RF RECEIVER to RX OF RECEIVER ATmega 8) ARE
PROVIDED AS ATTACHMENTS ..WIRED CONNECTION HAVE NO PROBLEM. BUT WHEN IT'S WIRELESS THE PROBLEM BEGINS

 

https://www.techshopbd.com/product-categories/rf/1339/rf-transmitter-receiver-pair-433-mhz-techshop-bangladesh
 

I've been using this product for wireless communication.

Attachment(s): 

This topic has a solution.

fatin

Last Edited: Thu. Aug 13, 2015 - 01:04 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Radio transmissions are inherently prone to interference, fading and other problems - so it takes a lot of effort to make a radio link that's anywhere near as reliable as a piece of wire.

 

You have chosen a very cheap, basic RF module.

 

Two reasons it's cheap:

  1. it leaves it entirely up to you to implement a reliable communication scheme;
  2. the manufacturer provides no support - and precious little documentation.

 

As a beginner, you would be far better to use a more "intelligent" module which does the hard work for you - these cheap ones are intended for experienced users who already know what they're doing, and don't need the support.

 

For example, something like this:

 

http://www.lprs.co.uk/easy-radio/

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

That's always the hard part of learning a new communication: Is it not sending or not receiving or both and how can I tell?

 

Set your RC car programs aside for a while and concentrate on the rf. Make a transmit program that does nothing but send a message once a second or something ultra simple like that. Then make a receive program that toggles a pin when it receives a message. Is the pin toggling? Once you get that working, try sending something in the message, and have the receiver do something different depending on what's in the message. Once you have this working, you know how to work your RF modules and can revisit your RC car program with your new knowledge.

 

There's so much that can go wrong. You just have to eliminate all the complicating factors and concentrate on one tiny piece of the problem till you have that solved, then add another tiny piece of the problem. Sometimes, to solve the 42nd tiny piece of the problem, you have to set the whole project aside and build a tiny test program that does something incredibly simple like blinks an led, till you figure out how to work that. When you have them all working, your project is done. We call it, "Divide and Conquer." Gives you a feeling of power

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Torby wrote:
That's always the hard part of learning a new communication: Is it not sending or not receiving or both and how can I tell?

Exactly!

 

This is another reason for at least starting out with an "intelligent" radio module.

 

Another advantage is that vendors of such modules will usually also have test tools available to help you "see" what's going on...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Since i can't read your code because you rar'ed it i can only guess you try to use uart data over these radios. Sure its possible, but something like the virtualwire library encodes/decodes the data using a better method. Also 4800 baud is a bit optimistic - 1200 baud is more common in commercial units that utilise this radio technique.
So get Googling for virtualwire.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mr. awneil....

sir, I agree with you. I should have used another. but unfortunately that type of device is not available here. So for this time, i have to try with the device that I've used.

do you have any idea or suggestion to make that work?

thanks for your comment... :)

fatin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mr. torby

sir I have tried that. The thing that happens is, if the wireless connection is established for once, then it works fine., and there is no problem. but when ever I power if off and again power it up the problem arises. In that time the transmitter can convert ADC and send data through TX pin, but the receiver MCU doesn't respond. Then I need to reset the receiver MCU again and again (don't know how many times) suddenly it begins to respond. After that until I turn off the power again this thin works perfectly. BUt sometimes the receiver is HANGED. It receives no command but works independently and performs a random work repeatedly, hough it's rare.

how to cope with that?

thanks for your comment... :)

fatin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mr. Kartman,

sir If i reduce the baud rate, the the signal toggles. (say i have connected LEDs with the pins for rate 4800bps the LEDs glow properly. But if I reduce the rate, the LEDs begin to toggle very fast...)

how can I send you the codes???

thanks in advance

fatin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You don't have any series resistors on your leds at the receiver.

 

I don't see any antenna connected to pin 1 of the radio module.

 

Ross McKenzie ValuSoft Melbourne Australia

Last Edited: Tue. Aug 4, 2015 - 02:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sir, I agree with you. I should have used another. but
unfortunately that type of device is not available here. So
for this time, i have to try with the device that I've used.
do you have any idea or suggestion to make that work?
thanks for your comment... :)

fatin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sir I connected antenna. but it didn't work then. as it's a small distance i thought antenna was not that essential.

and there should be resistors. that's a fault. but though its working. main problem is the radio connection sir....

fatin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sir If i reduce the baud rate, the the signal toggles. (say i
have connected LEDs with the pins for rate 4800bps the
LEDs glow properly. But if I reduce the rate, the LEDs
begin to toggle very fast...)
how can I send you the codes???
thanks in advance

fatin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sir I have tried that. The thing that happens is, if the
wireless connection is established for once, then it works
fine., and there is no problem. but when ever I power it
off and again power it up the problem arises. In that time
the transmitter can convert ADC and send data through
TX pin, but the receiver MCU doesn't respond. Then I
need to reset the receiver MCU again and again (don't
know how many times) suddenly it begins to respond.
After that until I turn off the power again this thin works
perfectly. but sometimes the receiver is HANGED. It
receives no command but works independently and
performs a random work repeatedly, though it's rare.
how to cope with that?
thanks for your comment... :)

fatin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It would appear that you are not getting your Tx and Rx synchronized, and keeping them synchronized.

 

You need to put your data in a packet.

 

Have a look at This Thread, for my comments on post #49.

 

As other's have already mentioned, you need to implement a more robust data transmission and decoding scheme.

 

Additionally, look at the data sheet for the RF modules and make sure you are in spec for the data baud rate.

 

Also, Use an external crystal for your clock.

This will eliminate baud rate problems, although that is not likely the current problem as a wire connection works.

But do it anyway.

 

JC

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes, sir I also think that the problem is with synchronization. what can I do to solve?

you have said to use packet and one kind of password to my data. I think I have used them. will you please read my code?

I didn't use crystal but I tried increasing the clock frequency to 8MHz. but the problem is the same. say the Rf is working, as I power off the circuit and then put the power back the receiver is not responding. But if I reset the receiver again and again suddenly it works again until I again power itt off.

fatin

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You must abandon your use of the USART to communicate directly with these radios.  You will never get it to work reliably.  Period.  You must instead use a library (or write your own) which is designed to work with these unsophisticated OOK/ASK radios.  As has been mentioned twice already, have a look at VirtualWire.  That library has now been replaced with a generic multi-protocol multi-device library called RadioHead, but the original VirtualWire is still available here:

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

 

Although it is an Arduino library, it is easily adapted to plain 'ol C on the AVR.  In fact:

Runs on ATmega8/168 (Arduino Diecimila, Uno etc), ATmega328 and can run on almost any other AVR8 platform, without relying on the Arduino framework, by properly configuring the library using 'VirtualWire_Config.h' header file for describing the access to IO pins and for setting up the timer. From version 1.22 the library can be compiled by a C compiler (by renaming VirtualWire.cpp into VirtualWire.c) and can be easily integrated with other IDEs like 'Atmel Studio' for example (courtesy of Alexandru Mircescu).

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

Last Edited: Tue. Aug 4, 2015 - 06:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks a lot. I will try to do this. I will try to update you..

thanks a lot again

fatin