• 1
    Step 1

    You can us any RC car or you can build one. If you haven't one, you only need to put the 2 geared motors, the caster wheels, one protoboard and the li-po battery in the acrylic chassis. I use a bluetooth controlled car like base for HandBot.

  • 2
    Step 2

    First you need to verify to correct operation of the RF devices. This will be easy by a LED indicator, the control will be managed by two keys "w" and "s" of your computer's keyboard.

    Connect VCC to 5V pin.

    GND to GND pin.

    Data to pin 12 in both Arduinos.

    LED to pin 13 in the receptor Arduino.

    Transmitter module:

    Receiver module:

    LED off:

    LED on:

    You need to download VirtualWire library.

    Code for TX:

     #include<VirtualWire.h>

    int key = 0;

    char *controller;

    void setup(){

    Serial.begin(9600);

    vw_set_ptt_inverted(true);

    vw_set_tx_pin(12);

    vw_setup(4000);

    }

    void loop(){

    if(Serial.available() > 0){

    key = Serial.read();

    switch(key){

    case 'w':     controller = "1";

    vw_send((uint8_t *)controller, strlen(controller));

    vw_wait_tx();

    break;

    case 's':       controller = "0";

    vw_send((uint8_t *)controller, strlen(controller));

    vw_wait_tx();

    break;

    }

    }

    }

    Code for RX:

     #include <VirtualWire.h>

    void setup(){

    vw_set_ptt_inverted(true);

    vw_set_rx_pin(12);

    vw_setup(4000);

    pinMode(13,OUTPUT);

    vw_rx_start();

    }

    void loop(){

    uint8_t buf[VW_MAX_MESSAGE_LEN];

    uint8_t buflen = VW_MAX_MESSAGE_LEN;

    if(vw_get_message(buf, &buflen)){

    if(buf[0]=='1'){

    digitalWrite(13,HIGH);

    delay(1000);

    }

    if(buf[0]=='0'){

    digitalWrite(13,LOW);

    delay(1000);

    }

    }

    }

  • 3
    Step 3

    Now, you need to verify visually with LEDs the four outputs that should go to the H bridge, reds colors indicate forward, greens colors indicate backward, one red and one green colors indicate the turn left or right respectively. The control will be by the keyboard of your computer "8" fordward, "2" backward, "6" turn right, "4" turn left, "5" stop.

    Connect the red LEDs to pin 9 and 7, the green LEDs to pin 8 and 6.

    Forward key "8":

    Backward key "2":

    Turn right key "6":

    Turn left key "4":

    Stop key "5":

    Code for TX:

    #include<VirtualWire.h>

    int key = 0;

    char *controller;

    void setup(){

    Serial.begin(9600);

    vw_set_ptt_inverted(true);

    vw_set_tx_pin(12);

    vw_setup(4000);

    }

    void loop(){

    if(Serial.available() > 0){

    key = Serial.read();

    switch(key){

    case '8':controller = "8";

    vw_send((uint8_t *)controller, strlen(controller));

    vw_wait_tx();

    break;

    case '2': controller = "2";

    vw_send((uint8_t *)controller, strlen(controller));

    vw_wait_tx();

    break;

    case '6':controller = "6";

    vw_send((uint8_t *)controller, strlen(controller));

    vw_wait_tx();

    break;

    case '4':controller = "4";

    vw_send((uint8_t *)controller, strlen(controller));

    vw_wait_tx();

    break;

    case '5':controller = "5";

    vw_send((uint8_t *)controller, strlen(controller));

    vw_wait_tx();

    break;

    }

    }

    }

    Code for RX:

    #include <VirtualWire.h>

    void setup(){

    vw_set_ptt_inverted(true);

    vw_set_rx_pin(12);

    vw_setup(4000);

    pinMode(9,OUTPUT);

    pinMode(8,OUTPUT);

    pinMode(7,OUTPUT);

    pinMode(6,OUTPUT);

    vw_rx_start();

    }

    void loop(){

    uint8_t buf[VW_MAX_MESSAGE_LEN];

    uint8_t buflen = VW_MAX_MESSAGE_LEN;

    if(vw_get_message(buf, &buflen)){

    if(buf[0]=='8'){

    digitalWrite(9, HIGH);

    digitalWrite(8, LOW);

    digitalWrite(7, HIGH);

    digitalWrite(6, LOW);

    }

    if(buf[0]=='2'){

    digitalWrite(9, LOW);

    digitalWrite(8, HIGH);

    digitalWrite(7, LOW);

    digitalWrite(6, HIGH);

    }

    if(buf[0]=='6'){

    digitalWrite(9, HIGH);

    digitalWrite(8, LOW);

    digitalWrite(7, LOW);

    digitalWrite(6, HIGH);

    }

    if(buf[0]=='4'){

    digitalWrite(9, LOW);

    digitalWrite(8, HIGH);

    digitalWrite(7, HIGH);

    digitalWrite(6, LOW);

    }

    if(buf[0]=='5'){

    digitalWrite(9, LOW);

    digitalWrite(8, LOW);

    digitalWrite(7, LOW);

    digitalWrite(6, LOW);

    }

    }

    }