Loading...
  Show Posts
Pages: 1 ... 62 63 [64] 65 66 67
946  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.
947  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)
}
948  Using Arduino / Motors, Mechanics, and Power / Re: Arduino chip as Stepper Controller on: January 14, 2012, 10:28:17 pm
Less than 48 hours and I should have some chips in my hands...

Thinking of direct port output to speed up the output to the driver transistors. Something to study...
949  Using Arduino / Motors, Mechanics, and Power / Re: Start and stop of bipolar stepper motor on: January 14, 2012, 10:21:07 pm
Your stepper keeps spinning because you are continuing to send it step pulses.

Loop continues to run because its a loop. Outside of the program is a main() that calls loop repeatedly.

What signal are you using to start the step sequence?

Suggestion - the motor control sequence should be in a function of its own. To move the motor you call that function and the motor would move.

You might have 2 buttons for forward and reverse - you set direction to 0 or 1 and then call the move function.

You might consider making your function take an argument for the number of steps. makes it a bit more universal.

For now you could call your motor function from setup and it will run just once.
950  Using Arduino / Motors, Mechanics, and Power / Re: Strange servo-behavior on: January 13, 2012, 03:07:30 pm
I am not an authority... But I think it might be in the way yu have LenkA & LenkB declared inside loop(). I would think that they are getting reset every time through the procedure so eventually they are both passed through as 0 which sends you servo back to the 0 degrees position.

While your Computer Science instructor might not like it... declare LenkA & LenkB as globals up at the start of your code and see if it behaves better.
951  Using Arduino / Programming Questions / Re: help with incrementing code on: January 12, 2012, 05:52:08 pm
Might I suggest -

FanSpeed = int(( CurrentTemp - SetTemp)/5);

case(Fanspeed){
switch(FanSpeed)
   case 1:
   case 2:
      FanDrive = 0;
      break;    // less than 15 degrees
   case 3:
       FanDrive = 15;   // 15 - 25 degrees
       break;
   case 4:
      FanDrive = 25;
      break;
   case 5:
etc...

Basicaly scale your temperature difference by some constant ans then use that constant to set the fan speed.
952  Using Arduino / Project Guidance / Re: Decode NOAA Weather Radio SAME codes on: January 12, 2012, 05:33:11 pm
Start &Stop bits help here. Start Bits Especially. You are receiving zeros, and then you get a one. The one bit is there to synchronize the reciever to the incoming serial bit stream can properly feed the bits into a shift register. So - you would be looking for a 1, when it is recieved and timed out,  you would wait for 1/2 a bit time and then sample 5, 7 or 8, (depends on protocol) bit times and then you should get a zero bit or 2 depending on the protocol as stop bits.
953  Using Arduino / Project Guidance / Re: Need some kind of control over time in ISR interrupt on: January 12, 2012, 04:03:56 pm
Everybody is thinking the complex way...

Does anything else need to happen at the time when you are firing the injector? the injector needs to fire every time the routine runs, and for the specified time each time the routine runs. SO - The other possibility is to time it in the interrupt routine (this would keep other things from messing with the timing). You would be using values that would be calculated elsewhere, but the timing of the injector being open is a critical time. Critical time sensitive things are done in an interrupt routine.
954  Using Arduino / Motors, Mechanics, and Power / Re: Establishing PWM limits for Servo motor. on: January 12, 2012, 03:55:59 pm
Nope - They're not PWM..

They are PPM - it takes 2 pulses and the time between the pulses controls the servo position.
955  Using Arduino / Microcontrollers / Re: Open Hardware/Software friendly microcontrollers? on: January 11, 2012, 11:08:56 pm
Wiznet is a pretty cheap and hackable option. Everything is pretty wide open and you can get it in a small package. You can access Wiznet through serial or parallel (I have thought of memory mapping one on a Z180 board and have my CP/M machine with ethernet...)

While I am an advocate of creating as much as possible, this is sort or like trying to get a group together to create an open source micro-controller.

Perhaps you need to analyze your desires better so you can come up with a set a parameters instead of totally "blue skying it". You might well find that what you need already exists. I think you would find that the ethernet hardware (like Wiznet) would work great, but you would really need to look at the CPU and memory side of things to make a more elaborate system function.
956  Using Arduino / Microcontrollers / Re: Nitro Burning Arduino/AVR (Nitrouino)? on: January 11, 2012, 10:59:36 pm
Theyu go up to 20Mhz. Have you ever designed anything to work at those higher speeds? You probably want to look at other types of devices to get high speed A2D conversion...
957  Using Arduino / Project Guidance / Re: Encoder, Recording the position, speed and direction over time<-----possible? on: January 11, 2012, 10:52:38 pm
Take small steps. Start out by transferring the data to the serial port. That way you can examine it and make sure you are coming up with the right information. Then add a shield with an SD slot on it and learn to talk to the SD card. then start saving data to the SD card.
958  Using Arduino / Project Guidance / Re: Decode NOAA Weather Radio SAME codes on: January 10, 2012, 11:28:06 pm
Decoding an FSK Signal -

Basically FSK is a serial signal sent using 2 frequencies. What you need is a narrow pass filter to detect either of these frequencies and give you a one when it is detected. you then decode the pattern of ones and zeros to rebuild the bytes and assemble the bytes into your message.

Some purists might insist that you need 2 frequency decodes, but you can make the assumption that when one of the frequencies is not there the other is. SO - assume the zeros are there and look for the ones.

The weather and other EAS alerts consist of a message containing the alert information and codes for the areas for which the alert applies. They can be rather broad or rather specific.
959  Using Arduino / Motors, Mechanics, and Power / Re: Beginner questions - motors, controllers and power on: January 10, 2012, 03:50:05 pm
UM... Stepper motors don't work directly off PWM, they need multiple outputs, 1 for each phase.

DC motors will drive through a transistor and speed control through PWM.
960  Using Arduino / Project Guidance / Re: Fuel injection on: January 09, 2012, 10:35:35 pm
You may also want to look at Engine RPM. It gives you another way to also calculate air flow ( at any rpm you are going to move a certain amount of air) and give you another check on your other numbers. A little redundancy is sometimes a good thing.
Pages: 1 ... 62 63 [64] 65 66 67