Show Posts
Pages: 1 ... 125 126 [127] 128 129 ... 289
1891  Using Arduino / General Electronics / Re: power supply on: March 20, 2013, 04:58:26 pm
any suggestions would be appreciated!

If you have a schematic, posting that would be best. Pretty hard to tell what we're looking at otherwise.
1892  Community / Bar Sport / Re: What they teach in school. on: March 19, 2013, 01:41:39 pm
Very good and interesting speech, actually. Food for thought. While she did an absolutely super job, she impressed me as being maybe just a bit uncomfortable. Power of suggestion perhaps, or maybe it just takes one to know one smiley-wink
1893  Community / Bar Sport / Re: What they teach in school. on: March 19, 2013, 01:21:18 pm
Quote
A third to a half of the population are introverts.

It's actually quite a bit higher than that, but they're not standing up to be counted.
1894  Using Arduino / General Electronics / Re: Chronodot - Sync 1hz square wave? on: March 19, 2013, 08:18:26 am
Being naive here, Is the pulse width from the RTC 500ms?

I assume so, or darn close to it. By definition if it's truly a "square wave" it should have a 50% duty cycle but that's a term that might be somewhat loosely applied.
1895  Using Arduino / General Electronics / Re: Chronodot - Sync 1hz square wave? on: March 18, 2013, 10:31:34 pm
Ok,  so it seems like I need to keep track of the number of mills from when the PPS goes off and then count up 500 mills and then set the time.

I'll try and write up a simple sketch to test it out.  Thanks!

It's simpler than that. When the pulse from the GPS occurs, get the time from the GPS, set the RTC with RTC.set() and the system time with setTime(). The falling edge of the 1Hz signal from the RTC should then be synchronized with the pulse from the GPS.

Be sure to call setSyncProvider() in setup() to keep the system time in sync with the RTC time.
1896  Using Arduino / General Electronics / Re: Chronodot - Sync 1hz square wave? on: March 18, 2013, 10:07:54 pm
From the datasheet, p12:

Quote
The countdown chain is reset whenever the seconds register
is written. Write transfers occur on the acknowledge
from the DS3231. Once the countdown chain is reset, to
avoid rollover issues the remaining time and date registers
must be written within 1 second. The 1Hz square-wave output,
if enabled, transitions high 500ms after the seconds
data transfer, provided the oscillator is already running.

What you're trying to do should certainly be possible to within 50ms.
1897  Using Arduino / Project Guidance / Re: XBee Antenna on: March 18, 2013, 12:25:58 pm
The robot I have is 4 feet tall. The body is made of wood and it has a outer shell of aluminum flashing.

So essentially one of these. They have some interesting properties. I wouldn't think much will be heard from an XBee or any other radio transmitter inside that robot.

Quote
The electronics including the XBee are in the center of the robot.

I'd look at relocating the XBee to some position where it can see the light of day without a layer of aluminum (or aluminium for GM et al.) in the way. The serial data lines to the XBee should be ok running a few feet.

Quote
I was hoping to put a 1 foot antenna above the robot for better range and to reduce interference with an on board wireless netgear router.

A Wi-Fi router will not interface to an XBee, so that would be futile. It'd be overkill even if it did; the Pro XBee should have more than ample range, but it can't be in a can.
1898  Using Arduino / Programming Questions / Re: How to declare arrays in another (not main) tab? on: March 17, 2013, 10:20:15 pm
In storage, you have only a limited amount of FLASH memory (see your board specs for details, but the UNO has 2k)

In execution, you have a limited amount of SRAM (again see your board specs for details but the UNO has 32k)

Other way 'round actually, 32K flash program memory, 2K static RAM for data, stack, etc.
1899  Using Arduino / Programming Questions / Tips and Tricks to Optimize Your C Code on: March 17, 2013, 09:54:13 pm
I've been reading this application note from Atmel:
Atmel AVR4027: Tips and Tricks to Optimize Your C Code for 8-bit AVR Microcontrollers
http://www.atmel.com/Images/doc8453.pdf

