Category Archives: Robotic Sensor

Haxtronic Basic Movement Test and Artificial Narrow Intelligence

Haxtronic Robot Explains About Exploitation Technics (part of artificial narrow intelligence)

 

Haxtronic Robot Basic Movement Test for arm, wheels, camera, and ultrasonic sensor head movements)

 

Demonstrating Haxtronic’s artificial narrow intelligence : cracking wpa2 psk & reporting to internet

 

haxtronic is the first generation hacker robot made by Indonesian

Advertisements

Wheeled Robot Motoric With 3 Ultrasonic Sensors

by : Antonius (@sw0rdm4n)
http://www,ringlayer.net

robot

A. PART LISTS

– 1 sn75441one or l293dne (h-bridge ic)
l293d

– 1 Arduino Uno

– 3 HC-SR04 Ultrasonic Sensor (Front, Left and Right Sensor)

– Arduino smart Car Robot Plastic Tire Wheel with DC 3-6v Gear Motor
x

– Any Wheeled Chassis

You can make any chassis easily using acrylic, For example here:

20141231_120614 20141231_120621

For this robot, I modify my kitchen plastic supplies in order to make my own wheeled chassis:

20141231_120639

– Mini Trolley Wheel (Front Wheel)

mini

– Half Size Breadboard

– Jumper Wires

– 9 volt / 8,4 volt battery

 – Some Bauds

 

B. H-BRIDGE CIRCUIT

In order to make a robot who can avoid front, left and right obstable. We need to make a robot who can turn right, left and turn back.  For that reason, we need a circuit that can switch direction of voltage.  For that, we can use h-bridge, For example here, we can use sn75441one or l293dne. Since a motor dc can reverse direction of spins when a voltage switch to other direction. To make a h-bridge circuit, you can follow this tutorial : http://www.instructables.com/id/Duel-Motor-Driver-with-Arduino-using-a-SN754410NE-/

The method to turn right or left is easy, this robot actually ony has 2 wheel for motoric : left wheel and right wheel.  In order to turn left, right wheel must turn forward and left wheel must turn backward. Meanwhile, in order to turn right, left wheel must turn forward and right wheel must turn backward.

C. HC-SR04 ULTRASONIC SENSOR

HC-SR04 works based on this formula : Speed = Distance / Time. This sensor works by sending a ping of ultrasonic sensor, then calculate. In order to use hc-sr04 we can use NewPing library taken from here : http://code.google.com/p/arduino-new-ping/

For front sensor, connect trig pin to pin 12 on arduino, connect echo pin to pin 13 on arduino.

For left sensor, connect trig pin to pin 10 on arduino, connect echo pin to pin 11 on arduino.

For right sensor, connect trig pin to pin 6 on arduino, connect echo pin to pin 7 on arduino.

Here’s the code for arduino :

/*
Simple wheeled robot motoric with 3 sensor(s) - front, left and right
Made by : Antonius (sw0rdm4n)
http://www.ringlayer.net
*/
#include <NewPing.h>

/* front sonar */
#define TRIG_DEPAN_ATAS  12 
#define ECHO_DEPAN_ATAS     13  

/* left sonar */
#define TRIG_KIRI  10 
#define ECHO_KIRI     11  

/* right sonar */
#define TRIG_KANAN  6 
#define ECHO_KANAN    7  

#define MAX_DISTANCE 200 
NewPing sonar(TRIG_DEPAN_ATAS, ECHO_DEPAN_ATAS, MAX_DISTANCE); 
NewPing sonar_kiri(TRIG_KIRI, ECHO_KIRI, MAX_DISTANCE); 
NewPing sonar_kanan(TRIG_KANAN, ECHO_KANAN, MAX_DISTANCE); 

/* Modified from http://itp.nyu.edu/physcomp/Labs/DCMotorControl */

int motorkanan_arah_depan = 4;    
int motorkanan_arah_belakang = 5;   
int enablePin = 9;   
int motorkiri_arah_depan = 2;    
int motorkiri_arah_belakang = 3;    
unsigned int sensor1_val = 0;
unsigned int sensorkiri_val = 0;
unsigned int sensorkanan_val= 0;
int i = 0;

