Show Posts
Pages: 1 ... 411 412 [413] 414 415 ... 539
6181  Using Arduino / Motors, Mechanics, and Power / Re: Arduino H-Bridge problem on: December 06, 2011, 11:58:14 am
That h-bridge can supply 2-3 Amps but even with no load the motor draws 1.5 Amps.  If stalled it draws 148 AMPS!
6182  Using Arduino / LEDs and Multiplexing / Re: cd4014b example? on: December 06, 2011, 11:33:26 am
The difference is that you have to raise the Clock pin after you raise the Parallel/Serial Control pin to latch the input data.

Code:
digitalWrite(latchPin, HIGH);  // Switch to Parallel Input
digitalWrite(clockPin, HIGH);  // latch the parallel data
digitalWrite(clockPin, LOW);
digitalWrite(latchPin, LOW);  // Switch back to serial operation
byte switches = shiftIn(dataPin, clockPin, bitOrder);
6183  Using Arduino / Displays / Re: Micro Projectors on: December 05, 2011, 11:39:06 pm
Here's an evaluation kit for only $2,000; http://www.microvision.com/pico_projector_displays/picop_dev_tools/pek.html

TI has a developer kit for $349: http://www.ti.com/tool/dlp1picokit

I have been unable to find a source of raw modules.  It looks like the manufacturers are only interested in large orders or something.
6184  Using Arduino / Programming Questions / Re: Please help me modify the basic PIR code. on: December 05, 2011, 11:13:55 pm
Just a note:  When doing timing with millis() always subtract the start time from the current time and compare against an interval.

Code:
// This version works even if the millis() timer rolls over (which it does every 49 days or so)
if (millis() - startTime >= 1000)  // This will let you know when it has been 1 second since startTime

// This version has problems with roll-over
if (millis() >= startTime + 1000)

Also note that millis() returns a value of type "unsigned long".  Storing it in an int or (signed) long will cause problems.
6185  Using Arduino / Programming Questions / Re: RGB fader with up/down buttons on: December 05, 2011, 11:06:15 pm
Code:
const int pgrmPin  =   10;//Define program switch

void setup() {
  pinMode(pgrmPin, INPUT);     //Digital PIN 10 (PB1)
}

void loop() {
  if (pgrmPin == HIGH)
}

Since prgmPin is set to 10 it will never be equal to HIGH (1).  What you meant to say is:
Code:
  if (digitalRead(prgmPin) == HIGH)

Which is equivalent to:
Code:
  if (digitalRead(prgmPin))
6186  Using Arduino / Programming Questions / Re: Please help me modify the basic PIR code. on: December 05, 2011, 10:56:05 pm
Code:
/* PIR sensor tester*/

int ledPin = 9; // choose the pin for the LED
int inputPin = 2; // choose the input pin (for PIR sensor)
int pirState = LOW; // we start, assuming no motion detected
int val = 0; // variable for reading the pin status
unsigned long lastDetectTime;

void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(inputPin, INPUT); // declare sensor as input

Serial.begin(9600);
}

void loop(){
 
val = digitalRead(inputPin); // read input value


if (val == HIGH)
{ // check if the input is HIGH
    lastDetectTime = millis();
    digitalWrite(ledPin, HIGH); // turn LED ON
    if (pirState == LOW) {
        // we have just turned on
        Serial.println("Motion detected!");
        // We only want to print on the output change, not state
        pirState = HIGH;
    }
}else
{
    if (millis() - lastDetectTime > 60000)
        digitalWrite(ledPin, LOW); // turn LED OFF
    if (pirState == HIGH){
        // we have just turned off
        Serial.println("Motion ended!");
        // We only want to print on the output change, not state
        pirState = LOW;
    }
}

}
6187  Using Arduino / Motors, Mechanics, and Power / Re: problem connecting more than one servo on: December 05, 2011, 10:51:50 pm
If you are connecting the servo power wires to the Arduino 5V pin you may be drawing more power than the Arduino has available.
6188  Topics / Science and Measurement / Re: Reading pulses (HIGH's and LOW's) from external device on: December 05, 2011, 07:09:23 pm
is each pulse 169.29 microseconds (4.74 mSec/28) long?

