Show Posts
Pages: 1 [2] 3 4
16  Forum 2005-2010 (read only) / Interfacing / Re: HM55B compass with pan servo on: August 01, 2008, 09:04:46 pm
I understand the problem with "near north" headings. If you try to do some smoothing by averaging 358 degrees and 2 degrees you get "south"!

But, that doesn't matter. Your servo, unless it is non-standard, can not go in a full circle anyway. 0 to 180 are the inputs used in the servo libraries, but unless I remember something wrong, 90 to 120 degrees is all the further most servos turn.

When the compass says 0, set the servo to 0. When the compass says 359, set the servo to 180.  That is as far as it can go. So the bottom line is:  ServoValue = CompassValue / 2

When you slowly turn through north, the servo will come to the end of its travel, quickly reverse all the way to the other end, then move slowly again to track the course.


17  Forum 2005-2010 (read only) / Interfacing / Re: Switching with Software on: August 05, 2008, 08:12:15 pm
You probably want one of these http://www.maxim-ic.com/products/switches/   to be controlled by an Arduino.

18  Forum 2005-2010 (read only) / Interfacing / Re: Need help on: April 07, 2008, 06:55:17 pm
Quote
I was just trying to test to see if the sensor work with an LED, but for some reason it does not work.
 

Are you sure that the output of the PIR has sufficient drive to light an LED?

Is it outputting correctly when connected to a voltmeter or other sensitive device?

Remember that the PIR may stay triggered for a while, making it hard to work with. Try putting it on the far side of your breadboard, facing away from you. Let it settle. Then put your hand over the top to trigger. That way every time you turn to type in some code or to grab the soldering iron you don't retrigger.


19  Forum 2005-2010 (read only) / Troubleshooting / Re: Own battery pack for arduino on: July 26, 2008, 10:04:27 pm
Yes, that is fine in concept. Maybe not implementation.

It is hard to tell, but from the looks of the photo you have made a 6V pack and a 3V pack sharing a ground and then having two V+ terminals (one 3V & one 6V). Only the 6V looks connected to the barrel plug. ??

If in reality the two V+ terminals are connected together, then you are "charging" the 3V pack from the 6V pack. Ungoodness will result.

This is what you need:

red -----------  barrel plug center
|
2 cell, 3V pack
|
black
|
red
|
4 cell, 6v pack
|
black---------- barrel plug outer


I can't imagine how you read 8V, unless you are wired the way I suggest but your cells are old, or one is bad.


20  Forum 2005-2010 (read only) / Troubleshooting / Re: Flash trigger, dangerous for Arduino? on: April 22, 2008, 07:12:11 pm
Quote
I recently acquired an old 420ez flash unit. It's an older a-ttl flash unit but it is triggered by anything from 1.5 volts. Would anyone know if hooking this directly up to the arduino digital pins would be dangerous for it? What would be my best option. On MAKE recently someone used an optoisolator, but I am located in Russia and parts are hard to come by, would anyone else have any ideas?

If you want the security of optical isolation but can't get a "regular" opto isolator, you can make your own with an LED, a phototransistor, and a piece of heat shrink tubing to hold it together and provide "dark."

21  Forum 2005-2010 (read only) / Troubleshooting / Re: Flacky Arduino board ! on: April 12, 2008, 07:48:27 pm
As above, posting code is the good thing.

Biggest failures, in no particular order -- not initializing a variable before using it; not having pull up (down) resistors on inputs; writing beyond string / array bounds; off-by-1 loops; writing huge masses of code, all untested (do write and test indvidual functions); input values from I/O or external code outside of safe / expected range; hmm shall I go on?
22  Forum 2005-2010 (read only) / Development / Re: Skinny from SparkFun on: May 30, 2008, 08:36:21 pm
Oooh. I like it.

Ladyada comments dittoed.

23  Forum 2005-2010 (read only) / Interfacing / Re: arduino and rc gyro on: April 21, 2008, 07:43:44 pm
Quote
Hi all!

any one  know if i can get the signal from  rc gyroscope to the arduino ?
I have this type of rc gyro :

http://www.funrctoys.com/0704a-head-lock-esky-p-1619.html

and i'm trying to get a lateral movement perception control and put the signal outpu from the gyro directly in the analog input of the arduino board...but can't get any changing value !!




i use this code :

/////////////////////////////////////////////////
int gyroIN=0;
 
 
void setup(){
  
  Serial.begin(19200);
 Serial.println("ready!");  
 //pinMode(gyroIN,INPUT);
  
  }
void loop(){
    
int valeur = analogRead(gyroIN);
 
Serial.println(valeur);
 
delay(10);
    
    }
 
 
/////////////////////////////////////////////////////////////




i think that the gyro signal is a pulse value like a servo motor....but how to do this ????



fbm


 

I doubt that this will help you, but just in case it is news...

