Category Archives: Motor DC

DIY – USB Mini Fan

This is a very easy guide to make an usb powered mini fan.

Requirement:

– 1 usb cable
– 1 quadcopter propeller
– 1 breadboard
– soldering iron + tin
– 2 jumper wire
– 1-3 0,1 microfarad 50v capacitor
– 1 usb charger (alternatively you can powered up the fan later using power bank or usb port from pc or laptop or any usb charger)

diyfan0

 

First of all, cut the usb cable and isolate the plus and minus from the data transfer cables (green and white is data transfer cable).

diyfan2

As we already know that any usb cable consist of 4 different cables:
diyfannx

The red one is for positive volt, the black one is for negative volt, the green will be used for upstream data transfer and the white one will be used for downstream data transfer.

Here we got isolated plus and minus cable where each of the cable has been soldered with tip of jumper wire (the red and black one) which is ready to be plugged into our positive and negative spot on breadboard.

diyfan2.2

Next solder the 0.1 µF ceramic capacitor across the motor dc (we can use 1-3 capacitor to deal with motor noise), and plug the quadcopter propeller on top.

Once the ceramic capacitor has been soldered, add 2 jumper wires in order to plug it to breadboard.

diyfan3

And finaly, plug the usb cable and the jumper wire from motor dc on the breadboard and the usb fan is ready.

diyfan4

This usb fan is ready to powered via any 5v power supply. You can powered it with a charger, any usb port from laptop or pc, any power banks or any other 5v power supply.

Here’s the usb fan in action:

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:

Motor DC Control (1 direction only) Using ULN2803 (Darlington Array Transistor)

by : Antonius (@sw0rdm4n)

http://www,ringlayer.net

Part List(s)
– 1 Ceramic Disc Capacitors 50V 100nF
– 1 Mini Breadboard
– 1 uln2803
– Arduino / any compatible board
– 1 Tamiya single Gearbox
– 2 Wheel for tamiya gearbox
– Jumper Wires
– 6 v battery holder
– 4 x 1,5v battery
– 1 dc motor (toy)
– Soldering iron and tin

ULN 20803 is a darlington array transistor with 8 channel(s) suitable to control devices up to 500mA , 50v, the specification can be downloaded from here http://www.adafruit.com/datasheets/ULN2803A.pdf.

Here in this example we will use uln2803 to control a motor dc that uses single gearbox, since uln2803 isn’t a h-bridge so we will only able to control it with single direction ( for h-bridge, we may use tlc5940 ).

Here’s uln2803 pins:

uln2803

In this example, we will be using pin 1 as pwm pulse receiver from arduino pin 7 output. and pin 9 will be for ground connect to arduino’s ground. How to locate where’s pin 1 and another ? We can see on uln2803 that it has a “U” sign. The “U” sign determines that pin 1 is located on the left of that “U” sign.

First Step
Plug and solder jumper wire and ceramic disc capacitor into motor dc as follow:

uln1

Next plug the dc motor into tamiya single gearbox and plug some wheels. Here comes it :

x

As if this is a small vehicle, but it has no steering capabilities.

Second Step

connect pin 1 on uln2803 with pin 7 on arduino and connect ground pin (9) on uln2803 to ground pin on arduino.

20141118_065032

Next, connect both jumper from motor dc to pin 18 and pin 10 on uln2803

correct1

Next, connect ground from battery to ground pin 9 on uln2803, plug it beside ground pin from arduino, and plug volt from battery to pin 10 on uln 2803, plug it besides motor dc jumper wire as follow:

correct2

Final step is to upload this code:

int motor = 7;
void setup() {                
   pinMode(motor, OUTPUT);   
}

void loop() {
   digitalWrite(motor, HIGH);
   delay(300);   
   digitalWrite(motor, LOW);
   delay(1000);   
}

Once everything done, we can move the motor each 1 second about 0,3 second as follow: