English
Español
yt_link
insta_link
fb_link
twitter_link
ADVERTISERS
Anet A8
DS203




AFFILATE
Gearbest Anycubic I3 MEGA Full Metal Frame FDM 3D Printer
Anycubic I3 MEGA Full Metal Frame FDM 3D Printer only $379.99 with coupon "Anycubici3ch"
Gearbest Anet A8 Desktop 3D Printer
Anet A8 Desktop 3D Printer only $145.99 with coupon "A8KIDA"


Gearbest Tronxy X3S Aluminum Frame LCD Screen  3D Printer DIY Kit
Tronxy X3S Aluminum Frame LCD Screen 3D Printer DIY Kit only $259.99 with coupon "GBX3S"


Gearbest Min DS202 Oscilloscope 113€
Min DS202 Oscilloscope 113€


Gearbest UTD2052CL DIGITAL 2-ch Oscilloscope 275€
UTD2052CL DIGITAL 2-ch Oscilloscope 275€


Gearbest UT139C True RMS Digital Multimeter 29€
UT139C True RMS Digital Multimeter 29€


Gearbest SBK8586 Soldering station Hot Air + Iron 63€
SBK8586 Soldering station Hot Air + Iron 63€


Gearbest BAYANGTOYS X21 Brushless RC Quadcopter
BAYANGTOYS X21 Brushless RC Quadcopter 153€


Radio frequency comunication 433 MHz





What do we need?

All the prices are low due to China purchase. It's up to you wait or not.

1. Two Arduino pro mini (small size) (2€-3€) LINK eBay
2. One radio receiver 433 MHz (1€-2€) LINK eBay
3. One radio transmitter 433 MHz(1€-2€) LINK eBay
4. Serial TTL/FTDI FT232RL module (If you use a pro mini) (2€-3€) LINK eBay
5. Wires, conectors, solder, soldering iron... (0€)



Into!

We want a radio communication between two Arduinos. These two very cheap modules will be useful for a small project wghere we need short-range. The maximum range of operation of these modules won't exceed 20m. They are very easy to use and connect. You only need a single power and data connection. The disadvantage is that we can only send one bit at a time so the speed is not very fast and the data packege is very small. But to create such a remote control for your robot (see gallery) would be perfect if we only use high and low states of your buttons.
We will also see how to increase the operating range of the modules by adding a small antenna.

Schematics!

Conexiones!

First of all we need to power the Arduino FTDI connecting the module 5 volts to Vcc arduino. We also connect the GND to GND of the microcontroller. We have powered the Arduino. If using an Arduino pro mini here you have the connection with the FTDI module to program the microcontroller:


Once we programmed we connect to the RAW pin a voltage between 6 and 12 volt (battery, USB, etc.) The connection is simple. We power each module with a voltage of 5 volts Vcc directly from arduino. Connect the ground to ground and data to any digital pin of the arduino. I've choose pin D7 this time. In the receptor case, any of the two middle pins serve. The two are the same RX pin. For this project we need the VirtualWire library before compiling and programming the microcontroller.



You can download the VirtualWire library here:

To install it we just go to Program -> inport library and we open the .zip file that we've just downloaded.

In order to test our connection we will use one push button and one LED. We connect the push button to ground and the other pin of the button thrw a pullup resistor to Vcc. The same pin of the push button that was conected to ground will go to one of the digital pins of the arduino. In this case will be pin D10. In this way if we don't push the button we will have a low digital input and every thime that we press it we will have a high input.







Transmitter code!

//Transmitter code (ProMini)

#include <VirtualWire.h>//We inport necessary libraries
#include <Wire.h>

int boton=10;//We create the button input using pin 10

void setup() {
pinMode(boton,INPUT);//The D10 pin as input
vw_setup(4000);//comunication speed, it can be 2000, 4000 and up to 8000
vw_set_tx_pin(7);//Pin 7 is the TX pin
}

void loop() {

//Low input -> we send a "0"
if (digitalRead(boton)==LOW)
{
char msg[1] = {'0'};
vw_send((uint8_t *)msg, 1);
vw_wait_tx();
}

//Hign input -> we send a "1"
if (digitalRead(boton)==HIGH)
{
char msg[1] = {'1'};
vw_send((uint8_t *)msg, 1);
vw_wait_tx();
}
}




Receiver code!

//Receiver code (ProMini)

#include <VirtualWire.h>//Inport necessary libraries
#include <Wire.h>

int LED=10;//We create the led output using D10 pin

void setup() {
pinMode(LED,OUTPUT);//Define the 10 pin as output
vw_setup(4000);//comunication speed, it can be 2000, 4000 and up to 8000
vw_set_tx_pin(7);//define the 7 pin as RX pin
}

void loop() {

uint8_t buflen = VW_MAX_MESSAGE_LEN;
uint8_t buf[buflen];

if(vw_get_message(buf, &buflen))
{
for(int i = 0;i < buflen;i++)
{
if(buf[i] == '0')//If a "0" is received we turn off the led
{
digitalWrite(LED,LOW);
}
else if(buf[i] == '1')//If a "1" is received we turn on the led
{
digitalWrite(LED,HIGH);
}
}
}
}





See other tutorial :