1) An R/C gyro can't detect lateral motion, it detects rotation.
2) An R/C gyro is a rate gyro, not a position gyro. It only outputs non-null pulse widths *while* the gyro is turning. If you turn it 45 degrees and leave it there, the pulse width momentarily goes non-null, then becomes null (1.5mS ?) when there is no more turning.

Usually these devices are put inline between the receiver and the rudder servo, and modify the rudder command pulse width. Is it possible that, lacking an input pulse train, the gyro does not output any pulses at all. (Causing your freeze?)(Grasping at straws here.)

24  Forum 2005-2010 (read only) / Interfacing / Re: Getting GPS data from GM862-GPS on: August 01, 2008, 08:21:13 pm
Quote
The module sits completely on top of the Arduino so there are no unconnected pins.

Sitting on top of something does not make a connection. In fact, you may short out things that shouldn't be.

Sad story from a decade ago: Once I had a boss come up to the roof to check on a couple of us, just as we were about to pack up and come down for lunch. He offered to help carry things. He picked up the 12V gel cell we were using for power, and a bare circuit board prototype of our equipment. He set the bare board on top of the battery. As we are all riding down on the elevator I glance over to see this. My heart just falls. He's like, "is that a problem?" Duh! Lesson for young engineer kBit: put your boards in / on some sort of case or at least standoffs.

Back to your problem.

I went to look at the data sheet. I see this:

Note: If not used, almost all pins should be left disconnected. The only exceptions are the following
pins:  
 
pin signal
1,3,5,7 VBATT
2,4,8 GND
17 ON/OFF*
20 TXD
23 RESET*
37 RXD
45 RTS1
                                                
( footnote 1)
 RTS should be connected to the GND (on the module side) if flow control is not used


Have you made every one of those connections?

What pins on the Arduino are you using to communicate with what pins on the GPS? How are you converting from the 2.8 V GPS signals to the Arduino 5 V signals?

Post the code you use to listen to the GPS.


25  Forum 2005-2010 (read only) / Interfacing / Re: Getting GPS data from GM862-GPS on: July 30, 2008, 08:45:41 pm
Are you not getting position data? ==> Could be you are not receiving signal. GPS uses a very low power microwave frequency. Easily blocked by roofing materials, overhead foliage, even very heavy rain. Do you have an antenna connected with nothing but blue sky above it?

Are you not getting any readable data (you get garbage out)? ==> Check baud rates, signal levels, and inversion.

Are you getting nothing, nothing, nothing? ==> Is the GPS actually active and drawing current (not sleeping)? Ensure that there are no unconnected inputs (enable, reset, sleep, etc.).


26  Forum 2005-2010 (read only) / Interfacing / Re: DS18B20 Not returning anything "CRC is not val on: August 10, 2008, 02:19:38 pm
Quote
Also, I use a 4.7k resistor for the pull up, and it seems to work fine for me

Indeed, that is what the data sheet says, and what I used. (changed in connection list to be correct.)

Don't know why I thought it was a few hundred rather than a few thousand...Gettin old, I guess.

27  Forum 2005-2010 (read only) / Interfacing / Re: DS18B20 Not returning anything "CRC is not val on: August 09, 2008, 07:53:01 pm
When getting started, I found it easier to not use parasite power mode.

You don't mention having a pull up resistor on the data line. I too got all "0" until I realized I left it out. I forget the value, look in the data sheet. 330-450 ohms?

Arduino gnd --> DS gnd
Arduino 5V --> DS Vdd
Arduino pin 3 --> DS Dout
4700 ohms from DS Vdd to DS Dout

use this code:
Code:
#define TEMP_PIN  3

void OneWireReset(int Pin);
void OneWireOutByte(int Pin, byte d);
byte OneWireInByte(int Pin);

void setup()
{
    Serial.begin(9600);
    Serial.print("temperature measurement setup in progress\n");

    pinMode(TEMP_PIN, INPUT);      // sets the digital pin as input (logic 1)
    digitalWrite(TEMP_PIN, LOW);
    delay(100);
}

