Loading...
  Show Posts
Pages: 1 ... 57 58 [59] 60 61 ... 67
871  Using Arduino / Programming Questions / Re: Timer on delay? on: February 08, 2012, 02:29:02 pm
temp is >32  is the condition that says the LED is on.

What you might do is this -

add another variable like to your variable declarations --

Code:
int LEDFlag =0;  LEDFlag = 1
and modify your other code like this -It is a more general purpose approach.
You might want to look at checktime to make sure it is set correctly, and not reset

Code:
else if (temperature > 32){
      analogWrite(bluePin, 0);
      analogWrite(greenPin, 0);
      LEDFlag = 1;
    }
    else {
   LEDFlag =0;
   tone(speakerPin, 0);
   }
   if (LEDFlag){
      //alarm 10 sec delay
      if (millis() - checktime >= 10000){
        checktime = millis();
        tone(speakerPin, 200);
       }
   }
872  Using Arduino / Installation & Troubleshooting / Re: Can one concurrenty run multiple Arduino IDE versions under Win XP on: February 08, 2012, 02:00:43 pm
Should be able to work with more than 1 board. They should each have their own COM # assigned, order they are connected may make a difference though...
873  Using Arduino / Motors, Mechanics, and Power / Re: Opto-isolating a stepper motor on: February 08, 2012, 01:53:13 pm
Most of the time it isn't necesary, and if you are going to be pushing those steppers anywhere their limits the optos will limit your max speed.
874  Using Arduino / Programming Questions / Re: Automatic level adjustment on: February 07, 2012, 03:57:39 pm
Depending on the response time of the rest of the system, you may need to delay so that you have time for your change to take effect.

I once was trying to control a dryer in a ceramic machine. The heat would go up and down and up and down and sometimes would stabilize briefly. If I took more time between readings the system behaved much better. and would actually stabilize in a period of 15 to 20 minutes. WHat you need to do is have enough time for your changes to take effect before you attempt to make another change. If it takes 5 seconds for the system to respond to your changes then you need to slow down your control loop to match the system conditions.
875  Using Arduino / Installation & Troubleshooting / Re: My Arduino UNO set, rest continuallywhen l'm using external power supply on: February 07, 2012, 03:18:21 pm
What voltage is your external supply? and what voltage is making to the Arduino when the robot is in motion. If you are using the electrical jack on hte Arduino it needs 7 to 9 volts for the regulator on the Arduino board to function properly.
876  Using Arduino / Installation & Troubleshooting / Re: Small Amount of Voltage Creeping from Pins - That Normal? on: February 07, 2012, 03:16:04 pm
Do you have teh ground for your external circuit connected (tied) to the ground on your Mega board? that will cause all kinds of strange things to happen. Depending on what you are driving, you may want to put a resistor from that control point to ground. 1 KOhm is a good place to start. 220 Ohm would probably be minimum.
877  Using Arduino / Motors, Mechanics, and Power / Re: Tracked RC robot some questions on: February 07, 2012, 03:11:37 pm
With the Arduino you could make the robot more autonomous. You could add some sensors that would detect that it was against the wall of the tunnel and adjust track speed to keep it parallel. Or that could detect some distance from the wall and use it to guide the robot straight and parallel but ofset from the wall for each pas down the duct.  You could add sensors to detect where ridge in the pile of sand is and adjust the robots position to keep too much sand from dumping off the side of the blade that is in the area that has already been cleaned. If you did something like that then your RC link would be more of a guidance and override rather than CONTROL.
878  Using Arduino / Motors, Mechanics, and Power / Re: need a step motor controller for ULN2004 on: February 07, 2012, 03:00:21 pm
You might look at the topic under this heading - Arduino as Stepper Controller. http://arduino.cc/forum/index.php/topic,84809.0.html

Can do Full Step, Wave Step and Half Step.

Without optimizing it will accept Step pulses at greate than 1000 steps per second. (I have tested it to 146 RPM ) The speed limit for now is the fact that my pulse source is only capable of going that fast at the present time. If I change the clock on the ATtiny2313 I should be able to double that with nothing else required. If I can get my assembly code to work it should be able to go faster than the motor.
879  Using Arduino / Motors, Mechanics, and Power / Re: Arduino chip as Stepper Controller on: February 07, 2012, 02:52:59 pm
To program a chip I use Arduino-0.22 to load the ArduinoISP sketch on my Arduino Uno board. I made a small board that has 2 sockets, a 20 pin that could be used to program 20 and 8 pin chips and a 28 pin socket that I use to program 328's (like the Uno).  Search for Arduino as ISP as there is a lot of info out there that exlains the process and the wiring. My little board has 6 wires between the boards to program the chip and a 120 Ohm resistor between the Reset and +5 on the Arduino Uno. To program an Arduino sketch using the ArduinoISP there is a selection on the ArduinoIDE File menu to write the sketch usin Arduino as ISP.


I use the Arduino-0.22 IDE as there was a change in something in Arduino-1.0 and the ArduinoISP only works at 9600 baud instead of 19200 which causes a problem.

Here's a picture (poor) of my ISP board to use with the Uno.
880  Using Arduino / Motors, Mechanics, and Power / Re: Arduino chip as Stepper Controller on: February 07, 2012, 05:09:22 am
I am using the ATtiny2313 for this application. It has a few extra pins, It turns out I need 1 interrupt pin, 1 input and 4 outputs. I would also like to add 1 more input as an enable  and possibly a Ready output. The problem with trying to run more than one stepper in this application is the Interrupt inputs. Because of priority of interrupts the second interrupt would get missed if it occurred at the time as the first.

