Connected the standard way on stable 5v to arduino Nano (328p with oldbootloader), D12 for the emitter and D11 for the receiver.
I used the exemple codes of the virtualwire library for both of them. The emitter does red blinks as written in the code when sending data. But nothing happen to the receiver (no led blink nor messages on the serial monitor).
I tried with another arduino nano plus another 433MHz receiver, same results.
Tested both at short distance (10cm) or medium one (3/4m).
Do I have any way to verify (through code or tension measurements) what's working and what's not ? Do you have any idea what's wrong ?
At the emitter side, the tension between data and ground is around 2.5v (probably 0 and 5v at high rate) when vw_send is active, and 0v when vw_send is not active. This proves me that the emitter is working properly. On the receiver side I always have 0.6v-3v on data no matter the code.
I've successfully manage to establish communication a year ago, I was using a classic arduino UNO at the receiver side. Maybe my receiver here doesn't like the arduino Nano.
Please post the code, using code tags, and a photo of a hand-drawn wiring diagram, with pins and connections clearly labeled.
You can test the code without the radios, by simply connecting the radio TX pin on one Arduino to the radio RX pin on the other. Don't forget to connect the grounds (GND).
// 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>
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("setup");
// Initialise the IO and ISR
//vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(2000); // Bits per sec
}
void loop()
{
const char *msg = "hello";
digitalWrite(13, 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(13, false);
delay(200);
}
Receiver code :
// 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>
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("setup");
// Initialise the IO and ISR
//vw_set_ptt_inverted(true); // Required for DR3100
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(13, 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(13, false);
}
}
Connecting D11 to D12, and GND to GND,I also obtain the same result (Got: 68 65 6C 6C 6F), so the program works fine, also succeed with my personnal code (sending "m1" or "m2").
But still no 433MHz connection. I changed the emitter voltage (from 5v to 3.3v as the datasheet required), still nothing. Also tried to change the data pin (D7 for emitter and D8 for receiver, plus specify that on the code with vw_set_rx_pin(8); and vw_set_tx_pin(7); ).
Also tried with brand new emitter/receiver (same models) and nothing works too...
Nothing could work, but I still have the TX led blinking on the emitter side, so I believe the problem comes from the receiver, probably a bad compatibility between the 433MHz receiver module and my Nano board. I will buy an UNO to verify that.
Also my Nano board comes from Aliexpress, it should not be a clone but the real board with a Atmel mega328p chip as written on it, and until now it works perfectly with different library.
Nice test. A real wire to eliminate the RF nature of the virtual wire.
The LEDs on either module are no indication of anything except that they are not burnt out.
Your test almost certainly proves that one or the other is faulty, they are not in tune or your antenna solution is inadequate, or the modules are too close or incompatible.
I wasted spent lotsa time using the simple 433 MHz R/T pairs. They can be made to work.
Essential is to start with the most basic code you did not write, using the circuits you did not design and the antennae and module spacing recommended for valid testing.
Find and purchase a respected pair of these devices. I haven't in years, or I say which ones have worked for me.
Alternative is to buy a keyfob/receiver works out of the box pair, and hijack it for your own purposes.