void loop()
{
  int HighByte, LowByte, TReading, SignBit, Tc_100, Tf_100, Whole, Fract;

  OneWireReset(TEMP_PIN);       // reset
  OneWireOutByte(TEMP_PIN, 0xcc); // skip ROM code
  OneWireOutByte(TEMP_PIN, 0x44); // perform temperature conversion, strong pullup for one sec

  OneWireReset(TEMP_PIN);         // reset
  OneWireOutByte(TEMP_PIN, 0xcc); // skip ROM code
  OneWireOutByte(TEMP_PIN, 0xbe); // Read scratchpad code (temperature in this case)

  LowByte = OneWireInByte(TEMP_PIN);
  //Serial.print("Low byte = ");
  //Serial.print( LowByte );
  //Serial.println();
  
  HighByte = OneWireInByte(TEMP_PIN);
  //Serial.print("High byte = ");
  //Serial.print( HighByte );
  //Serial.println();

  TReading = (HighByte << 8) + LowByte;
  //Serial.print("Raw temp = ");
  //Serial.print( TReading );
  //Serial.println();

  SignBit = TReading & 0x8000;  // test most sig bit
  if (SignBit) // negative
  {
    TReading = (TReading ^ 0xffff) + 1; // 2's complement the answer
  }
  Tc_100 = (6 * TReading) + TReading / 4;    // multiply by (100 * 0.0625) or 6.25

  Whole = Tc_100 / 100;  // separate off the whole and fractional portions
  Fract = Tc_100 % 100;

  
  if (SignBit) // If its negative
  {
     Serial.print("-");
  }
  
  Serial.print(Whole);
  Serial.print(".");
  if (Fract < 10)
  {
     Serial.print("0");
  }
  Serial.print(Fract);
  Serial.print("C\n");

  Tf_100 = ((Tc_100 * 9) / 5) + 3200;
  Whole = Tf_100 / 100;  // separate off the whole and fractional portions
  Fract = Tf_100 % 100;

  
  if (SignBit) // If its negative
  {
     Serial.print("-");
  }
  
  Serial.print(Whole);
  Serial.print(".");
  if (Fract < 10)
  {
     Serial.print("0");
  }
  Serial.print(Fract);
  Serial.print("F\n");

  Serial.print("\n");

  delay(2000);      // 2 second delay.  Adjust as necessary
}

void OneWireReset(int Pin) // reset.  Should improve to act as a presence pulse
{
     digitalWrite(Pin, LOW);
     pinMode(Pin, OUTPUT); // bring low for 500 us
     delayMicroseconds(500);
    
     pinMode(Pin, INPUT);
     delayMicroseconds(500);
}

void OneWireOutByte(int Pin, byte d) // output byte d (least sig bit first).
{
   byte n;

   for(n = 8; n != 0; n--)
   {
      if ((d & 0x01) == 1)  // test least sig bit
      {  // if it is "1", pull low for just 5uS
         //digitalWrite(Pin, LOW);
         pinMode(Pin, OUTPUT);
         delayMicroseconds(5);
        
         // then wait (external resistor pulls line back high)
         pinMode(Pin, INPUT);
         delayMicroseconds(60);
      }
      else
      {  //lsb is "0", so pull low for 60uS
         //digitalWrite(Pin, LOW);
         pinMode(Pin, OUTPUT);
         delayMicroseconds(60);
        
         // release, allowing external resistor to pull high
         pinMode(Pin, INPUT);
      }

      d = d >> 1; // now the next bit is in the least sig bit position.
   }
  
}

byte OneWireInByte(int Pin) // read byte, least sig byte first
{
    byte d, n, b;

    for ( n = 0; n < 8; n++ )
    {
        // digitalWrite(Pin, LOW);
        // pull pin low for 5uS
        pinMode(Pin, OUTPUT);
        delayMicroseconds(5);
        
        // release pin, allowing external resistor to pull line back high for 5uS
        pinMode(Pin, INPUT);
        delayMicroseconds(5);
        
        // DS18B20 either pulls line low, or leaves it high
        // find out which...
        b = digitalRead(Pin);
        
        // wait bit time
        delayMicroseconds(50);
        
        // assemble our collected bits
        d = (d >> 1) | (b << 7); // shift d to right and insert b in most sig bit position
    }
    return(d);
}

28  Forum 2005-2010 (read only) / Interfacing / Re: Garmin GPS on: July 30, 2008, 08:49:03 pm
Quote
You seem to be using the one hardware serial port of the arduino for receiving input from the GPS and sending the data to your PC. (The USB FDTI chip on the arduino uses pins 2 and 3 for serial communication with your PC). The problem could be further compounded by your GPS using a buad rate of 4800 on this port while your PC may be using the default 19200 on the same port. You should set up a second serial port (software serial library) for your GPS and use the hardware one for your PC, thereby enabling you to use two different baud rates and not mixing your input and output.

You actually mean pins 0 & 1, right?
I agree, I think that is the problem.

29  Forum 2005-2010 (read only) / Interfacing / Re: Basic Servo Interfacing on: July 30, 2008, 08:51:35 pm
Quote
just a thought..I'm new to this to. I have been using the ServoTimer1 lib with no problems. It carries out all timing in hardware so you don't have to worry about refresh. Only downside is you can only use two servos on pins 9 &10.

Yeah, you pays your money and you takes your choice.
Servo1: 2 servos, less worries
Servo: many servos, more worries
30  Forum 2005-2010 (read only) / Interfacing / Re: Basic Servo Interfacing on: July 26, 2008, 10:15:19 pm
A working design is not always a good design.

Read and implement per Mem's suggestion. Using delay() in a servo program is playing with fire. You must keep refresh() called frequently. A servo normally has to compare its position with the commanded position. If you go away for a second, it has nothing to compare to and stops moving!

Analog servo? Digital servo? Smoke & mirrors!
Pages: 1 [2] 3 4