void setup() {
    Serial.begin(9600);
    pinMode(motorkanan_arah_depan, OUTPUT); 
    pinMode(motorkanan_arah_belakang, OUTPUT); 
    pinMode(motorkiri_arah_depan, OUTPUT); 
    pinMode(motorkiri_arah_belakang, OUTPUT); 
    digitalWrite(enablePin, HIGH); 
}
void mundur_long()
{
      digitalWrite(motorkanan_arah_depan, LOW);  
      digitalWrite(motorkanan_arah_belakang, HIGH);  
      digitalWrite(motorkiri_arah_depan, LOW);   
      digitalWrite(motorkiri_arah_belakang, HIGH);  
      delay(500); 
}
void berhenti()
{
    digitalWrite(motorkanan_arah_depan, LOW);  
    digitalWrite(motorkanan_arah_belakang, LOW);
      
    digitalWrite(motorkiri_arah_depan, LOW);  
    digitalWrite(motorkiri_arah_belakang, LOW);
    delay(500);
}
void maju()
{
      unsigned int uS = sonar.ping(); 
     
      sensor1_val = uS / US_ROUNDTRIP_CM;
      Serial.println("\nsensor depan val : ");
      Serial.print(sensor1_val);
      Serial.print(" cm\n");
      if (sensor1_val < 50 && sensor1_val > 0) {
          mundur_long();
          avoid();
      }
      Serial.println("\nmaju\n");
      digitalWrite(motorkanan_arah_depan, HIGH);   //right
      digitalWrite(motorkanan_arah_belakang, LOW);
      digitalWrite(motorkiri_arah_depan, HIGH);   //left 
      digitalWrite(motorkiri_arah_belakang, LOW);
      delay(50);
       
}
void op()
{
    maju();  
}
void avoid()
{
       int loopback;
       unsigned int uSkiri = sonar_kiri.ping();
       unsigned int uSkanan = sonar_kanan.ping();
     
       sensorkiri_val = uSkiri / US_ROUNDTRIP_CM;
       sensorkanan_val = uSkanan / US_ROUNDTRIP_CM;
       Serial.println("if block executed");
       Serial.println("\nsensor kiri val : ");
       Serial.print(sensorkiri_val);
       Serial.print(" cm\n");
       Serial.println("\nsensor kanan val : ");
       Serial.print(sensorkanan_val);
       Serial.print(" cm\n");
       if (sensorkiri_val > 60) {
           Serial.println("belok kiri"); 
           berhenti();
           belok_kiri(); 
      } 
      else if (sensorkanan_val > 60){
           Serial.println("belok kanan"); 
           berhenti();
           belok_kanan(); 
      } 
      else {
           for (loopback = 0; loopback < 2; loopback++) {
               mundur_long(); 
           }
      }
}
void belok_kanan()
{
      digitalWrite(motorkanan_arah_depan, LOW);  
      digitalWrite(motorkanan_arah_belakang, HIGH);  
      digitalWrite(motorkiri_arah_depan, LOW);  
      digitalWrite(motorkiri_arah_belakang, LOW);
      delay(500); 
}
void belok_kiri()
{
      digitalWrite(motorkanan_arah_depan, HIGH);  
      digitalWrite(motorkanan_arah_belakang, LOW);  
      digitalWrite(motorkiri_arah_depan, LOW);   
      digitalWrite(motorkiri_arah_belakang, HIGH);
      delay(500); 
}
void loop() {
   op();
}

Once success, When the robot avoid front obstacle, it will then check left for another obstacle existence, if no obstable on left, it will then turn left. Otherwise, if there’s another obstable on left, it will then check for right side for obstable, if there’s an obstable, it will turn back, otherwise it will turn right.

Here’s the robot on the road:

Infrared Sensor to Detect Range and Kinect Actuator

Fritzing

rear_front

This is simple and basic guide to detect object using infrared sensor. Hardware requirements : – an arduino or any arduino compatible board ( here I use sduino because it has enough pins to control 2 motor servos) – an infrared sensor – jumper wires (any color doesn’t matter) – 2 motor servo as kinetic actuator (front leg and rear leg)

all

First, plug jumper wires to infrared sensor, here we use sharp infrared sensor. Actually jumper wires color doesn’t matter, but to make it easy, we’ll plug red for 5v, black for ground and yellow for analog input :

ir1

Here we plug red jumper wires to 5v pin on sduino, black jumper wires to ground pin (ground is minus), plug yellow jumper to A5 (analog input pin 5). Plug 2 Servos Next we’ll be plugin 2 motor servos directly to our board using jumper wires, Plug the first motor servo for front leg :

ir2

for analog input we’ll be using pin number 9, for voltage we use 3,3v pin (actually to control a motor servo we can also use 3,3 v pin beside using 5v pin), next we plug the last jumper wire for ground. After plug the first motor, we plug the second motor (rear leg) :

ir3

for analog input, we plug jumper wire to pin 0, for voltage we plug red jumper wire to 5v pin, and the last jumper wire, plug it to ground pin. Actually colors of jumper wire doesn’t matter as long as the arrangement of cable that comes from motor servo plugged correctly with the pins on arduino. Programming The final step is uploading a program to use ir sensor, here’s our code for arduino ide :

/*
simple kinetic actuator using infrared
made by : Antonius (sw0rdm4n)
twitter :  @sw0rdm4n
http://www.ringlayer.net - https://sw0rdm4n.wordpress.com - http://sw0rdm4n.blogspot.com - http://www.indonesianbacktrack.or.id
*/
#include <Servo.h>
int sensorval;
int pos_front_leg = 0;
int pos_rear_leg = 0;
Servo front_leg, rear_leg;
void setup()
{
              front_leg.attach(9);
              rear_leg.attach(0);
}
void loop()
{
               sensorval = analogRead(5);
               if ((sensorval > 200) && (sensorval <300)) {
                           if (pos_rear_leg == 0) {
                                 rear_leg.write(180);
                                 pos_rear_leg = 180;
                           }
                           else {
                                 rear_leg.write(0);
                                  pos_rear_leg = 0;
                           }
              }
              else if (sensorval > 300) {
                          if (pos_front_leg == 0) {
                                front_leg.write(180);
                                pos_front_leg = 180;
                          }
                          else {
                                front_leg.write(0);
                                pos_front_leg = 0;
                          }
              }
              delay(500);
}

Upload that code to arduino board. To test we’ll be using 6 x 1,5 v battery :

ir4

On successfull, if we put any object near the infrared at sensor val range 201-299 the rear leg servo will be moving, if we put any object at sensor val range above 300 the front leg servo will be moving.