Rexplorer v2

Rexplorer v2

Rexplorer v2 is a fully autonomous self-mapping robot to be used for indoor purposes.

My original intention was to develop a robot which could map an unknown area and relay the data to a monitoring system so as to provide real-time feedback about the layout of external environment.

I ended up making a robot that maps its own path, generally sticks to moving along the periphery of a room and sends a rough sketch of its traversed path to a smartphone via bluetooth.

This robot is part of the Rexplorer Project and is only an experimental prototype. There are certain conditions for sensing which have not yet been included, due to which undesirable movement may be caused. (Bug-fixes for the same will feature in the next version along with improved sensing algorithms and ultrasonic sensors.)

How it works:

There are 3 infrared proximity sensors at the front and sides of the robot which detect obstructions in its path. These digital signals are sent to an AVR micro-controller (ATMEGA 328 on Arduino UNO) which decides in which direction the robot should turn. The decision then activates the respective motors by sending a set of signals to the motor driver. Simultaneously, a second signal is sent to an Android application on a smartphone, via Bluetooth, containing information about the robot’s current movement which is in turn, used to draw a sketch of its path as it moves in real-time.

The Android application was made using MIT App Inventor 2 and the robot’s program was coded in the Arduino IDE (Integrated Development Environment), based on C++.

List of components: (all components are available at online stores such as robokits.co.in)

  • Wheels – 4 nos.
  • DC Geared motors – 4 nos.
  • Arduino UNO – 1 no. (Any version of Arduino can be used with the given code, provided it has the same or greater number of I/O pins and relevant changes are made in the uploading procedure. Additionally, any development board can be used provided the code’s logic remains the same and sufficient I/O pins are available.)
  • HC-05 bluetooth module – 1 no.
  • Infrared proximity sensors – 3 nos.
  • L298N motor driver – 1 no.
  • Lithium-ion rechargeable battery – 1 no.
  • Jumper wires – lots!

And finally, the codes! As always, please feel free to utilise, remix and improvise upon the codes. (And let me know how it went in the comments below!)

Smartphone application –

Arduino code –

int l1 = 6;
int l2 = 5;
int r1 = 11;
int r2 = 9;

int rs = 100;
int ls = 100;
int rts = 130;
int lts = 130;
//Coded by Raunak Hede-http://raunakhede.com
//drive system
#define f analogWrite(l1, ls); analogWrite(l2, 0); analogWrite(r1, rs); analogWrite(r2, 0);
#define b analogWrite(l1, 0); analogWrite(l2, ls); analogWrite(r1, 0); analogWrite(r2, rs);
#define l analogWrite(l1, 0); analogWrite(l2, lts); analogWrite(r1, rts); analogWrite(r2, 0);
#define r analogWrite(l1, lts); analogWrite(l2, 0); analogWrite(r1, 0); analogWrite(r2, rts);
#define s analogWrite(l1, 0); analogWrite(l2, 0); analogWrite(r1, 0); analogWrite(r2, 0);
#define d delay(200);

//individual hemisphere control
#define leftfor analogWrite(l1, lts); analogWrite(l2, 0);
#define rightfor analogWrite(r1, rts); analogWrite(r2, 0);

#define leftstop analogWrite(l1, 0); analogWrite(l2, 0);
#define rightstop analogWrite(r1, 0); analogWrite(r2, 0);

#define leftback analogWrite(l1, 0); analogWrite(l2, lts);
#define rightback analogWrite(r1, 0); analogWrite(r2, rts);

//MAPPING system
#define forward Serial.write("1");
#define backward Serial.write("4");
#define left Serial.write("3");
#define right Serial.write("2");
#define forright Serial.write("1");Serial.write("2");
#define backright Serial.write("1");Serial.write("2");
#define forleft Serial.write("4");Serial.write("3");
#define backleft Serial.write("4");Serial.write("3");
#define stp Serial.write("0");
int state;
int s1,s2,s3;
void setup()
{
pinMode(l1, OUTPUT);
pinMode(l2, OUTPUT);
pinMode(r1, OUTPUT);
pinMode(r2, OUTPUT);
pinMode(A0, INPUT);
pinMode(A2, INPUT);
pinMode(A3, INPUT);
Serial.begin(9600); //initialize serial communication at 9600 bits per second
pinMode(13,OUTPUT);digitalWrite(13,LOW);
}

void loop()
{
 if(Serial.available()>0)
 {
 int fse=digitalRead(A0);//front
 int lse=digitalRead(A2);//digital
 int rse=digitalRead(A3);//digital
//specify sensor limits
 int fsl=0;
 int lsl=0;
 int rsl=0;
//sets to 1 if closed and to 0 if open
 if(lse==lsl){s1=1;}else{s1=0;}
 if(fse==fsl){s2=1;}else{s2=0;}
 if(rse==rsl){s3=1;}else{s3=0;}

 if(s1==0 && s2==0 && s3==0)
 {//no blocks
 forward;
 f;delay(100);
 }
 else if(s1==1 && s2==0 && s3==1)
 {//sides blocked
 forward;
 f;delay(100);
 }
 else if(s1==1 && s2==1 && s3==1)
 {//all blocked- to rev- add about turn
 stp;
 s;
 }
 else if(s1==1 && s2==1 && s3==0)
 {//turn 90 right
 left;
 r;delay(400);
 }
 else if(s1==0 && s2==1 && s3==1)
 {//turn 90 left
 left;
 l;delay(400);
 }
 else if(s1==0 && s2==0 && s3==1)
 {//wall on right
 forward;
 rightfor;leftstop;
 }
 else if(s1==1 && s2==0 && s3==0)
 {//wall on left
 forward;
 leftfor;rightstop;
 }
 //T-junctions
 else if(s1==0 && s2==1 && s3==0)
 {// front block- turn 90 right
 right;
 r;delay(400);
 }
 }
 else{s;}
}
at school

Rexplorer v2 @ Sharada Mandir School Science Fair 2017

Compliments of the season & Happy New Year!

Compliments of the season & Happy New Year!

”Tis the season!’, or rather, ”Twas the season!’

I recently started tinkering around with a servo motor (my Christmas present) and decided to put it to use on our tree.

As you might have figured out, it’s a smartphone-tilt-sensitive star, sitting atop the tree on a servo motor.

When the phone is tilted to the right, the star turns left and vice-versa.

The signals from the phone’s internal accelerometer (only x-axis is used here) are sent via bluetooth to the HC05 bluetooth module, which in turn, sends it to the Arduino UNO. The Arduino then converts the raw data into PWM (pulse width modulation) signals and transmits it through digital pin 9 to the servo motor.

The project makes use of the following hardware:

  • Arduino UNO
  • HC05 (bluetooth module)
  • Plastic geared servo motor

And software:

  • Android app made using MIT App Inventor 2
    • Components used:

    • A few other settings to be changed:
      • BluetoothClient1 – Leave ‘Secure’ checkbox unchecked
      • Clock1 – set ‘TimerInterval’ value to 1
      • AccelerometerSensor1 – set ‘MinimumInterval’ value to 1000 and set ‘Sensitivity’ option to weak.
    • Code:
  • Arduino code:

#include <Servo.h>

Servo myservo;
void setup()
{
Serial.begin(9600);
myservo.attach(9);
delay(1000);
}void loop()
{
int val=0;
int state=Serial.parseInt();
val = map(state,-22,0,0,180);
myservo.write(val);
Serial.println(val);
}

The pin connections are fairly straightforward:

Servo motor red – Arduino 5v
Servo motor black/brown – Arduino GND
Servo motor yellow/white (PWM input) – Arduino Digital Pin 9 (PWM)
HC05 VCC – Arduino 3.3v
HC05 GND – Arduino GND
HC05 Tx – Arduino Rx
HC05 Rx – Arduino Tx

Have a great year ahead!

BT Smart Alarm

BT Smart Alarm

Sometimes you’re plain old alarm clock just isn’t good enough. You need a drastic change in the external environment to shake you out of your deep slumber.

And this is just what the Bluetooth Smart Alarm does best!

The project consists of 3 modules and an Android application (made using MIT App Inventor 2).

20150302_214305     Screenshot_2015-05-01-12-44-19

How to use it:

Before going to bed, the user sets a wake-up time in the app. (The app will continue running in the background until removed from the list of background programs.)

Screenshot_2015-04-30-09-00-41

Screenshot_2015-05-01-14-26-33

Screenshot_2015-05-01-14-37-59

Screenshot_2015-05-01-14-38-11

Screenshot_2015-05-01-14-38-35

At this point, the fan in the room is on and the lights are off.

When the alarm rings (in this case, a song), the fan will go off and the room’s lights will be turned on.

Screenshot_2015-05-01-13-27-26

The user then has to switch off the alarm by clicking on a ‘Wakeup!’ button. This will also turn off the lights and the fan. Why the fan too? So that you feel hot and sweaty and don’t go back to sleep!

How it works:

I ] Components used in BT Smart Alarm Mod 1:

  • Relays rated at 250VAC, 5A with trigger 12VDC, 10A  – I used the JQC-3F(T73)DC12V
  • 2 pin PCB block screw terminals (2 nos.)
  • A small perfboard or veroboard

20150429_231924     20150429_231452     20150215_193428

II ] Components used in BT Smart Alarm Mod 2:

  • Arduino Nano v3.0
  • 2A Dual Motor driver module with PWM control (Any L298 based motor driver will do)
  • 2 Heat-sinks (small)
  • Barrel jack for 12v DC adaptor
  • Female header pins
  • Male to female jumper wires
  • 2 pin PCB block screw terminals (4 nos.)
  • HC-05 bluetooth module

20150429_231350     20150501_115719     20150501_115927

III ] Components used BT Smart ALarm Mod 3:

  • 12v DC adaptor which can provide upto 400mAh

IV ] Internal working:

Initially, the Arduino Nano turns off the lights and turns on the fan. When the user sets a wakeup time, the Android app stores the value and keeps checking it with another value containing the phone’s internal time. When the two values match, the app plays a song and sends a command to HC-05, which is connected to the Arduino. The Arduino then sends four individual signals to four separate relays. These relays control the lights and fan.

Video coming soon!