Robot Car Sensors

I am working on a Smart Robot Car Controlled by Android using App: RemoteXY via Bluetooth (soon gonna change it to WiFi).
Yet I have developed a Robot Car using Arduino Uno, L298N DC Motor Driver (connected to 4 Motors), HC-05 Bluetooth Module (soon gonna replace it with ESP8266 ESP-01) and a Buzzer (as horn for the car). I am giving 12V 2amp DC Power, Directly to the Arduino Board. The Pins 2 and 3 as RX and TX respectively. The 0 and 1 Pins are unfilled along with 4, 5, 13 & one GND of the same row. And on the other side “VIN” is connected to the “+12V” of the L298N and One GND is connected to the GND of the L298N and the buzzer. The “5V” of the Arduino is connected with the HC-05 along with it’s ground(GND) respectively. Other pins (6 in number) are in use with L298N Motors and their speeds.

The code that I am using (GUI and Library Powered by RemoteXY):-

– 1st Robo Car Project (2) with horn(1) –

This source code of graphical user interface
has been generated automatically by RemoteXY editor.
To compile this code using RemoteXY library 2.3.3 or later version
download by link
To connect using RemoteXY mobile app by link

  • for ANDROID 4.1.1 or later version;
  • for iOS 1.2.1 or later version;

This source code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

// RemoteXY include library //

// RemoteXY select connection mode and include library
#include <SoftwareSerial.h>

#include <RemoteXY.h>

// RemoteXY connection settings

// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF =
{ 255,9,0,0,0,154,0,8,228,4,
0 };

// this structure defines all the variables of your control interface
struct {

// input variable
int8_t joystick_1_x; // =-100…100 x-coordinate joystick position
int8_t joystick_1_y; // =-100…100 y-coordinate joystick position
uint8_t rgb_1_r; // =0…255 Red color value
uint8_t rgb_1_g; // =0…255 Green color value
uint8_t rgb_1_b; // =0…255 Blue color value
uint8_t switch_1; // =1 if switch ON and =0 if OFF
uint8_t select_1; // =0 if select position A, =1 if position B, =2 if position C, …
uint8_t button_1; // =1 if button pressed, else =0
uint8_t button_2; // =1 if button pressed, else =0

// other variable
uint8_t connect_flag; // =1 if wire connected, else =0

} RemoteXY;
#pragma pack(pop)

// END RemoteXY include //

#define PIN_BUTTON_2 12

#define PIN_SWITCH_1 13

//define right motor control pins
#define right_motor_A 8
#define right_motor_B 9
#define right_motor_speed 11 //enable pin

//define left motor control pins
#define left_motor_A 6
#define left_motor_B 7
#define left_motor_speed 10 //enable pin

//define two arrays with a list of pins for each motor
uint8_t RightMotor[3] = {right_motor_A, right_motor_B, right_motor_speed};
uint8_t LeftMotor[3] = {left_motor_A, left_motor_B, left_motor_speed};

//speed control of motors
void Wheel (uint8_t * motor, int v) // v = motor speed, motor = pointer to an array of pins
if (v > 100) v=100;
if (v < -100) v=-100;
if (v > 0){

digitalWrite (motor [0], HIGH);
digitalWrite (motor [1], LOW);
analogWrite (motor [2], v * 2.55);
else if ( v<0 ){

digitalWrite (motor [0], LOW);
digitalWrite (motor [1], HIGH);
analogWrite (motor [2], (-v) * 2.55);
digitalWrite (motor [0], LOW);
digitalWrite (motor [1], LOW);
analogWrite (motor [2], 0);

void setup()
RemoteXY_Init ();


//initialization pins
pinMode (right_motor_A, OUTPUT);
pinMode (right_motor_B, OUTPUT);
pinMode (left_motor_A, OUTPUT);
pinMode (left_motor_B, OUTPUT);


void loop()
RemoteXY_Handler ();

digitalWrite(PIN_SWITCH_1, (RemoteXY.switch_1==0)?LOW:HIGH);

digitalWrite(PIN_BUTTON_2, (RemoteXY.button_2==0)?LOW:HIGH);

//manage the right motor
Wheel (RightMotor, RemoteXY.joystick_1_y - RemoteXY.joystick_1_x);
Wheel (LeftMotor, RemoteXY.joystick_1_y + RemoteXY.joystick_1_x);


Now, I am willing to add an obstacle sensor (say IR Transceiver) to it and a camera for live output.

Please modify my code in order to allow me to add an IR transceiver as an obstacle sensor, such that it would change it’s direction towards the direction where it senses no obstacle, automatically. And get the live Camera output.

Please suggest me the good hardware (devices) like camera and it’s transmitter and receiver for Arduino and how to use them in my project.

It may be noted here, I am a very beginner in the field of Robotics and a graduate (bachelor) of science (NOT engineering). I don’t know Fritzing and I cannot design PCB(s). I know very basic level of C language Programing. Though I have a great learning capacity.

The most kind hearted person would answer the question and help me in the same. I’ll be very grateful to you till my last breath.

If cannot answer then too thank you so much for reading this very long message.

Although I am not a rich man, but the person who helps me in the same would earn tons of my blessings and well wishes.

An extreme Thanks to the would be supporter/Guide or Helper.

I just deleted a carbon copy of this post in a different section of the forum,


Only warning.

(Please remember to use code tags when posting code)