Show Posts
Pages: 1 ... 123 124 [125] 126 127 ... 250
1861  Using Arduino / General Electronics / Re: SMD crystals for Arduino? on: November 13, 2012, 09:57:32 am
Always aim to provide the load capacitance specified on the crystal's datasheet.  I use the formula on page 2 here, which is pretty standard.

Turning the formula around, and assuming the two load capacitors are equal gives:

C = 2(CL - CS)

Where C is the load capacitor value, CL is the load capacitance specified in the crystal's datasheet, and CS is stray capacitance.

When I do the maths, assuming CL of 18pF and CS of 5pF, I get 26pF, so I use 27pF (standard value) caps with 18pF crystals.

Many crystals will run without load capacitors, and that might be OK on a breadboard in a pinch, but anything else is just Bad Design. When something isn't working, I don't know why I'd want to have to worry about whether the oscillator is running correctly. I can create more than enough of my own problems in other areas, so I figure I might as well get the oscillator right and not have to add that to the list of possible causes smiley-grin
1862  Using Arduino / Microcontrollers / Re: Robustness and long term reliability of Arduino boards and AVR chips on: November 11, 2012, 11:31:17 pm
And they do sell a bunch of 'em, according to Wikipedia,

Quote
About 55% of all CPUs sold in the world are 8-bit microcontrollers and microprocessors. According to Semico, over four billion 8-bit microcontrollers were sold in 2006.[4]

A typical home in a developed country is likely to have only four general-purpose microprocessors but around three dozen microcontrollers. A typical mid-range automobile has as many as 30 or more microcontrollers. They can also be found in many electrical devices such as washing machines, microwave ovens, and telephones.

Perhaps not surprising but still impressive numbers. I imagine a lot of the folks here on the forum don't have "typical" homes with a mere three dozen MCUs smiley-grin
1863  Using Arduino / Microcontrollers / Re: Robustness and long term reliability of Arduino boards and AVR chips on: November 11, 2012, 07:26:19 pm
However, standard 8-bit AVRs are used all over in successful industrial and commercial products, and this has been the case for many, many years. – wjl Oct 15 '11 at 1:31[/i]
http://electronics.stackexchange.com/questions/2324/why-are-atmel-avrs-so-popular

There was a thread a while back about products that folks had torn down for parts or whatever and found Atmel MCUs inside. I happen to know that they are used in automotive applications. I expect that they are very robust indeed. I would not expect MCUs from Microchip, TI, Maxim, NXP, ST Micro, etc. to differ significantly in that regard.

Arduinos are "prototyping platforms" (first sentence on the home page) so right there that tells us they are not necessarily meant for deployment in industrial or even commercial applications. That said, they do the job of prototyping platform very well. Even so, I would still expect them to be very robust in reasonable environments.
1864  Using Arduino / Programming Questions / Re: Time Libraries on: November 11, 2012, 02:57:40 pm
replace BYTE with uint8_t in the libs

Is the issue with the library or just with the example sketches? I've used the Time library with both 1.0.0 and 1.0.1, I don't think I remember having to do anything to the library itself.
1865  Using Arduino / Installation & Troubleshooting / Re: Windows 8 stops Arduino 1.0.2 from running on: November 11, 2012, 07:28:06 am
Typical, eh. Just getting started with Windows 8. Not sure what I think. Avast didn't have an issue with it so I went ahead and overruled SmartScreen. Thanks for the tip.
1866  Using Arduino / Installation & Troubleshooting / Re: I think I destroyed my SMD Uno on: November 10, 2012, 05:58:04 pm
Haven't tried it myself, have you seen this stuff called "Chip Quik"?
1867  Using Arduino / Installation & Troubleshooting / Windows 8 stops Arduino 1.0.2 from running on: November 10, 2012, 05:49:08 pm
Anyone else had this? "Windows SmartScreen prevented an unrecognized app from starting. Running this app might put your PC at risk."

Ran it anyway, no blue smoke yet. No trouble with 1.0.1.
1868  Using Arduino / Installation & Troubleshooting / Re: I think I destroyed my SMD Uno on: November 09, 2012, 08:10:22 pm
Any idea what might have happened to it? I accidentally programmed the RSTDISBL fuse bit recently. That slowed the whole process right down.
1869  Using Arduino / Networking, Protocols, and Devices / Re: A story of three xbees; two emitters and one hub on: November 09, 2012, 08:02:26 pm
Expect all the data to arrive nearly instantaneously. Nope. Not going to happen (sorry, Jack).

Ummm yeah that'd be a good point, no apology necessary, Paul. That's what I get for writing untested vapor code on the fly and not thinking enough about it.

Actually, if the XBee's serial interface baud rate were slow enough, then the serial-to-RF data packetization might allow it to work. Not that that would be good design or anything smiley-red
1870  Using Arduino / Networking, Protocols, and Devices / Re: A story of three xbees; two emitters and one hub on: November 09, 2012, 04:46:24 pm
Try the following receiver code. I might also slow the transmitters down to once every two seconds, just for testing purposes.