How do you know when the stream of bits starts?

I don't know if this is accurate enough but it should be a start:
Code:
while (digitalRead(inputPin) == LOW)   // Wait for a rising edge
       /* Do Nothing */ ;
unsigned long startTime = micros();
for (int bit = 0; bit < 48; bit++)
    {
    unsigned long bitTime = bit * 169.29;
    while (micros() - startTime < bitTime)   // Wait for bit to arrive
        /* Do Nothing */ ;
    bits[bit] = digitalRead(inputPin);
    }
6189  Using Arduino / Programming Questions / Re: 10 bit PWM on Mega 2560 on: December 05, 2011, 06:22:27 pm
Do you need a fairly exact frequency or just something in a general range?  What frequency or frequencies do you want?

I think that Fast mode 16-bir PWM will have a maximum frequency of 244 Hz.  Phase Correct mode will be half that.

I think that Fast mode 10-bit PWM will have a maximum frequency of 15,625 Hz.
6190  Using Arduino / Project Guidance / Re: I'm stuck on Step 3 of an Arduino light tutorial. Please help me figure it out! on: December 05, 2011, 01:51:07 pm
The power brick has a two-conductor wire going to a power connector.  The diagram on the power brick shows that the center connector is + (Red) and to outside connector is - (Black).  You can tape wires to the power connector or cut off he power connector and connect to the wire directly.
6191  Using Arduino / Installation & Troubleshooting / Re: Confused about 2009, eth and SD on: December 05, 2011, 12:39:13 pm
For data you need three of the SPI pins (D11, D12, and D13) and an unused data pin to act as the Slave Select pin.  You also need 3.3v power and Ground.  You should provide some voltage dividers between the Arduino's 5V outputs (MOSI, SCK, Slave Select) and the SD card's 3.3V inputs. I've used two 1k resistors in series between the Arduino output and Ground and connected the SD pin to the connection between the resistors.  This provides a (roughly) 2.5V logic signal which is plenty for a 3.3V device.  The 3.3V output of the SD card (MISO) will work fine with the 5V input of the Arduino.
6192  Using Arduino / Programming Questions / Re: 10 bit PWM on Mega 2560 on: December 05, 2011, 11:58:49 am
Time to read all about the 16-bit Counter/Timer registers in the datasheet.  There are 15 PWM modes, most of them are 16-bit but there are two 10-bit PWM modes: Fast and Phase Correct.  Pick one and learn what registers to set and how.
6193  Using Arduino / Sensors / Re: Need to have Arduino Uno talk with Analog ADXRS453 digital gyro on: December 05, 2011, 11:33:29 am
See figure 26 or 27 of the datasheet for the external components you should connect and where.  Then hook up MOSI, MISO, SCK, and SS/CS to the corresponding pins on the Arduino (See: Help->Reference->Library Reference->SPI)

Tables 9 and 10 show the 4-byte commands and 4-byte responses.  As you send a 4-byte command, using the SPI.transaction() function four times, the result of the PREVIOUS command will come in as the results of those four calls to SPI.transaction().

Registers 0 and 1 each contain 8 bits of data. Together they provide the current rate of rotation in (degrees per second * 80).  Divide the value by 80 to get Degrees per Second.  Integrate over time to get Degrees.
6194  Using Arduino / Project Guidance / Re: Controlling Relays via USB? on: December 05, 2011, 11:01:57 am
The Arduino can switch most SSR's directly and can switch a small relay directly or a larger electro-mechanical relay with a small transistor.

How much power are you switching?  Panasonic makes some 5V/20mA relays with 125V/10A contacts.  These could be driven directly from the Arduino output pins.  They are about $10 each.
6195  Topics / Science and Measurement / Re: 200-500mV Sensor? on: December 05, 2011, 10:00:04 am
I see two choices:
 1) Use a 10 Ohm sense resistor to get a 2V-5V range, then connect to an Arduino analog input.
 2) Use an op-amp wired with a gain of 10 to amplify the 500mV to 5V, then connect to an Arduino analog input.
Pages: 1 ... 411 412 [413] 414 415 ... 539