Show Posts
Pages: [1] 2 3
1  Using Arduino / Project Guidance / Re: Arduino CNC mill. on: February 23, 2012, 04:58:44 pm
Last edit for today: I timed the time for the Y axis ,for a full 35 cm run it took 4.7 minutes, using 12 V supply for the servo and almost maximum speed(if  try more from the arduino the motor cannot spin,i think it needs more torque,thus a bigger motor) . Do you think it could be a problem this slow speed,i intend to use it mostly for homemade pcb for projects,and maybe some acrylic engraving or wood.
2  Using Arduino / Project Guidance / Re: Arduino CNC mill. on: February 23, 2012, 04:16:01 pm
Hello again guys and thank you for the helping comments.As i sad earlyer today i will post a picture of the mechanics.I disassembled the entire parts today and cleaned,oiled and reassembled all the pieces back.As you can see in the picture down on the carpet lies the old controller,basically a LPT connector and 3 stepper drivers.I was able to breadboard an single driver using the L293B circuit and 2 transistors and connected it to my arduino duemilanove.After a lot of playing with sketches i was able to find the motor data.All 4 motors are 1,8 degree/step that means 200 steps/revolution. They are bipolar stepper motors.Now resolution of the Y axis is 2 revolutions/1mm advance,meanwhile the X and Z axis have 1revolution/1mm advance.So practically i must turn 400 steps for the Y axis to move 1 mm. I think i like it since it is a very precise movement,but the downside it is that the overall movement will be slow for the entire mill operation. The entire workable are is a bit more than 35x35 cm and have a 5 cm height clearance.I suspected that the original pcb was using an 12V supply,so i really want to stick with that.
Now i want to try to make this thing work with minimal costs,and after i can use it,maybe make some improvements.I will write down what i already have,and i hope maybe some of you guys can direct me in the right direction if i can use this stuff or what should i buy more.
I have : a couple of computer power supply's for 5V and 12V
         - enough stripboard to make the entire pcb for the first tests
         - 2x Arduino 2009
         - 4 micro limit switches that can adapt for the starting point of each axis and calibration
         - 4  x L293B stepper motor drivers that can be directly driven by arduino

and i miss this things: -the dremel for the final tests
                                 - the software for arduino and for the design
                                 - i have no programming skills in C language,only basic stuff like trying the example codes in arduino

I really hope some of you guys comment again on this stuff,and help me go further.

Thank you!!
Daniel
3  Using Arduino / Project Guidance / Re: Arduino CNC mill. on: February 23, 2012, 08:42:03 am
That is a very neat project,exactly what i was looking for.I will get home and post some pics with my mechanics,and add some questions after i study your entire project.Thank you Mike!
4  Using Arduino / Project Guidance / Arduino CNC mill. on: February 23, 2012, 05:28:35 am
Hello guys.I recently brought a second hand small 3 axis cnc,made probably by someone who knew a bit of mechanics.It is well designed and equipped with 3 bipolar stepper motors,and has a small pcb with 3 drivers(that the serial was erased so dnow what kind of H bridges are) and a LPT adapter,probably to use it directly from a LPT printer port.I am in the world of arduino fro some time now and been playing with stepper library,but nothing special.I can make my own stepper driver using the L293 or better yet L298 driver,but i dont know nothing about making the program for the arduino,or what software to use after to design with it.
Is anyone already done something like this and care to share?I google'd a lot and found some instructables too but still not able to put a complete project online.
Thank you for the time and your help!
5  Using Arduino / LEDs and Multiplexing / Re: Creating callable sequence's on: January 31, 2012, 05:38:27 am

