Show Posts
Pages: 1 [2] 3 4
16  Using Arduino / Microcontrollers / When will the new code be available to use an UNO as an ISP? on: December 21, 2011, 02:42:37 pm
3 weeks ago I bought an Arduino UNO to use as an ISP board.

Now I read this on the Arduino site.

"NOTE: Currently, you cannot use an Arduino Uno as an ISP programmer because the optiboot bootloader does not support this sketch. A revision for this is in progress."

Because no target is mentioned I wonder when the new revision will be ready, I'm almost ready to start programming some Attiny chips, just waiting for some capacitors to arrive.

17  Using Arduino / Sensors / Re: how to read PWM signal from RC receiver on: December 03, 2011, 04:53:39 pm
Quote
The receiver makes a PWM signal for each channel (receiver output to esc, servo's and my attiny) from the PPM signal (receiver input).
Servos typically use PPM as their input, as do ESCs.
It simplifies the decoder in the receiver.
Your setup may be an exception.

http://www.brookshiresoftware.com/rd_how_servos_work.htm

Now I'm lost.

I have audio tester, maybe I'll measure it next week and know for sure.
18  Using Arduino / Sensors / Re: how to read PWM signal from RC receiver on: December 03, 2011, 12:04:40 pm
@John,

Thanks for the micros function, but what if my second PWM changes while the interrupt on the other pins is executed?
(is it possible to monitor 2 PWM signals simultaneously with one attiny)

@AWOL,

I will look into it but I think PPM is the signal type used between the transmitter and receiver.

The receiver makes a PWM signal for each channel (receiver output to esc, servo's and my attiny) from the PPM signal (receiver input).
I'm 99% sure about this.
19  Using Arduino / Sensors / Re: how to read PWM signal from RC receiver on: December 03, 2011, 10:42:01 am
Thanks,

I'm afraid I cannot use PulseIn as it waits for the end of the pulse and I want to run 2 processes at the time (read out 2 channels from the receiver).

There is a function called millis which would be perfect if it would be in microseconds.
Is there a way to measure time in the background in microseconds?

Thanks
20  Using Arduino / Sensors / how to read PWM signal from RC receiver on: November 21, 2011, 03:25:08 pm
Hi,

I would like to use PWM signals from my RC car receiver to steer some leds.

I would like to activate brake lights when the car is braking and flash a set of head lights for x times when I push the button on the 3rd channel. (like used at le mans when a prototype is getting close to a slower vehicle)
Also the voltage from the LiPo should be monitored and when it droppes below 6,6V a bright red led should be turned on in the cockpit. There are IC's readily available which switch at a certain voltage, I just have to look for them to make an input signal for the chip.

I intend to use a tiny45 chip and wonder how the chip can read the PWM signals from the receiver.

Can the chip "read" the PWM signal and know the pulse width or should I make an RC network to make an analog input and map it?

Thanks

21  Using Arduino / Sensors / ... on: March 06, 2011, 08:49:49 am
...
22  Using Arduino / Sensors / trouble reading rotary encoder on: February 16, 2011, 12:02:48 pm
Hi,

I have received 2 318-ENC130175F-12PS rotary encoders yesterday and have been playing with them all day today, or at least tried to play with them.

I'm using this code, from the Arduino site, and nothing happens.

Code:
#define encoder0PinA 2
#define encoder0PinB 3

volatile unsigned int encoder0Pos = 0;

void setup() {
  pinMode(encoder0PinA, INPUT);
  pinMode(encoder0PinB, INPUT);
  attachInterrupt(0, doEncoderA, CHANGE);  // encoder pin on interrupt 0 (pin 2)
  attachInterrupt(1, doEncoderB, CHANGE);  // encoder pin on interrupt 1 (pin 3)
  Serial.begin (9600);
  Serial.println ("start reading encoder");
  Serial.println (encoder0Pos, DEC);
}

void loop(){ //Do stuff here
}

void doEncoderA(){
  if (digitalRead(encoder0PinA) == HIGH) {   // look for a low-to-high on channel A
    if (digitalRead(encoder0PinB) == LOW) {  // check channel B to see which way encoder is turning
      encoder0Pos = encoder0Pos + 1;         // CW
    }
    else {
      encoder0Pos = encoder0Pos - 1;         // CCW
    }
  }
  else                                       // must be a high-to-low edge on channel A                                       
  {
    if (digitalRead(encoder0PinB) == HIGH) { // check channel B to see which way encoder is turning 
      encoder0Pos = encoder0Pos + 1;         // CW
    }
    else {
      encoder0Pos = encoder0Pos - 1;         // CCW
    }
  }
  Serial.println (encoder0Pos, DEC);         // use for debugging - remember to comment out
}

void doEncoderB(){
  if (digitalRead(encoder0PinB) == HIGH) {   // look for a low-to-high on channel B
    if (digitalRead(encoder0PinA) == HIGH) { // check channel A to see which way encoder is turning
      encoder0Pos = encoder0Pos + 1;         // CW
    }
    else {
      encoder0Pos = encoder0Pos - 1;         // CCW
    }
  }
  else {                                      // Look for a high-to-low on channel B
    if (digitalRead(encoder0PinA) == LOW) {   // check channel B to see which way encoder is turning 
      encoder0Pos = encoder0Pos + 1;          // CW
    }
    else {
      encoder0Pos = encoder0Pos - 1;          // CCW
    }
  }
  Serial.println (encoder0Pos, DEC);         // use for debugging - remember to comment out
}

Should I use resistors between the encoder and the pins?
Are the pins analog or digital pins?

There are no images showing how to connect stuff in the playground.

as I rotate the encoder and the serial monitor is started nothing happens.

Did I break my Arduino not using resistors and shorting the pins to 5V? (I have tested all used pins as inputs and they still seem to work fine)

23  Using Arduino / Sensors / Re: controlling DC motor with encoder on: February 05, 2011, 03:23:59 pm
Hi,

This is my code so far:
Code:
/* Using 1 potentiometer to control h-bridge
 * forward from zero to highest rpm
 * stop
 * reverse from zero to highest rpm
 * by Leo Groeneveld
 */
 
int potpin2 = 2; // analog pin used to connect the potentiometer2
int val2;        // variable to read the value2 from the analog pin2
int pwmval2;     // variable to set the value of the PWM signal
int pwmval3;     // variable to set the value of the PWM signal

void setup()  {
    pinMode(2, OUTPUT); // declare pin 2 to be an output:
    pinMode(3, OUTPUT); // declare pin 3 to be an output:
    analogWrite(2, 0);  // start with no output on PWMpin2
    analogWrite(3, 0);  // start with no output on PWMpin3
    Serial.begin(9600);
}

void loop()  {
  val2 = analogRead(potpin2);       // reads the value of potentiometer2 (value between 0 and 1023)
  if (val2 > 461 and val2 < 561) {  // dead-band
  analogWrite(2, 0);                // when in dead-band no signal to digital pin2
  analogWrite(3, 0);                // when in dead-band no signal to digital pin3
  }
 
  if (val2 >= 0 and val2 <= 461) {      // motor rotating one direction
  pwmval2 = map(val2, 0, 461, 255, 0);  // motor rotating in one direction slow to highest rpm
  analogWrite(2, pwmval2);              // writes PWM value to digital pin2
  }
 
  if (val2 >= 561 and val2 <= 1023) {      // motor rotating in other direction
  pwmval3 = map(val2, 561, 1023, 0, 255);  // motor rotating in other direction slow to highest rpm
  analogWrite(3, pwmval3);                 // writes PWM value to digital pin3
  }
Serial.println(pwmval2, DEC);
}


I can control speed too.

I have taken an old printer apart and would like to be able to steer the printing head left and right to a certain position using a linear encoder but that's also an A B type. The current motor is small and easy to experiment with.

In the future I would like to build a robot arm with a friend of mine and we would like to use a DC motor to rotate the whole arm and model servos for the other movements.

24  Using Arduino / Sensors / Re: controlling DC motor with encoder on: February 05, 2011, 02:58:56 pm
Thanks,

Is this an interrupt code? I mean will it not miss any input from the encoder when looping through the code for the pot and L298N?

EDIT: Just read it isn't interrupt based, for direction it's no problem. In the future I would like to use it to determine position, after going to a micro switch after the Arduino is started, so the code will have to be adapted.

Leo
25  Using Arduino / Sensors / controlling DC motor with encoder on: February 05, 2011, 02:18:21 pm
Hi,

I have managed to steer a 12V DC motor with the use of one pot. I can control left and right turning and stop. I have used a L298N IC, some diodes, capaciters, a pot and lots of jumper wires.

Now I would like to read out the A B encoder which is in the motor and use a LCD display to display "motor turning left", "motor turning right" and "motor stop". I could use the pot value as input for the display but I will not learn from it and if the motor would be stuck it wouldn't be right anyway.

This is the motor I'm using:
http://www.mrutty.com.au/Portescap%20Pages/Specification%20PDFs/16N%20Series%20(16mm).pdf

I have looked for it but I can't find a code I can use as example code, can anybody help me get on the way?

Thanks,

Leo
26  Forum 2005-2010 (read only) / Bugs & Suggestions / suggestion on: January 15, 2011, 12:09:34 pm
I would appreciate a home button to the Arduino home page on top of the forum.

Leo
27  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: 2nd reset button possible? on: January 16, 2011, 04:12:30 pm
Found it after reading the post mentioning it.

thanks,


28  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: 2nd reset button possible? on: January 16, 2011, 03:58:44 pm
Ok thanks, maybe that's a better idea.

Would you believe I looked at the board for reset and completely missed it???
29  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: 2nd reset button possible? on: January 16, 2011, 01:22:08 pm
Sorry for kicking an old thread but I don't understand this possibility.

Quote
Actually it can be as simple as wiring your additional reset switch between the Arduino reset and ground pin, no soldering required.

Lefty

I have a Mega1280 (clone) and am wondering where the reset pin is.
(I know where ground is smiley)
And should there be a resistor added?
I need this as an emergency stop for a tool.

Thanks,
30  Forum 2005-2010 (read only) / Frequently-Asked Questions / what switch to get that doesn't pop out on: January 15, 2011, 12:03:51 pm
Hi,

I'm getting a bit annoyed with the microswitches which were in the Arduino package I got. The things keep popping out of the breadboard.

Are there other (micro)switches I can use in a breadboard that don't pop out all the time?

Thanks,

Leo
Pages: 1 [2] 3 4