Problem hooking up two 433 MHz RF Transmitter
coffeBreak
Posts: 1
Hi guys, I'm trying to set up a connection between two Parallax 433 MHz RF Transmitters. They are both connected to one ATmega16 microrprocessor each, and I'm pretty sure all the connections are correct...
Datasheet to the Parallax 433 MHz RF Transmitter:
http://www.parallax.com/Portals/0/Downloads/docs/prod/rf/27980-ParallaxRFTransmit-v1.1.pdf
Datasheet to the ATmega16 MPU:
http://www.atmel.com/Images/doc2466.pdf
I've connected a LED to the receiver which is programmed to listen after "1". When the receiver catches a "1" the LED is suppose to turn on.
The transmitter has been programmed to send out "1" which should keep the LED turned on pretty much all the time. Problem is however, the transmitter doesn't seem to work properly. The LED keeps turning on and off in an irregular way and I'm sure it only picks up noise from the surrounding environment (when I turn off the transmitter completely the LED still keeps turning on and off which indicates).
As it appears from my point of view: The receiver works fine - It does pick up "1" from the surrounding. The transmitter however, does not (if it was working surely the receiver would pick up "1" all the time....)
Here is my C code, maybe someone finds an error...
Transmitter:
Receiver:
Getting kinda desperate over here, if anyone out there has a clue of what could be wrong, please let me know!
Thanks!
Datasheet to the Parallax 433 MHz RF Transmitter:
http://www.parallax.com/Portals/0/Downloads/docs/prod/rf/27980-ParallaxRFTransmit-v1.1.pdf
Datasheet to the ATmega16 MPU:
http://www.atmel.com/Images/doc2466.pdf
I've connected a LED to the receiver which is programmed to listen after "1". When the receiver catches a "1" the LED is suppose to turn on.
The transmitter has been programmed to send out "1" which should keep the LED turned on pretty much all the time. Problem is however, the transmitter doesn't seem to work properly. The LED keeps turning on and off in an irregular way and I'm sure it only picks up noise from the surrounding environment (when I turn off the transmitter completely the LED still keeps turning on and off which indicates).
As it appears from my point of view: The receiver works fine - It does pick up "1" from the surrounding. The transmitter however, does not (if it was working surely the receiver would pick up "1" all the time....)
Here is my C code, maybe someone finds an error...
Transmitter:
#include<avr/io.h> #define F_CPU 1000000UL #define FOSC 1843200// Clock Speed #define BAUD 9600 #define MYUBRR FOSC/16/BAUD-1 void USART_Init( unsigned int ubrr) { /* Set baud rate */ UBRRH = (unsigned char)(ubrr>>8); UBRRL = (unsigned char)ubrr; /* Enable receiver and transmitter */ UCSRB = (1<<RXEN)|(1<<TXEN); /* Set frame format: 8data, 2stop bit */ UCSRC = (1<<URSEL)|(1<<USBS)|(3<<UCSZ0); } void USART_Transmit( unsigned char data ) { /* Wait for empty transmit buffer */ while ( !( UCSRA & (1<<UDRE)) ) ; /* Put data into buffer, sends the data */ UDR = data; } int main( void ) { DDRA = 0xFF; PORTA = 0x00; USART_Init ( MYUBRR ); while(1) { USART_Transmit('1'); } return(0); }
Receiver:
#include<avr/io.h> #define F_CPU 1000000UL #define FOSC 1843200// Clock Speed #define BAUD 9600 #define MYUBRR FOSC/16/BAUD-1 void USART_Init( unsigned int ubrr) { /* Set baud rate */ UBRRH = (unsigned char)(ubrr>>8); UBRRL = (unsigned char)ubrr; /* Enable receiver and transmitter */ UCSRB = (1<<RXEN)|(0<<TXEN); /* Set frame format: 8data, 2stop bit */ UCSRC = (1<<URSEL)|(1<<USBS)|(3<<UCSZ0); } unsigned char USART_Receive( void ) { /* Wait for data to be received */ while ( !(UCSRA & (1<<RXC)) ) ; /* Get and return received data from buffer */ return UDR; } int main( void ) { DDRA = 0xFF; //set receive PORTA = 0x00; USART_Init ( MYUBRR ); unsigned char signal; DDRB = 0x01; while(1){ signal= USART_Receive(); if(signal == '1'){ PORTB = 0xFF; //turns the LED ON } else { PORTB = 0x00; //turns the LED OFF } } return(0); }
Getting kinda desperate over here, if anyone out there has a clue of what could be wrong, please let me know!
Thanks!
Comments
Although these devices should work sending continuous characters, they work best when you send a sync pulse followed by a short packet as shown in the examples in the documentation. They have an automatic gain control that's set by the sync pulse that sets the 0 / 1 threshold. A '1' (%00110001) character with 2 stop bits has enough 0 / 1 variation that it should keep the threshold set close enough.
I would carefully go over the connections between the receiver and transmitter and the ATmegas and carefully go through the ATmega documentation making sure that you're configuring the USARTs properly. These units work fine with the Parallax Stamps.