Show Posts
Pages: 1 ... 67 68 [69] 70 71 ... 73
1021  Using Arduino / Microcontrollers / Re: Doesn't autoreset after loading new sketch on: January 23, 2012, 02:01:45 pm
Are any of your voltage levels marginal in this application? It is possible that you have a chip that might be more sensitive to voltage levels and this is causing some sort of hangup.
1022  Using Arduino / Microcontrollers / Re: Chinese clones on: January 23, 2012, 01:52:38 pm
Why buy the Chinese clones? With a minor bit of effort you can program the bare chips and use them. I have made my own programmer board with a 20 pin and 28 pin socket and a 16Mhz resonator and I can program 8, 20 and 28 pin chips on it using my Arduino Uno. ATmel and whichever supplier I use make a buck and I don't have to wonder about the pirate company from China or Brazil.

Programing a chip directly is so simple, and takes no extra time and then you can embed the chip any way you want to. Might be better off investing a little of your time into designing a board and having a small batch made instead of buying a ripoff clone.

Personally, I am glad I got the Arduino Uno board to start with. I was able to get a device that worked, I was able to support the Arduino Project and I got the software and this forum. Great deal and a great price.
1023  Using Arduino / Programming Questions / Re: Hardware interrupt problem on: January 23, 2012, 01:08:13 pm
So - you just want this code to execute when the interrupt occurs?

You have 2 choices -
either put the code in the interrupt routine and it will execute whenever the interrupt is received

or

In the interrupt routine set a flag that you reset inside your routine in loop.

Kind of like this -

