Hello, I have some time to research and find no solution for any site and see if you can help me. When command messages from arduino I can see them in the raspberry, but not another Arduino, I have tested hundreds of codes and no way. I've tried RCSwitch libraries and "VirtualWire" but there is no way you can read what command RF. I tested with several receivers and it is nothing of the receiver.
Here are two slightly modified examples found in the "VirtualWire" library. Test them!
Don't forget to change the #defines
Receiver:
// receiver.pde
//
// Simple example of how to use VirtualWire to receive messages
// Implements a simplex (one-way) receiver with an Rx-B1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (mikem@airspayce.com)
// Copyright (C) 2008 Mike McCauley
// $Id: receiver.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $
#include <VirtualWire.h>
#define RF_RX_Pin 8
#define LED 13
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("setup");
vw_set_ptt_pin(false);
vw_set_rx_pin(RF_RX_Pin);
vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the receiver PLL running
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)) // Non-blocking
{
int i;
digitalWrite(LED, true); // Flash a light to show received good message
// Message with a good checksum received, dump it.
Serial.print("Got: ");
for (i = 0; i < buflen; i++)
{
Serial.print(buf[i], HEX);
Serial.print(" ");
}
Serial.println("");
digitalWrite(LED, false);
}
}
transmitter:
// transmitter.pde
//
// Simple example of how to use VirtualWire to transmit messages
// Implements a simplex (one-way) transmitter with an TX-C1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (mikem@airspayce.com)
// Copyright (C) 2008 Mike McCauley
// $Id: transmitter.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $
#include <VirtualWire.h>
#define RF_TX_Pin 9
#define LED 13
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("setup");
vw_set_tx_pin(RF_TX_Pin);
vw_setup(2000); // Bits per sec
}
void loop()
{
const char *msg = "hello";
digitalWrite(LED, true); // Flash a light to show transmitting
vw_send((uint8_t *)msg, strlen(msg));
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(LED, false);
delay(200);
}
I can see them in the raspberry, but not another Arduino,
It sounds like there is a RaspberryPi involved.
Is the Raspberry the sender or the receiver? What kind of Arduino is the other one?
Mr Google also came up with this http://www.homautomation.org/2013/09/21/433mhtz-rf-communication-between-arduino-and-raspberry-pi/
Have you posted your question in the Raspberry Pi forum https://www.raspberrypi.org/forums/
giova014:
Here are two slightly modified examples found in the "VirtualWire" library. Test them!
Don't forget to change the #definesReceiver:
// receiver.pde
//
// Simple example of how to use VirtualWire to receive messages
// Implements a simplex (one-way) receiver with an Rx-B1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (mikem@airspayce.com)
// Copyright (C) 2008 Mike McCauley
// $Id: receiver.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $
#include <VirtualWire.h>
#define RF_RX_Pin 8
#define LED 13
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("setup");
vw_set_ptt_pin(false);
vw_set_rx_pin(RF_RX_Pin);
vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the receiver PLL running
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)) // Non-blocking
{
int i;
digitalWrite(LED, true); // Flash a light to show received good message
// Message with a good checksum received, dump it.
Serial.print("Got: ");
for (i = 0; i < buflen; i++)
{
Serial.print(buf[i], HEX);
Serial.print(" ");
}
Serial.println("");
digitalWrite(LED, false);
}
}
transmitter:// transmitter.pde
//
// Simple example of how to use VirtualWire to transmit messages
// Implements a simplex (one-way) transmitter with an TX-C1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (mikem@airspayce.com)
// Copyright (C) 2008 Mike McCauley
// $Id: transmitter.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $
#include <VirtualWire.h>
#define RF_TX_Pin 9
#define LED 13
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("setup");
vw_set_tx_pin(RF_TX_Pin);
vw_setup(2000); // Bits per sec
}
void loop()
{
const char *msg = "hello";
digitalWrite(LED, true); // Flash a light to show transmitting
vw_send((uint8_t *)msg, strlen(msg));
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(LED, false);
delay(200);
}
I used this codes, but when i open serial monitor i only see "setup".
I will COM3 to put the code receiber, then I will COM4 to put the code transmitter, back to COM3 and see only "setup".
What RF modules are you using (model / picture)? How is the wiring (diagram / schematic / hand drawing)? Have you tested with multiple RF modules?
Please post:
- Links to TX and RX modules you're using.
- Sketches you're using to test, on both sides. (the exact sketch you're sending, please)
- Wiring diagram of all devices.
- What type of arduino you are using on each side?
I have found the fault. The problem is that it puts but refers pin 0 to pin 3 of Arduino.
Now I have a new problem. I cant send and receive in same Arduino, I only can send, when i send a message from other device didn't receive the message.
I'm using this RF: 433MHz RF Transmitter Wireless Module for Arduino - Blue + Yellow - Free shipping - DealExtreme
I'm using nano arduino: http://www.dx.com/p/new-nano-v3-0-module-atmega328p-au-improved-version-for-arduino-yellow-369070
Thank you very much!!