Code:
#include <LiquidCrystal.h>

int val_read;
byte nodeID;
int average;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()
{
    Serial.begin(38400);
    lcd.begin(16,2);
}

void loop()
{
    val_read = Serial.read();
    if (val_read == '*') {               //wait for start delimiter
        nodeID = Serial.read();
        average = Serial.read() << 8;    //msb
        average += Serial.read();        //lsb

        //message received and decoded, continue processing it...
        if (nodeID == 1) {
            lcd.setCursor(0, 0);
            lcd.print("Bike1 = ");
            lcd.print(average, DEC);
            lcd.print("   ");
        }
        else if (nodeID == 2) {
            lcd.setCursor(0, 1);
            lcd.print("Bike2 = ");
            lcd.print(average, DEC);
            lcd.print("   ");
        }
    }
}
1871  Using Arduino / Networking, Protocols, and Devices / Re: A story of three xbees; two emitters and one hub on: November 09, 2012, 01:59:11 pm
A start delimiter is just a special character of your choosing that serves to mark the start of a message. I chose an asterisk (*) but any character can be used, as long as it's not also used in the data being sent. Having said that, since we are sending binary data, we have a problem with that because there's no guarantee that a byte of "myData" in the example code above won't look like an asterisk. As as simplifying assumption, we could dispense with checking for a "premature" start delimiter, and see how things work just relying on knowing that the messages are a constant length. I'd expect that it would actually work fairly well. This is the kind of robustness that can be had with API mode. There is at least one very good library out there to help operate in API mode (here), but in sticking to transparent mode, we get to do it ourselves, or take the easy way out and live with a weaker design.
1872  General Category / General Discussion / Re: Clock Clock on: November 09, 2012, 12:52:21 pm
Separate, and they are not standard clocks. Hands on standard clocks form a 90° angle at 9:00, but not at 3:30, 9:30, etc. Pretty cool, though.
1873  Using Arduino / Networking, Protocols, and Devices / Re: A story of three xbees; two emitters and one hub on: November 09, 2012, 12:19:23 pm
And can you give me a example in code ? Having hard time understanding that with syntax

An example of what exactly?

Transmitter code might look like

Code:
   const byte nodeID = 1;
    int myData;

    Serial.write('*');            //message start delimiter
    Serial.write(nodeID);
    Serial.write(myData >> 8);    //most significant byte
    Serial.write(myData & 0xFF);  //least significant byte

Receiver code might look like

Code:
   byte c;
    byte nodeID;
    int myData;

    c = Serial.read();
    if (c == '*') {                     //wait for start delimiter
        nodeID = Serial.read();
        myData = Serial.read() << 8;    //msb
        myData += Serial.read();        //lsb
        
        //message received and decoded, continue processing it...
    }

Checking for a premature start delimiter is left as an exercise for the reader smiley-grin
1874  Using Arduino / Networking, Protocols, and Devices / Re: A story of three xbees; two emitters and one hub on: November 09, 2012, 12:08:51 pm
Here are a few things off the top.

1. delay(100) in receiver code. Since there are two transmitters each sending every 100ms, probably the code never gets to the emitterTwo() function. I would use no delay in the receiver. It should constantly be watching for incoming data, not "sleeping" -- it can do nothing while delay() executes.

2. int(val_read) does nothing, since val_read is an int.

3. Serial.read() reads a byte. Serial.write() writes a byte. So Serial.write(average), where average is an int, may not have the desired effect.

4. In emitterTwo(), the receiver code appears to check the first byte to identify the sender. But this is not done in loop(). The code should be consistent, should treat every incoming message identically, and there should be a fixed message structure. The code should not make assumptions about which transmitter's message might be received first, or that the two will always alternate perfectly. Some sort of message start delimiter may be a good thing. Just as a starting idea, each transmitter could always send a message like "*ndd" where the * is the start delimiter, n is a single byte identifying the transmitter, and dd is two bytes representing the data sent by the transmitter. Then the receiver code could watch for "*" as the start of a message, then decode the next three bytes accordingly. If another * shows up in the next three bytes, then that is an error, but would allow the receiver to re-sync.

5. It appears you are trying to determine distance (in inches!) based on the RSSI value. This will be a gross approximation at best. Further, if these are S2 (mesh) XBees, RSSI only represents the last hop, so it's entirely possible that the furthest transmitter would route through the closer one, and the hub would see no difference in the RSSI values for the two transmitters.

Hope this helps.
1875  Using Arduino / Networking, Protocols, and Devices / Re: A story of three xbees; two emitters and one hub on: November 09, 2012, 11:50:04 am
OK I'll have a look. What kind of XBees are these? Series 1? Series 2?
Pages: 1 ... 123 124 [125] 126 127 ... 250