Hello guys,i am so sorry to bring back an old topic,i just want to ask if would you mind sharing the code for your led display.I am most interested on making the raining effect,and i still cant get it to work.
Thank you!
6  Using Arduino / Programming Questions / Re: Shift what? on: December 13, 2011, 02:43:07 am
Hello again guys.Thank you for your time and effort helping me.Thank you Mike,that had more sense to me now about how analog to digital works.
However i think i found why the code is not working singularly.I brake my head all night trying to make it work,but as i told before,the piece of code is taken from a larger part from multiwii forum.Now the battery monitor on the entire code is working great.I just wanted to use that code singularly.
I seen that this code is part of a function that is called every main loop,so probably the vbatRaw is reset to 0 every function call.I hope i am right.
Here is the entire function where the code is implemented.
Code:
void annexCode() { //this code is excetuted at each loop and won't interfere with control loop if it lasts less than 650 microseconds
  static uint32_t serialTime;
  static uint32_t buzzerTime;
  static uint32_t calibrateTime;
  static uint32_t calibratedAccTime;
  static uint8_t  buzzerState = 0;
  static uint32_t vbatRaw = 0;       //used for smoothing voltage reading
  static uint8_t buzzerFreq;         //delay between buzzer ring
  uint8_t axis;
  uint8_t prop1,prop2;

  for(axis=0;axis<2;axis++) {
    //PITCH & ROLL dynamic PID adjustemnt, depending on stick deviation
    prop1 = 100-min(abs(rcData[axis]-1500)/5,100)*rollPitchRate/100;
    //PITCH & ROLL only dynamic PID adjustemnt,  depending on throttle value
    if (rcData[THROTTLE]<1500)                               prop2 = 100;
    else if (rcData[THROTTLE]>1499 && rcData[THROTTLE]<2000) prop2 = 100 - (rcData[THROTTLE]-1500) * dynThrPID/500;
    else                                                     prop2 = 100 - dynThrPID;
    dynP8[axis] = P8[axis]*prop1/100*prop2/100;
    dynD8[axis] = D8[axis]*prop1/100*prop2/100;
  }
 
  //YAW dynamic PID adjustemnt
  prop1 = 100-min(abs(rcData[YAW]-1500)/5,100)*yawRate/100;
  dynP8[YAW] = P8[YAW]*prop1/100;
  dynD8[YAW] = D8[YAW]*prop1/100;

  #if defined(VBAT)
    vbatRaw = (vbatRaw*15 + analogRead(V_BATPIN)*16)>>4; // smoothing of vbat readings 
    vbat = vbatRaw / VBATSCALE;                          // result is Vbatt in 0.1V steps
     
    if (vbat>VBATLEVEL1_3S) {
      buzzerFreq = 0; buzzerState = 0; BUZZERPIN_OFF;
    } else if (vbat>VBATLEVEL2_3S)
      buzzerFreq = 1;
    else if (vbat>VBATLEVEL3_3S)
      buzzerFreq = 2;
    else
      buzzerFreq = 4;
    if (buzzerFreq) {
      if (buzzerState && (currentTime > buzzerTime + 250000) ) {
        buzzerState = 0;BUZZERPIN_OFF;buzzerTime = currentTime;
      } else if ( !buzzerState && (currentTime > (buzzerTime + (2000000>>buzzerFreq))) ) {
         buzzerState = 1;BUZZERPIN_ON;buzzerTime = currentTime;
      }
    }
  #endif

  if ( (currentTime > calibrateTime + 100000)  && ( (calibratingA>0 && (nunchukPresent == 1 || accPresent == 1)) || (calibratingG>0) ) ) {  // Calibration phasis
    LEDPIN_SWITCH
    calibrateTime = currentTime;
  } else if ( (calibratingA==0) || (calibratingG==0 && !(nunchukPresent == 1 || accPresent == 1)) ) {
    if (armed) LEDPIN_ON
    else if (calibratedACC == 1) LEDPIN_OFF
  }
 
  if ( currentTime > calibratedAccTime + 500000 ) {
    if ( (nunchukPresent == 1 || accPresent == 1) && (abs(accADC[ROLL])>50 || abs(accADC[PITCH])>50 || abs(accADC[YAW])>400) ) {
      calibratedACC = 0; //the multi uses ACC and is not calibrated or is too much inclinated
      LEDPIN_SWITCH
      calibratedAccTime = currentTime;
    } else
      calibratedACC = 1;
  }
  if (currentTime > serialTime + 20000) { // 50Hz
    serialCom();
    serialTime = currentTime;
  }
  for(axis=0;axis<2;axis++)
    rcCommand[axis]   = (rcHysteresis[axis]-MIDRC) * (rcFactor2 + rcFactor1*square((rcHysteresis[axis]-MIDRC)));
  rcCommand[THROTTLE] = (MAXTHROTTLE-MINTHROTTLE)/(2000.0-MINCHECK) * (rcHysteresis[THROTTLE]-MINCHECK) + MINTHROTTLE;
  rcCommand[YAW]      = rcHysteresis[YAW]-MIDRC;
}
Now i hope this make more sense now,and if does,how can i implement it alone?
Thank you guys again.
Daniel
7  Using Arduino / Programming Questions / Re: Shift what? on: December 12, 2011, 09:15:00 am
You are perfectly right Myke.The original code is using a resistor divider to get the voltage of a 12V battery reading.It divides so that at 12.6Volts it gets 5V at analog pin.I just took the part of the code so i could read 5V directly in input.However the code using the divider it works perfectly fine.The VBATSCALE is defined 126 and i use VBATLEVEL_1 to define the voltage i want to monitor,for example 90 if the voltage drop below 9Volt.
But in my case i want to use the same code to measure a real 5V input,and trigger the led if it drops below 3V for example.I know i could already use the map function or something more simple,but i just wanted to understand how is this math used in this equation,especially the sift to the right.
I hope i dont make anyone mad about this,but making all the math into paper get me always to the overflow.
8  Using Arduino / Programming Questions / Re: Shift what? on: December 12, 2011, 08:12:29 am
Here is the complete code i am using.Using Analog3 as input on Arduino Pro mini,16Mhz and 5V supply.
Digital 8 as output to my led(the code is using a buzzer but i dont have one).The entire code is working,just i still not understand the math of how it retrieves the voltage in 0.1V steps.I perfectly understand the map function of the arduino but i dont get this.ANy help is appreciated.
Code:
#define BUZZERPIN_PINMODE          pinMode (8, OUTPUT);
#define BUZZERPIN_ON               PORTC |= 1<<6;
#define BUZZERPIN_OFF              PORTC &= ~1<<6;