It's interesting reading. One of the things I found that I do frequently wasn't obvious to me until I read Tip #2.

I had a few variables that I used both in setup() and in loop() so I declared them as global variables. However, they were not used to communicate values between the two functions. Therefore, they could just as well be declared as automatic (local) variables in each function. This sounds like duplication, but in fact it saves both flash program memory and SRAM. Global variables must go into SRAM, whereas local variables can go on the stack or in registers. In addition to saving SRAM, this also shortens the code (and probably makes it faster as well), as addressing the variables can be done with shorter instructions.

Here's an example I cooked up. Declaring the variables twice, once in setup() and once in loop() results in saving 136 bytes of flash and 6 bytes of SRAM. The more references there are to the variables, the more flash is saved.

Code:
//Arduino 1.0.3, Board = Arduino Uno
//Binary sketch size: 3,252 bytes (of a 32,256 byte maximum)
//Free SRAM = 1819 bytes
//See Atmel AVR4027: Tips and Tricks to Optimize Your C Code for 8-bit AVR Microcontrollers
//http://www.atmel.com/Images/doc8453.pdf

unsigned long n1;
byte n2, n3;

void setup(void)
{
    Serial.begin(115200);
    delay(2000);
    //just some meaningless assignments and calculations
    n1 = millis();
    n2 = n1 % 10;
    n3 = n1++;
    Serial.println();
    Serial.print("mem=");
    Serial.println(freeMemory());
    Serial.println(n1);
    Serial.println(n2);
    Serial.println(n3);
    n1 = millis();
    n2 = n1 % 10;
    n3 = n1++;
    Serial.println(n1);
    Serial.println(n2);
    Serial.println(n3);
}

void loop(void)
{
    delay(5000);
    n1 = millis();
    n2 = n1 % 10;
    n3 = n1++;
    Serial.println();
    Serial.print("mem=");
    Serial.println(freeMemory());
    Serial.println(n1);
    Serial.println(n2);
    Serial.println(n3);
    n1 = millis();
    n2 = n1 % 10;
    n3 = n1++;
    Serial.println(n1);
    Serial.println(n2);
    Serial.println(n3);
}

extern unsigned int __bss_end;
extern unsigned int __heap_start;
extern void *__brkval;

int freeMemory() {
  int free_memory;

  if((int)__brkval == 0)
     free_memory = ((int)&free_memory) - ((int)&__bss_end);
  else
    free_memory = ((int)&free_memory) - ((int)__brkval);

  return free_memory;
}


Code:
//Arduino 1.0.3, Board = Arduino Uno
//Binary sketch size: 3,116 bytes (of a 32,256 byte maximum)
//Free SRAM = 1825 bytes
//See Atmel AVR4027: Tips and Tricks to Optimize Your C Code for 8-bit AVR Microcontrollers
//http://www.atmel.com/Images/doc8453.pdf

void setup(void)
{
    unsigned long n1;
    byte n2, n3;

    Serial.begin(115200);
    delay(2000);
    //just some meaningless assignments and calculations
    n1 = millis();
    n2 = n1 % 10;
    n3 = n1++;
    Serial.println();
    Serial.print("mem=");
    Serial.println(freeMemory());
    Serial.println(n1);
    Serial.println(n2);
    Serial.println(n3);
    n1 = millis();
    n2 = n1 % 10;
    n3 = n1++;
    Serial.println(n1);
    Serial.println(n2);
    Serial.println(n3);
}

void loop(void)
{
    unsigned long n1;
    byte n2, n3;

    delay(5000);
    n1 = millis();
    n2 = n1 % 10;
    n3 = n1++;
    Serial.println();
    Serial.print("mem=");
    Serial.println(freeMemory());
    Serial.println(n1);
    Serial.println(n2);
    Serial.println(n3);
    n1 = millis();
    n2 = n1 % 10;
    n3 = n1++;
    Serial.println(n1);
    Serial.println(n2);
    Serial.println(n3);
}

extern unsigned int __bss_end;
extern unsigned int __heap_start;
extern void *__brkval;

int freeMemory() {
  int free_memory;

  if((int)__brkval == 0)
     free_memory = ((int)&free_memory) - ((int)&__bss_end);
  else
    free_memory = ((int)&free_memory) - ((int)__brkval);

  return free_memory;
}



1900  Using Arduino / Sensors / Re: Sensing water? on: March 17, 2013, 02:00:34 pm
Similar recent discussion here:
http://arduino.cc/forum/index.php/topic,152516.0.html
1901  Using Arduino / Programming Questions / Re: xbee module wireless communication on: March 17, 2013, 01:25:06 pm
See my blog post, Simple XBee ZB (Series 2) P2P Communications

Fairly easy IMHO. Indeed XBees are complicated in that there are a lot of settings. I highly recommend spending some time in the Product Manual before hooking them up and blindly fiddling with dozens of settings in X-CTU. In most cases, only a very few settings will actually need changing. In other words, there are lots of ways to do it wrong.

Looks to me like the wrong modem type is selected (XB24-B). It should be XB24-ZB for regular XBee-ZB modules (f.k.a. Series 2). But we really would like to know the Digi part number of the model you are working with (e.g. XB24-Z7WIT-004), so add that to the additional information that is needed.

Also IMHO, if you use even half of the capabilities of these modules, they are a downright bargain. Best price I've found for the low power XBee-ZB modules is $17, either direct from Digi, or from Mouser.
1902  Community / Bar Sport / Re: iMall iTeadStudio PCB Ordering Process? on: March 17, 2013, 06:30:08 am
Ahhh thanks. I didn't read all the instructions.  

Their ordering system is a little primitive and a hack job. We'll see how their service goes.

Things are fairly basic, but service has been good for me.

where do you put the outline? it says one of the layers, what should that layer be called?

most people want it in the drill file

The page I linked above lists the following, but their CAM job also produces a milling file (.GML) which has the outline, so I send that too, eight files in all.

Quote
2.Gerber files needed for 2-layer PCB boards:

    Top layer:    pcbname.GTL
    Bottom layer:    pcbname.GBL
    Solder Stop Mask top:  pcbname.GTS
    Solder Stop Mask Bottom pcbname.GBS
    Silk Top:   pcbname.GTO
    Silk Bottom pcbname.GBO
    NC Drill: pcbname.TXT
1903  Community / Bar Sport / Re: iMall iTeadStudio PCB Ordering Process? on: March 16, 2013, 06:39:05 pm
Just sent one this afternoon myself. Send it to: pcb@iteadstudio.com. I always just send a zip file with the Gerbers in it. I use my order number for the filenames (Gerbers and zip), but this is not a requirement of theirs. I also tend to put the order number on the board, just for my reference, but I figure it can't hurt.

Their requirements as well as the email address are at the bottom of the page for whatever particular board you're ordering, e.g. http://imall.iteadstudio.com/open-pcb/pcb-prototyping/im120418001.html
1904  Using Arduino / LEDs and Multiplexing / Re: Controlling many incandescent bulbs on: March 16, 2013, 06:36:33 pm
MOSFETs come to mind. Are these bulbs powered by AC or DC?
1905  Using Arduino / Project Guidance / Re: XBee Antenna on: March 16, 2013, 06:27:34 pm
What can I do to increase range?

Again: What kind of range does it get now, and what is the requirement? What exactly is the problem we are trying to solve here?

If the XBee is truly "inside" the robot, that would be an issue if the robot's skin consists of significant metal parts. Even lacking a metallic skin, keep the XBee away from large metallic components. Consider using an XBee model with an RP-SMA connector (e.g. XBP24BZ7SIT-004, and note also the extension cables and antennas on that page) and get an antenna made for the job, e.g. https://www.sparkfun.com/products/558
Pages: 1 ... 125 126 [127] 128 129 ... 289