void Loop(){

    if (Flag) {
         your code here...
         Flag = 0;
      }

void Interrupt (){
   Flag = -1;
}

Working from my old and tired memory - you might want to swap the Flag = 0 and Flag = -1 to have it work properly.

Warning - will the code you want to run every interrupt execute in less time than the time between interrupts?
1024  Using Arduino / Motors, Mechanics, and Power / Re: Arduino chip as Stepper Controller on: January 23, 2012, 12:48:58 pm
Worked on the board for my first driver. Got it mostly soldered up and got to thinking that I would have to change the bleeder resistor as 56Ohms wold draw too much current from the 328, so I will have to pull them and get some resistors in the 120 to 220 range. Oh well, minor setback.
1025  Using Arduino / Programming Questions / Re: Cannot use the ArduinoISP to program attiny85. on: January 20, 2012, 08:51:40 pm
There is a problem with the 1.0 version of the IDE, load ArduinoISP using the 0.22 version of the IDE and it should work just fine.

Someone else had documented this problem so when the ArduinoISP didn't work when loaded from 1.0 I brought up 22 and loaded it from there and it worked just fine.
1026  Using Arduino / Motors, Mechanics, and Power / Re: Arduino chip as Stepper Controller on: January 20, 2012, 08:47:31 pm
Well it works. (almost didn't, hooked the chip up upside down and generated a little heat...) plugged the chip in and hooked up to my led drivers and it works.

Got a few things to take care of before I can play with it too much so ... The first of the week i should have a stepper driver working.

So - It is really rather easy to hook up an ATTiny2313 to an Arduino programmed as an ISP and load the code into the 2313. I did have to use version 0.22 of the Arduino Environment to have teh ArduinoISP work properly, but I stumbled across that little piece of info somewhere along the way.
1027  Development / Suggestions for the Arduino Project / Adding other boards to the Arduino IDE on: January 20, 2012, 01:31:45 pm
was able to get hold of the Arduino-Tiny files and add those processors to my Arduino 1.0 files.

What i am wonderring about is how to add another processor/board to the IDE. I would like to play with a ATMega324 (all those I/O pins...) but would like some document that would outline the process.

While I could do all the work using WinAVR or AVR Studio 4 (5 is too slow...) I like using the Arduino IDE and it provides the level of programming that I need.

Thanks
1028  Using Arduino / Motors, Mechanics, and Power / Re: Arduino chip as Stepper Controller on: January 19, 2012, 12:24:18 pm
Got my chips and parts on Monday and Tuesday night I put together a board for programming ATMega328 and ATTiny2313 chips. I didn't order any 120Ohm resistors so I had to wait til yesterday to test it out.

Used AVRDude to program the chips and had to add a section to the avrdude.conf file for the ATMega328 as it only had the ATMEga328P. I could have added the -F argument to the command string, but it was just as easy to add a section for the 328. Copied the whole 328P section and made 3 changes - in the 2 locations where 328P appeared I erased the P and I changed the System Descriptor bytes (avrdude reports what it finds if it doesn't agree) from 1E 95 0F to 1E 95 14 and everything worked. Took the chip out of the programming socket and swapped it for the chip in my Arduino board and loaded it with Blink.

I also put one of my ATTiny2313 chips in the and used the Arduino IDE to load the code to the 2313 and it seems to have loaded just fine. Have to hook up a circuit and test out the chip. Will probably be Sunday night before I get the chance as I have too much in my schedule between now and then.

I will post a picture of my programmer board and a schematic the first of the week.
1029  Using Arduino / Motors, Mechanics, and Power / Re: Second-hand stepper motors on: January 19, 2012, 12:11:19 pm
The biggest problem with found steppers is that they tend to be Bipolar steppers. That means there are only 4 wires and you need an H-Bridge to drive them. Unipolar steppers have 5, 6 or 8 wires and are simpler to interface - you only need 4 transistors and 4 diodes(or 4 irf520 or similar FETs) and your Arduino.
1030  Using Arduino / Project Guidance / Re: Stepper driver interference/noise ? on: January 18, 2012, 01:47:07 pm
From your description this is what I think I am reading -

you have 2 stepper drivers connected to you Arduino.
The Arduino is supplying the 5V DC for the logic side of your stepper drivers.
The output side of the drivers shares a 12VDC supply.

When running both devices at different rates you get some noise to one or the other driver.

I would question whether the Arduino has enough power to cleanly supply power to the logic side of the 2 drivers. I would suggest that you make sure you have a big enough supply for the logic side of the drivers and use it to power the Arduino board. You may be putting enough load on the Arduino 5VDC that you are pulling the voltage level down at the Arduino and the drivers are nit getting quite the signal level they want. Or suply the Arduino through the USB (I am assuming you are probably working on code) and the stepper drivers with their own 5V supply with all grounds tied together.
1031  Using Arduino / Motors, Mechanics, and Power / Re: Stepper Question on: January 17, 2012, 06:30:08 pm
A schmidt trigger is used to clean up a signal. I think you might have meant an inverter.

You are going to get negative to positive, and positive to negative transistions of your step and direction signals from the Arduino so there should be no problem.
1032  Using Arduino / Motors, Mechanics, and Power / Re: Start and stop of bipolar stepper motor on: January 15, 2012, 09:14:23 pm
Unless you have some sort of homing switch you have no way of knowing where the motor is other than looking at it. As far as keeping track of position, you will have to have a counter that you can use to monitor the current position. For a 200 step motor - 50 full steps = 90 degrees.

Sounds like button 1 - go to 0 degrees, then move to 90 degrees?
button 2 go to 0 degrees then move to 180 degrees

and such?

You can use the step routines, or create your own. Not very hard to do.
1033  Using Arduino / Motors, Mechanics, and Power / Re: Restricting Servo Boot Up Movement on: January 15, 2012, 09:09:06 pm
Does the Arduino send anything other than noise to the servo on startup? Is this just noise that occurs before the code is running? Might try a relay in the power circuit to the servo and turn it on at the end of the setup routine. You might still get some jump as the amplifiers and motor bridge in the servo come alive. Some servos are worse than others as to how they will twitch when they are powered up.
1034  Using Arduino / Project Guidance / Re: Don't string me up... Moving to arduino circuits to beaglebone on: January 15, 2012, 01:27:01 pm
Have you looked at the other ATMega chips like the 324? you can get a 40 pin DIP version that has a bunch more I/O and still could use the same tools. And you could have it in a couple days instead of "someday..."

Perhaps that would be a choice for an Arduino Dos - the AtMega324 or ATMega644 based on teh 40 pin DIP version.
1035  Using Arduino / Motors, Mechanics, and Power / Re: Arduino chip as Stepper Controller on: January 15, 2012, 12:19:57 pm
Okay - Now I've done it smiley-grin...

Got looking for Direct Port I/O and found a part of the Arduino documentation that doesn't seem to have a direct link.
Here's the link - http://arduino.cc/en/Reference/PortManipulation
It explains some of the problems and some of the uses. In a general Arduino project you might not want to use this approach as there are a few pitfalls that the Arduino IDE hides from you, and that is not always a bad thing. As i intend to use this in a dedicated chip it should cause me no problems.

Port B on the Arduino/ATMege328 is pins 8, 9, 10, 11, 12, 13, with the 2 remaining pins used by the crystal/resonator
DDRB is the Data Direction Register. Assigning 1 to a bit makes it an output, 0 makes it an input.
PORTB is the predefined variable that lets you read or write port B.
PORTB = B0001 turns on pin 8 and turns off pin 9, 10 & 11.

I also used pre-initialized arrays to set up the step patterns.

Down to 1232 bytes.

Here's the last version of the code -
Code:
/*
Step & Direction Stepper Driver
 Pins 8, 9, 10, 11 are tied to transistors
 for each of the motor phases.
 Pins 2 & 3 are used as interrupts,
 Pin 2 as Step and 3 as 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 = 3;
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, RISING);  // Depending on the application FALLING might be a better choice.
  attachInterrupt(1, Direction, CHANGE);
}

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

void Step()
{
  if (dir)
  {
    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


void Direction()
{
    dir = -digitalRead(pinDir);    // Direction is 0 (zero) or -1 (minus one)
}
Pages: 1 ... 67 68 [69] 70 71 ... 73