#define VBAT              // comment this line to suppress the vbat code
#define VBATSCALE     50 // change this value if readed Battery voltage is different than real voltage
#define VBATLEVEL1_3S 45 // 4.5V

#define V_BATPIN 3

static uint32_t currentTime;
static uint32_t vbatRaw = 0;       //used for smoothing voltage reading
static uint8_t vbat;               //battery voltage in 0.1V steps
static uint8_t buzzerFreq;         //delay between buzzer ring
static uint8_t  buzzerState = 0;
static uint32_t buzzerTime;

void setup()
{   
BUZZERPIN_PINMODE 
}
void loop()
{
currentTime = micros();

 #if defined(VBAT)
    vbatRaw = (vbatRaw*15 + analogRead(V_BATPIN)*16)>>4; // smoothing of vbat readings 
    vbat = vbatRaw / VBATSCALE;                          // result is Vbatt in 0.1V steps
     
    if (vbat>VBATLEVEL1_3S)
    {
      buzzerFreq = 0; buzzerState = 0; BUZZERPIN_OFF;
    }
     else
        buzzerFreq = 1;
     if (buzzerFreq)
       {
         if (buzzerState && (currentTime > buzzerTime + 250000) )
           {
             buzzerState = 0;BUZZERPIN_OFF;buzzerTime = currentTime;
           }
         else if ( !buzzerState && (currentTime > (buzzerTime + (2000000>>buzzerFreq))) )
           {
             buzzerState = 1;BUZZERPIN_ON;buzzerTime = currentTime;
           }
      }
      #endif
 }
   
