Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 68
61  Using Arduino / Programming Questions / Re: Reading and writing to a single digital pin on: February 11, 2013, 02:06:40 pm
I get a little lost reading your code.
Why do enable the internal pull-up resistor, and have an external pull-down resistor. That doesn't make sense.
Can you make two functions ? One to turn the led on and off, and another to read the switch ?

Code:
// example code, not tested.

int ledIsOn = false;

// Function Led.
//    Usage: Led(true); to turn led on
//               Led(false); to turn led off
void Led( int On)
{
  if( On)
  {
    // Set output high, before pin is made output.
    // If the output turns low, it could shortcut if button is pressed.
    digitalWrite( pushButton, HIGH);
    pinMode( pushButton, OUTPUT);
    // write once more to be sure.
    digitalWrite( pushButton, HIGH);

    ledIsOn = true;       // remember state of pin
  }
  else
  {
    // Can't make the output pin low,
    // that would shortcut if the button is pressed.
    // Return the pin to input state, without internal pull-up.
    // The led will turn off.
    pinMode( pushButton, INPUT);

    ledIsOn = false;       // remember state of pin
  }
}


// Function Switch.
//    Usage: return value is true of switch is pressed.
int Switch( void)
{
  int val;

  if( ledIsOn)
  {
    // The pin is in output state, we have to change that
    // to read the switch.
    pinMode( pushButton, INPUT);
    delay( 1);           // wait, due to the capacitance of the circuit.
    val = digitalRead( pushButton);
    Led( true);          // turn led on again.
  }
  else
  {
    val = digitalRead( pushButton);
  }
  return( val);
}

62  Using Arduino / Project Guidance / Re: New to this. Need advice with USB mouse interface on: February 11, 2013, 01:45:35 pm
What is the precise position needed for ?
A digital caliper is also very precise.
Some optical parts of a mouse can be controlled by an Arduino: https://www.sparkfun.com/products/10105?
A hall sensor and a magnet could be used for precise movements.
But not many devices can beat the precision of a gaming mouse, so the USB host shield can be used to read the mouse, like this project: http://www.circuitsathome.com/mcu/controlling-robotic-arm-with-arduino-and-usb-mouse

As PeterH wrote, using analog makes it harder, and I think you will also loose all the precision. Why do you want to use an aquisition board ?
63  Using Arduino / Project Guidance / Re: Read Wacom Tablet information on Arduino on: February 11, 2013, 11:46:25 am
I wish it would be that simple.

Do you know what the pins are ?
Do you know the serial baudrate ?
Do you know the communication protocol ?

The best way is to use one of the unused serial ports, and echo to the serial monitor what is received.
But you need an example of someone who has done this, otherwise I would not know how to do it. You want to implement a driver into an Arduino, that's not an easy task.
64  Using Arduino / Motors, Mechanics, and Power / Re: three servos, 4 motors, LED's....How do I power all this stuff? on: February 11, 2013, 09:09:24 am
The second one (DC-DC Buck converter) is okay. If 2A is okay for you.

I have doubts about the first one (switching power supply 12Volt 5 Amp). I bought a few switching power supplies from Ebay, and most of them can not deliver the current and they get overheated and get broken within a few month.

If you would also use a DC-DC converters for the motors, you don't need a regulated power supply. Perhaps you have some DC power supply already ? Or an adaptor of 19V for a laptop.
65  Using Arduino / Programming Questions / Re: pin-11 dysfunction on: February 11, 2013, 07:29:56 am
Is the pin high impedance while keeping the reset button pressed ?
66  Using Arduino / Motors, Mechanics, and Power / Re: three servos, 4 motors, LED's....How do I power all this stuff? on: February 11, 2013, 03:28:03 am
Are the DC to DC converters you describe the same as "buck converters?  I am looking at tutorials to understand your suggestion. Are these circuits or a single component?