Look into some ATtiny2313 chips and use the Arduino as the programmer. That circuit is abut as inexpensive and simple as an Arduino circuit can be. If yuwant more info to use that approach I can point you to the few pieces you need to put together to do that.
881  Using Arduino / Motors, Mechanics, and Power / Re: step sequence for unipolar motor on: February 06, 2012, 06:28:56 pm
1000, 0100, 0010, 0001,... is not a wave sequence, but is called simple stepping.
1100, 0110, 0011, 1001,... is a wave stepping sequence

1000, 1100, 0100, 0110, 0010, 0011, 0001, 1001,... is half stepping and is a combination of the 2 previous sequences.
882  Using Arduino / Motors, Mechanics, and Power / Re: Arduino chip as Stepper Controller on: February 06, 2012, 06:21:51 pm
Finally can say I have an ATMel chip - the ATtiny2313 functioning as a stepper driver.
I got it working in Arduino, the assembler version still has some strange behavious (and the assembler version of the code is hareder to troubleshoot in hardware. In the Simulator it works just fine, but in hardware.....

Here's the Arduino version.
By my count it will run in excess of 140RPM  running in Half Step mode when driven by a simple Arduino program.

Code:
/*
Step & Direction Stepper Driver
 Pins 8, 9, 10, 11 are tied to transistors
 for each of the motor phases.
 Pins 2 is used as interruptfor the steps
 and 3 is the Direction.
 */
// the following 3 arrays contain the bit patterns to drive the transistors
// to in turn drive each of the phases of the stepper
int patSimple[] = {
  B0011,B0010, B0100, B1000, B0001, B0010, B0100, B1000};
int patWave[]   = {
  B0011, B0110, B1100, B1001, B0011, B0110, B1100, B1001};
int patHalf[]   = {
  B0001, B0011, B0010, B0110, B0100, B1100, B1000, B1001};
int pinDir = 5;
volatile int ctr;
volatile int dir;

void setup()
{
  DDRB = B1111 ;  // this enables Port B Bits 0 - 3, Arduino I/O 8, 9, 10, 11 as outputs
  pinMode(pinDir, INPUT);
  ctr=0;
  dir = 0;
  attachInterrupt(0, Step, FALLING);  // Depending on the application FALLING might be a better choice.

}

void loop()
{
  // Nothing to see here... 
}

void Step()
{
  if (digitalRead(5))
  {
    ctr++ ;
  }
  else
  {
    ctr-- ;
  }
  ctr = ctr & 7;
  // 2 of the following 3 lines must be commented.
  // PORTB = patsimple[ctr];  // Simple Stepping
  // PORTB = patWave[ctr];    // Wave Stepping
  PORTB = patHalf[ctr];      // Half Stepping


And I was testing it with code that looks like this in my Arduino-
Code:
int steps;

void setup() {               
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(2, OUTPUT);     
  pinMode(3, OUTPUT);   
  digitalWrite(3,HIGH); 
}

void loop() {
  for (steps=0;steps<400;steps++)
  {
    digitalWrite(2, HIGH);   // set the LED on
    digitalWrite(2, LOW);    // set the LED off
    delay(1);              // wait for a second
  }
}

Still want to crack the assembly code...
883  Using Arduino / General Electronics / Re: Increase emitter current NPN transistor on: February 06, 2012, 01:48:41 pm
Typically you would use a PNP transistor for a High Side switch. It would also require a resistir between the positive supply and the base and an NPN transistor between the Base and ground.

An NPN transistor is used as a low side switch with the base driven straight from the Arduino.

A High Side PNP transistor needs the Base voltage to be approx 0.7 volts below the positive supply for the transistor to turn on. If the Base is at the same voltage as the posotive supply the transistor turns off. To drive this from an Arduino you would need a resistor from the positive supply to the base of your PNP transistor, and an NPN transistor between the output transistor base and ground, and the base of this NPN to your arduino.

A Low Side NPN switch needs it base approx 0.7 Volts above the negative side of the supply to turn on and at 0 volts when off.

A High Side NPN switch would have to have its base at a voltage approx 0.7 volt above the voltage at the input terminal to your load. As the load is a motor this voltage would be variable depending on the load and thus would make for a difficult situation to control accurately.
884  Using Arduino / Programming Questions / Re: How to modify the stepper pins from a PC on: February 06, 2012, 12:48:24 pm
Since you are controlling this from your PC and serial port, why worry about tHose settings in the Arduino - just send it the number of steps you want and do the housekeeping in the PC.

You can drive more steppers from the Arduino if you make/get some driver boards that woulds only use 2 control wires - 1 for step and 1 for direction. Depending on how many motors are running at one time you could have multiple motors direction inputs tied together as long as you only drive one of them at a time, or keep track of those that can run the same direction and only run those together. As is, on an Arduino you could drive 6 step & direction type controllers. (And you could program a ATTiny2313 or similar chip as the brain in the controller driving the transistors/bridge connected to the motor.)
885  Using Arduino / Installation & Troubleshooting / Re: BURNING BOOTLOADER IN ARDUINO DIECIMILA on: February 06, 2012, 12:34:45 pm
Do you know anyone with an working Arduino board? You can program it to function as an ISP and use it to load a bootloader in your device.
Pages: 1 ... 57 58 [59] 60 61 ... 67