Loading...
  Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Project Guidance / Re: TIP120 and Dc motor control on: February 25, 2012, 10:14:37 am
10 k pot regulates voltage at the analog input, you free to change , it doesn't change much as input impedance arduino 100 M.


ok thanks how abou the 1k resistor and diode should i use a higher wattage for the resistor say 1 watt? and for the diode higher current say 3Amps?.. thanks
2  Using Arduino / Project Guidance / Re: TIP120 and Dc motor control on: February 25, 2012, 03:56:14 am
What happens if i change the 10 k potentiometer to 50 k pot?
3  Using Arduino / Project Guidance / TIP120 and Dc motor control on: February 24, 2012, 07:10:21 pm
Hi i've followed this tutorial http://luckylarry.co.uk/arduino-projects/arduino-control-a-dc-motor-with-potentiometer-and-multiple-power-supplies/ and got it working. now here's the question:

1. If i increase the voltage say 12v 5A do i need to change materials used in the circuit?. the 1k resistor?, the diode? and potentiometer?. because when i tried it with 12v 5A the tip120 quickly becomes hot and suddenly motor stops and after 3-4 secs the motor start again but can't control it anymore with the potentiometer the motor goes on rampage.. i need to turn off the arduino to make it work again.

2. Do i need a higher potentiometer say 50k or change the 1k resistor or the diode?


3. What's better Mosfet IRF510 or Tip120?


thanks in advance
4  Using Arduino / General Electronics / Re: Centralized Power Supply on: February 19, 2012, 01:09:58 am
So you want a supply from the main ( 120 / 220 ) ? right ?

I have an adapter that will be plugged to 220 that has an output of 12v with 1 amp.. i want it to be my main supply for the 4 motors.. but if i want to supply from the main what should i do?
5  Using Arduino / General Electronics / Re: Centralized Power Supply on: February 18, 2012, 11:52:39 pm
Quote
Here an idea... buy a lead-acid 6 V motocycle battery. And wire the motors direct - with the motors controller.   

but what i need is a plug supply.. i have power supply unit that i got from my computer but it's way too big to fit my system..
6  Using Arduino / General Electronics / Re: Centralized Power Supply on: February 18, 2012, 09:30:31 pm
can i use LM317 for the 4 motors?.. split them 12v = 4 LM317 = 4 Motors.. one Lm317 for one motor?
7  Using Arduino / General Electronics / Re: Centralized Power Supply on: February 18, 2012, 09:26:53 pm
Quote
Else just run the 12V into the Arduino DC in jack, too.

Can i also do it at the Vin input pin of arduino?.. and what's the max current and voltage can be supplied in the Vin?
8  Using Arduino / General Electronics / Centralized Power Supply on: February 18, 2012, 08:40:19 pm
I have 4 batteries which is two 12v and two 6v which i used to power my 4 motors.. stepper, servo, and two dc motor.. my stepper can operate ranging from 6-12 volts.. my two dc motors are 6volts amps of 2A. my servo is 6v-1ampere... im using arduino to control the 4 motors. everything works fine.. but....

i wan to supply my motors with only one power supply because 4 batteries are way too heavy.i'll be using an adapter with an output voltage of 12v and 1amp as my main power.. how can i supply all of my motors with one supply only and still operate the same as with using  4 batteries.. i'ts like it's centralized.. thanks..
9  Using Arduino / Project Guidance / Re: Stepper motor positioning on: February 11, 2012, 10:27:10 am
Thanks a lot for the info you've been a great help. really appreciate it.. smiley
10  Using Arduino / Project Guidance / Re: Stepper motor positioning on: February 11, 2012, 09:26:17 am
Thanks gonna try it out..

what's the difference of doing this..