DC-DC converters is a common name for step-up, step-down, boost and buck-boost converters.
Sometimes it is a small black box (with the components inside), but mostly it is a circuit board.
Some examples: http://www.ebay.com/sch/i.html?_nkw=dc+dc+converter
67  Topics / Education and Teaching / Re: Radio Frequency Interface Projects Books or Tutorials? on: February 11, 2013, 03:23:58 am
In the bar at the top is a "Playground" section.
This is about wireless communication: http://playground.arduino.cc//Main/InterfacingWithHardware#wireless
68  Using Arduino / Motors, Mechanics, and Power / Re: three servos, 4 motors, LED's....How do I power all this stuff? on: February 10, 2013, 07:56:34 pm
A 78-- or LM317 are for 1A or a little more and they get hot, you might need a heatsink.
A DC-DC converter is very efficient.

Do you use an Arduino and a motor driver ?
If the servos are 6V, you could use a DC-DC converter to 6V and use it for the adapter plug (or Vin) of the Arduino and the servos.

If you can power the leds with 12V or a with second DC-DC converter, you would only need a power supply of 12V.
69  Using Arduino / General Electronics / Re: Help Chosing a MOSFET to drive a fan on: February 10, 2013, 07:49:49 pm
Those are perfect.

Normal good old power mosfets need about 9V or 10V at the gate to switch it on.
So that's why you need a 'logic' power mosfet. They are designed to operate with logic levels from a microcontroller or a Arduino.

You could also buy any n-channel logic power mosfet from Ebay.
70  Using Arduino / General Electronics / Re: Servo Issues on: February 10, 2013, 07:33:56 pm
The servo is a servo. And a servo requires a pulsed signal.
But don't worry, a library takes care of the pulses.
http://arduino.cc/en/Reference/Servo
http://playground.arduino.cc/Learning/SingleServoExample
You only need three functions:
Declare the class before the setup() function with: Servo myServo;
Set the used pin in the setup() function with: myServo.attach( ServoPin);
Set the rotation angle in the loop() function with: myServo.write(50);

The servo should have some time after the myServo.write().
Add a delay(500); at the end of the loop() function.

Writing to an input for the pull-up resistor is no longer needed.
But you need the newest Arduino 1.0.3
You can specify the pull-up resistor with the pinMode() function: http://arduino.cc/en/Reference/pinMode

If you paste your sketch, you can use the code tags. It is the button with a '#' above the input text field.
It looks like this:
Code:
pinMode(SensorPin, INPUT_PULLUP);
71  Using Arduino / Programming Questions / Re: How do i change direction on: February 10, 2013, 12:55:59 pm
So i guess the next step is PID? or am i goint too fast again?
No, you are right on track.

But what about a single function that controls the speed and direction of the motor ? Like I wrote before with a parameter from -1000 to +1000. That way the PID can be set to those limits and the function will take care of the direction.
72  Using Arduino / General Electronics / Re: Running an external 5v power supply with an arduino on: February 10, 2013, 11:47:10 am
Signal wires needs a ground wire. So yes, the Arduino ground should be connected to the circuit board and sensors.
73  Using Arduino / Microcontrollers / Re: Arduino UNO: Using Analog Input as Digital In/Out on: February 10, 2013, 10:40:38 am
Are you sure ?
In my opinion the analog inputs do also have the internal pull-up resistors.
74  Using Arduino / General Electronics / Re: Running an external 5v power supply with an arduino on: February 10, 2013, 10:21:25 am
What kind of motors are connected to the motor shield, beside the servo ?

Your encoders and sensors use little current. So it is best to power them with the 5V pin of the Arduino (I assume that the Arduino is used to read the sensors).

The servo probably is a 5V servo ?
Those servos could easily use 1A. The best solution is to use a DC/DC converter to make 5V.

I don't understand you question about grounding. Can you make a photo or a drawing ?
75  Using Arduino / Installation & Troubleshooting / Re: Did I brick my arduino board ? on: February 10, 2013, 10:06:28 am
It's hard to say.
The FTDI chip correctly showing the leds, doesn't mean that the RX and TX path is still okay.

But if it happened to me, I would buy an ATmega328P and go for it.
Since you already have a programmer, let the Arduino IDE program a new bootloader into it.

You might have to write something on the board. Such things might cause problems later on. So if something weird happens in a year or two, you know it was the barbecued board.
Pages: 1 ... 3 4 [5] 6 7 ... 68