Thank you!
Daniel
9  Using Arduino / Programming Questions / Re: Shift what? on: December 12, 2011, 07:41:52 am
well there still is something spookie in this formula.The real thing is that in testing it works.I have a 5V power supply connected to A0 pin.I defined the VBATSCALE 50 (as it say in 0.1V steps). i can see the analogRead function reading correctly the pin.I have initialized the led on pin 13 and VBATLEVEL1_3S to 45.
With the potmeter if i turn down the supply to less than 4.5Volts on the analog pin the led start blinking.i tryed different voltage levels and it works perfectly.I just dont understand the math under that formula.Still must be something with that shift.
10  Using Arduino / Programming Questions / Re: Shift what? on: December 12, 2011, 07:02:29 am
ok i understood it is divided again by 16.But with every cycle the value of vbarRaw increase,even if i have constant analogRead of my analog pin.
Is it suppose to be like this or i am still missing something?
11  Using Arduino / Programming Questions / Re: Shift what? on: December 12, 2011, 06:43:49 am
I am still having trouble understanding the equation.So bare with me please and correct me where i am wrong.
Suppose i have the analogRead to 1023(5V to the input pin).
First time i get vbatRaw=0
so ((0 x 15)+(1023 x 16) >>4  that makes (16368)>>4 3
so the shift what does here? it takes the point 4 times to the left? Is the result 1.6368 ?
Thank you for patience and understanding.
Daniel
12  Using Arduino / Programming Questions / Shift what? on: December 12, 2011, 05:48:15 am
Hello guys.I have been on this forum for some time now and i am learning the programming doing different sketches.I found some lines of code in the free code of the Multiwii copter that i am interested in and i do not understand what is going on there.
Code:
#define VBAT              // comment this line to suppress the vbat code
#define VBATSCALE     126 // change this value if readed Battery voltage is different than real voltage
#define VBATLEVEL1_3S 103 // 10,3V

static uint32_t vbatRaw = 0;       //used for smoothing voltage reading
static uint8_t vbat;               //battery voltage in 0.1V steps
static uint8_t buzzerFreq;         //delay between buzzer ring



#if defined(VBAT)
    vbatRaw = (vbatRaw*15 + analogRead(V_BATPIN)*16)>>4; // smoothing of vbat readings 
    vbat = vbatRaw / VBATSCALE;                          // result is Vbatt in 0.1V steps
     
    if (vbat>VBATLEVEL1_3S) {
      buzzerFreq = 0; buzzerState = 0; BUZZERPIN_OFF;
    else
      buzzerFreq = 4;
what i cant understand is after getting the value from the analogRead,what is the >>4 doing there? I know it should be shift right with 4 elements but where?inside the value?The other part of the code i get it all.
Thank you
Daniel
13  Using Arduino / Project Guidance / Re: Measuring 2 imput voltages! on: November 14, 2011, 02:45:19 pm
Yes i know it is better an tachometer.But like i sad i dont need very accurate measurement.I know from the motor specifications that @ 400V it spin @ 3000min-1 .I only wanted to compare the 2 motors to see if sometimes they are out of sync by more than 10%. Most of the time they spin around 1000 min-1 both,i only need to see the situation if they both run more than 10% difference between each other.I hope i make myself understand,since i am not a native english man.
14  Using Arduino / Project Guidance / Re: Measuring 2 imput voltages! on: November 14, 2011, 02:20:13 pm
I am trying to do analog measurements of the 2 voltages.I think that i will have enough resolution to see the voltage from 0 to 400V if it will be scaled right to 0...5V with the divider.That will give almost 0.4V of resolution and i will be more than happy with that.My main concern is that i want to be sure that i will not combine by mistake the 2 voltages.
As for the other reply,how can i measure RPM and not measure voltage??
15  Using Arduino / Project Guidance / Re: Measuring 2 imput voltages! on: November 14, 2011, 01:09:28 pm
Well i think i made a mistake when i told in the first post that the 2 voltages are AC voltages.They both are already DC voltage,one is exactly 415V and the other is oscillating a bit from 385 to 395 volts.They both come from 2 different motor drivers that are driving 2 DC motors.The motors have an fixed 380V DC supply for the excitation of the stator.Practically i want to make a circuit with an small LCD,that will tell me if the 2 motors run at the same speed all the time.I though that reading the 2 voltages and compare them will achieve that,and i dont want to modify the drivers,neither to open them to see if i can find an common ground.
I also had another idea,to couple an dynamo to each motor end shaft and to compare the 2 voltages,that i could combine them with common ground.The only problem is that i have to add the 2 dynamo and the trouble to make the mechanical arrangement into the costs.
I hope that now i was clear enough about my problem,so maybe somebody have an better idea of how to achieve this.


Regards Daniel.
Pages: [1] 2 3