Code:
digitalWrite(dirPin,LOW);
        if(present_position < position)
        {
        digitalWrite(clkPin,LOW);
digitalWrite(clkPin,HIGH);
        present_position++;


to this..

Code:
if(present_position < position)
        {
        digitalWrite(dirPin,LOW);
        digitalWrite(clkPin,stepperClockPhase);
        if (stepperClockPhase)
            present_position++;


11  Using Arduino / Project Guidance / Stepper motor positioning on: February 11, 2012, 08:22:03 am
Hi im controlling a stepper motor and positions them according to the button pressed. 4 positions and 4 buttons in total.. the 4 positions are as follow: 0,90,180,270;

if left button pressed go to 90 degrees
if top button pressed go return to 0 degrees
if right button pressed go to 270 degrees
if down button pressed go to 180 degrees

all works well but my problem is delay.. becoz im also controlling a servo while controlling a stepper. the servo moves from left to right but when i push the button to control the stepper the movement of the servo stops.. it first execute the rotation of the stepper.

here's the code..


Code:

void button(){
int reading1 = digitalRead(TOP_BT); 
  int reading2 = digitalRead(LEFT_BT);
  int reading3 = digitalRead(DOWN_BT);
  int reading4 = digitalRead(RIGHT_BT);
  int reading5 = digitalRead(RANDOM_BT);
 
  if (reading1 != lastReading1) {
   
    lastDebounceTime1 = millis();
   
    lastReading1 = reading1;
  }
 
  if (reading2 != lastReading2) {
   
    lastDebounceTime2 = millis();
   
    lastReading2 = reading2;
  }
 
  if (reading3 != lastReading3) {
   
    lastDebounceTime3 = millis();
   
    lastReading3 = reading3;
  }
 
  if (reading4 != lastReading4) {
   
    lastDebounceTime4 = millis();
   
    lastReading4 = reading4;
  }
 
   
   
  if(digitalRead(TOP_BT) && (millis() - lastDebounceTime1) > debounceDelay){
    MoveAbsoluteAngle(0);
   
  }
  if(digitalRead(LEFT_BT) && (millis() - lastDebounceTime2) > debounceDelay){
    MoveAbsoluteAngle(45);         // 90 degrees
 
}

  if(digitalRead(DOWN_BT) && (millis() - lastDebounceTime3) > debounceDelay){
    MoveAbsoluteAngle(90);         // 180 degrees
 
}
  if(digitalRead(RIGHT_BT) && (millis() - lastDebounceTime4) > debounceDelay){
    MoveAbsoluteAngle(135);       // 270 degrees
 
}

}


void MoveAbsolute(int position){
if (present_position<position)              // present_postion is declared globally and is initialize to 0
   {
      digitalWrite(dirPin,LOW);
      for( ; present_position<position; present_position++)
      {
         delay(5);
         digitalWrite(clkPin,LOW);
         delay(5);
         digitalWrite(clkPin,HIGH);
      }
   }
   else
   {
      digitalWrite(dirPin,HIGH);
      for( ; present_position>position; present_position--)
      {
         delay(5);
         digitalWrite(clkPin,LOW);
         delay(5);
         digitalWrite(clkPin,HIGH);
      }
   }
}


void MoveAbsoluteAngle(int degrees)
{
   int position = (50*degrees)/45; // 200 steps for 360 degrees
   MoveAbsolute(position);
}


My code works but after modifying it removing the delay. it doesn't move at all with button presses.

here's the code..

Code:
void button(){
int reading1 = digitalRead(TOP_BT); 
  int reading2 = digitalRead(LEFT_BT);
  int reading3 = digitalRead(DOWN_BT);
  int reading4 = digitalRead(RIGHT_BT);
  int reading5 = digitalRead(RANDOM_BT);
 
  if (reading1 != lastReading1) {
   
    lastDebounceTime1 = millis();
   
    lastReading1 = reading1;
  }
 
  if (reading2 != lastReading2) {
   
    lastDebounceTime2 = millis();
   
    lastReading2 = reading2;
  }
 
  if (reading3 != lastReading3) {
   
    lastDebounceTime3 = millis();
   
    lastReading3 = reading3;
  }
 
  if (reading4 != lastReading4) {
   
    lastDebounceTime4 = millis();
   
    lastReading4 = reading4;
  }
 
   
   
  if(digitalRead(TOP_BT) && (millis() - lastDebounceTime1) > debounceDelay){
    MoveAbsoluteAngle(0);
   
  }
  if(digitalRead(LEFT_BT) && (millis() - lastDebounceTime2) > debounceDelay){
    MoveAbsoluteAngle(45);         // 90 degrees
 
}

  if(digitalRead(DOWN_BT) && (millis() - lastDebounceTime3) > debounceDelay){
    MoveAbsoluteAngle(90);         // 180 degrees
 
}
  if(digitalRead(RIGHT_BT) && (millis() - lastDebounceTime4) > debounceDelay){
    MoveAbsoluteAngle(135);       // 270 degrees
 
}

}


void MoveAbsolute(int position){

  if((millis() - lastStepTime) > stepDelay)    //stepDelay = 5; and lastStepTime = 0;
    {
      digitalWrite(dirPin,LOW);
        if(present_position < position)
        {
        digitalWrite(clkPin,LOW);
digitalWrite(clkPin,HIGH);
        present_position++;
        }
     lastStepTime = millis(); 
    }   

   if((millis() - lastStepTime) > stepDelay)
    {
      digitalWrite(dirPin,HIGH);
        if(present_position > position)
        {
        digitalWrite(clkPin,LOW);
digitalWrite(clkPin,HIGH);
        present_position--;
        }
     lastStepTime = millis(); 
    }
}



void MoveAbsoluteAngle(int degrees)
{
   int position = (50*degrees)/45; // 200 steps for 360 degrees
   MoveAbsolute(position);
}


It does not work anymore with button presses.. I did the same thing with the servo removing the delay and it works well but what am i doing wrong with the stepper?.. hope somebody can help me been doing this already for 3 days..
12  Using Arduino / Project Guidance / Re: millis() as delay() on: February 07, 2012, 08:54:05 am
Code:
So will sending a long stream of characters via the serial port.

yeah i've notice that.. any other way for me to do it?
13  Using Arduino / Project Guidance / Re: millis() as delay() on: February 07, 2012, 07:51:24 am
Code:
Why not use delay()?

Bcoz it will stop everything.. so what im doing is changing all delays to millis()..
14  Using Arduino / Project Guidance / Re: millis() as delay() on: February 07, 2012, 07:33:41 am
Thanks Pluggy gotta try that out and post the code later if i can get it to work..
15  Using Arduino / Project Guidance / Re: millis() as delay() on: February 07, 2012, 07:11:53 am
Quote
Consistent indentation would help to show what's going on.
Try using the auto format tool before posting code.

ok sorry about that...

I made my own pause function.. it pauses the servo for sometime before moving again just like delay..

like this..

modified sweep code..

Code:

for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees
  {                                  // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }

delay(1000);  // pause for 1 second before executing the code below


  for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }

delay(1000);  // pause for 1 second



instead of using delay i can substitute it with the function i created.. pause();
i just don't know if i did it the right way..

here's the code with indention..

Code:
/ Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.


#include <Servo.h>

int move = 0;
long stepsinterval = 10;
long timepause = 1500;
long previousmillis = 0;
Servo myservo;  // create servo object to control a servo
// a maximum of eight servo objects can be created

int pos = 0;    // variable to store the servo position

void setup()
{
  myservo.attach(9);
  Serial.begin(9600);  // attaches the servo on pin 9 to the servo object
}


void loop()
{

  if(millis()-previousmillis >= stepsinterval)
  {
    previousmillis = millis();

    if (move ==  1)
    {
      pos++;
      if (pos >= 125)
        move = 0;
      myservo.write(pos);
      if (pos==125) pause();
    }
    if (move == 0)
    {
      pos --;
      if (pos <= 55) 
        move = 1;
      myservo.write(pos);
      if (pos==55) pause();   
    }
  }
}
void pause(){
  if(millis()-previousmillis >= timepause)
    previousmillis = millis();
  for(int x= 0; x<=100; x++){
    Serial.println(x,DEC);
  }
}



Pages: [1] 2 3 4