Show Posts
Pages: 1 ... 50 51 [52] 53 54 ... 64
766  Using Arduino / Project Guidance / Re: I need a Project on: June 17, 2011, 10:42:12 am
You can complicate it by adding local (to the door) control.  As a person approached the inside of the door it senses them and unlocks.  If the person is under 4 feet tall it won't unlock (pool protection).  It autonomously locks at a programmed time to set the house for night.
That kind of thing.
767  Using Arduino / Project Guidance / Re: Elbow rule help on: June 16, 2011, 09:39:04 pm
I've seen them on laser levels at homeowner stores.  I have one somewhere.  Basically they are a laser that passes through a lens that makes the beam into a line.  The line is actually fun to play with.  To sense it get a sensitive photoreceptor.  I bet some of the folks on here can suggest something.  If you could go infrared, there would be less interference, but you couldn't see it.  IMHO, seeing it is part of the fun.

Actually, you could put a reflector on them that is roughly the same color as the laser and it will light up like a spotlight when they cross the line.  Similar to what happens when you point a red laser at the tail light of a car.

google laser levels and go from there for a ton of ideas.
768  Using Arduino / Project Guidance / Re: I need a Project on: June 16, 2011, 08:24:10 pm
And I thought I was getting risque with the bar stool........
769  Community / Bar Sport / Re: Your latest purchase on: June 16, 2011, 04:40:42 pm
Wow bld, you could be living next door to me!!  Your description is exactly what one of my neighbors was saying a few days ago.
770  Using Arduino / Project Guidance / Re: I need a Project on: June 16, 2011, 01:36:16 pm
Quote
@Draythomp, any suggestions for  a sex & Arduino-project ?

Uh, I could probably go on for about 40 pages with that one.  Wow, one that I can actually put on a pubic er, uh public board?  How about:

A sensor that you install in a bar stool that senses the temperature of the person sitting there.  It would have to be capable of fractional changes and allow for movement of the persons posterior section.  It would have to respond very quickly and have some kind of indicator that is discreet but still easily viewed.  That way as you use your various lines on the target human you could quickly see the affects.  Higher temps and you're working it; lower temps and you struck out. 
 smiley-cool
771  Using Arduino / Project Guidance / Re: Global variable values rest? on: June 16, 2011, 01:14:06 pm
Ok, one last try.  the String routines use malloc, calloc and free to manipulate strings.  Some of them are pretty intense since the String you get back is not the String you sent.  So, a memory problem can happen regardless of the size of your program if you manipulate things in some fashion.  There are calls you can find in the playground that can be interspersed into the code at various spots to see how much memory you have left at any given point.  For example, each time you add a character to your String to be parsed, you are likely to have a malloc, memcpy, free combination just to add a character at the end.  If you are receiving a hundred characters, that's a hundred of those.  Memory fragmentation happens and although the String routines have been heavily used, there could still be something that is messing with you.

Also, you can check in your loop or somewhere else appropriate to see if the variables get reset and print something.  You can scatter serial prints around various things to see what is getting you to the point where it is cleared after it is set by your get.  Heck, you can serial print the darn line numbers if it gets to that point.  I know I have when nothing else seemed to work.
772  Using Arduino / Project Guidance / Re: Elbow rule help on: June 16, 2011, 10:51:18 am
A reflective band on the arm just below the elbow, one of those lasers like they use on automatic levels that will trace a line and then sense the reflection of the band when it crosses the laser line.
773  Using Arduino / Project Guidance / Re: I need a Project on: June 16, 2011, 10:44:53 am
Listen to AWOL.  Tell us what YOU are interested in, cars, sex, home automation, sex, sunspots, remote monitoring, baseball, automatic trashcans, or maybe sex?  There are projects that you'll be interested in for about five minutes but to do something big and keep with it you have to want to do it.

For example, I've been fighting with a stupid garage door I constantly leave open.  When I leave it open the ground squirrels get in and tear stuff up.  So, a project around garage doors would be good for me.  This sounds trivial but suppose it needs to sense me leaving the property and shut the door automatically?  Or needs to be checked from the corner bar (16 miles away).  Or alert me because a squirrel ran in while I was backing out?  A robot sentry armed with a pellet gun to take care of the little critters.  Any problem can be as complex as you want to make it.

Even if all you do is listen to an iPod all day there are projects around that.  FFT (google it) to do a light display.  LED laser show with fast mirrors to trace the lights around the room.  An arduino orchestra conducted by you waving a wand antenna around.  Heck, an air guitar that senses your hand movements and plays rock cords in sequence. 

If you have a disabled friend, a wheelchair sensor that looks out for objects.  An ultrasonic cane for the blind that beeps for objects at a distance.  Extreme magnifying glasses that have a ccd camera in them and tiny displays for reading the paper.  A hat that senses when they might hit their head and alerts.

So, what do you think about when you're not thinking about sex?
774  Using Arduino / Project Guidance / Re: Global variable values rest? on: June 16, 2011, 10:23:58 am
OK, then how about the else after the check for favicon?  Your indentation indicates that you expect everything under it to be inside the else but there is no opening brace following the else.  This means the for loop is the only thing the else relates to  so the statusSerial and statusLCD will execute.
775  Using Arduino / Installation & Troubleshooting / Re: Mega 2560 bootloader revised? on: June 16, 2011, 09:41:14 am
Tobi,  I got in contact with the developer that wrote the bootloader yesterday.  Nice guy.  I sent him what I had that didn't work with the watchdog timer and he has already fixed the ! ! ! problem.  He's up to his ears in something and will be getting back to me.  There may be a fix on the way in a few days.

I'll let you know what happens by a post here.  I was beginning to think I was the only person that had this problem.
776  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Shield on: June 16, 2011, 02:43:25 am
Here's the latest code I used for pachube on a device I haven't posted about yet.

Code:
void sendPachubeData(){
  char dataBuf[100];
 
  if(pachube.connected()) // already trying to get data, just leave
    return;
  if(round(realPower) == 0.0)  // don't send invalid data
    return;
  tNow = now();
  strcpy_P(Dbuf2,PSTR("Data at %02d:%02d:%02d: "));  // Debugging
  sprintf(Dbuf,Dbuf2,hour(tNow),minute(tNow),second(tNow));
//  Serial.print(Dbuf);
  // construct the data buffer so we know how long it is
  int poolMotorState = 0;
  if(strcmp(poolData.motorState,"High") == 0)
     poolMotorState = 2;
  else if(strcmp(poolData.motorState,"Low") == 0)
    poolMotorState = 1;
  strcpy_P(Dbuf2, PSTR("%d,%d,0.%d,%d.%02d,%d.%02d,%d.%02d,%d,%d,%d,%d"));
  sprintf(dataBuf,Dbuf2,
    (int)round(realPower),
    (int)round(apparentPower),
    (int)(powerFactor*100),
    (int)rmsCurrent,
    (int)(((rmsCurrent+0.005) - (int)rmsCurrent) * 100),
    (int)rmsVoltage,
    (int)(((rmsVoltage+0.005) - (int)rmsVoltage) * 100),
    (int)(frequency),
    (int)(((frequency+0.005) - (int)frequency) * 100),
    (ThermoData[0].currentTemp + ThermoData[1].currentTemp)/2,
    (int)round(outsideTemp),
    poolMotorState, poolMotorState == 0 ? 10 : poolData.poolTemp);
  Serial.println(dataBuf);
//return;
  strcpy_P(Dbuf,PSTR("Pachube Connecting..."));
  Serial.print(Dbuf);
  if(pachube.connect()){
    strcpy_P(Dbuf,PSTR("OK"));
    Serial.println(Dbuf);
    tNow = now();
    strcpy_P(Dbuf,PSTR("PUT /api/9511.csv HTTP/1.1\n"));
    pachube.print(Dbuf);
    strcpy_P(Dbuf,PSTR("Host: www.pachube.com\n"));
    pachube.print(Dbuf);
    strcpy_P(Dbuf,PSTR("X-PachubeApiKey: stuffinhere\n"));
    pachube.print(Dbuf);
    strcpy_P(Dbuf,PSTR("Content-Length: "));
    pachube.print(Dbuf);
    pachube.println(strlen(dataBuf), DEC); // this has to be a println
    strcpy_P(Dbuf,PSTR("Content-Type: text/csv\n"));
    pachube.print(Dbuf);
    strcpy_P(Dbuf,PSTR("Connection: close\n"));
    pachube.println(Dbuf);
    pachube.println(dataBuf);   
    pachube.stop();
    pachubeUpdateTime = now();
  }
  else {
    pachube.stop();
    while(pachube.status() != 0){
      delay(5);
    }
    strcpy_P(Dbuf,PSTR("failed"));
    Serial.println(Dbuf);
  }
}

This works every time the actual board is working.  I also have code around the ethernet board itself to make sure it is working that is separate from this stuff.  For example, this is the code to reset the ethernet board:

Code:
void ethernetReset(){

  pinMode(rxSense, INPUT);  //for stabilizing the ethernet board
  pinMode(ethernetResetPin,INPUT);
  while(1){
    digitalWrite(ethernetResetPin, HIGH);
    pinMode(ethernetResetPin, OUTPUT);
    digitalWrite(ethernetResetPin, LOW);  // ethernet board reset
    delay(100);
    digitalWrite(ethernetResetPin, HIGH);
    delay(5000);
    // now, after the reset, check the rx pin for constant on
    if (ethernetOk())
      return;
    delay(100);
  }
}

Keep in mind that this depends on the hardware mods I did to the board so that I can reset it separately from the rest.  Since I'm using an arduino 2560 that has the watchdog timer bug in the boot loader I can't do a regular watchdog reset.  I use one of the timer interrupts instead and do a call to address 0 to reset the board.  That took some time to figure out.

I also have a little routine that I call that watches the RX led on the ethernet board.  It seems in my case that when the board hangs up the RX led is solid on.  So I hooked a wire to it and watch it with an arduino pin.  If the led is on too many times in a timing loop, it means the board is hung up.  So I use the reset routine above to reset it.

Code:
boolean ethernetOk(){
  int cnt = 10, result;

  cnt = 10;
  result = 0;
  while (cnt-- != 0){  // simply count the number of times the light is on in the loop
    result += digitalRead(rxSense);
    delay(50);
  }
  strcpy_P(Dbuf,PSTR("Ethernet setup result "));
  Serial.print(Dbuf);
  Serial.println(result,DEC);
  if (result >=6)      // experimentation gave me this number YMMV
    return(true);
  return(false);
}

Like your experience, I found that one MUST close the connections or the darn thing hangs up.  I guess I was extremely lucky to have it fail immediately so that I had to work up solutions before I started relying on it.

On the new device that updates pachube, there is still one problem I have to deal with.  Sometimes pachube itself stops responding and I have trouble telling if it was pachube messing up or the ethernet board failing.  I'm still thinking about that problem and suspect it will be easy to fix by just checking the pachube response for 'OK' and also looking at some of the other web interactions the board is doing to see if they are working ok.  If all else fails, I'll just interogate my router to see if it's alive.  That way I can just wait for pachube to come back up.  I've had this problem three times now which is not bad for several months of data transmission.

One other thing I want to mention is that I use the TimeAlarms library to time the updates to pachube instead of counting milliseconds or something like that.  I set an alarm to fire every so often and just go do other stuff as necessary keeping the values I want to send to pachube updated.  This way I don't have anything hanging me up because Ijust let the alarm fire and it takes care of that kind of thing for me.  This trick allows me to have a display that steps through the various values and little LEDs that tell me what is going on at a glance.  I am using the TimeAlarm libray as a task controller and then just set up the various tasks.

Too much information???
777  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Shield on: June 16, 2011, 12:40:41 am
First, I do NOT know what the problem is.  However, I do know that this happens a lot in my experience.  The first time I used the ethernet card I thought it was broken.  I eventually got it to work pretty reliably like you did, but it would drop out on occasion and not come back.  After even more testing and code changing I gave up and took a solution similar to yours.  However, I went even further.  I modified the hardware such that I can reset the ethernet board from one of the digital pins such that I can just reset the ethernet board to see if it recovers.  If that fails, I can then reset the arduino and start over from scratch.  This works quite well since the arduino can reboot in a couple of seconds and pachube doesn't even notice I went away.

To see the degree I went to trying to handle this problem take a look at my blog draythomp.blogspot.com under the thermostat tab where I put pictures of the modifications I made.  This problem existed with the previous version of the ethernet card as well as the newer ones.

I suspect the ethernet protocol on the chip itself has a problem and goes away from time to time.  The library can't overcome something like that, so we have to do it ourselves.
778  Using Arduino / Networking, Protocols, and Devices / Re: Unusual position tracking technique with XBees: possible ? on: June 16, 2011, 12:30:48 am
PaulS is correct, you should get a couple of XBees and try the RSSI to see if the granularity is good enough for you.  I suspect the problems that PaulS went into will bring you to a halt on using them.  The RSSI doesn't seem to change until it almost goes away, if there is enough difference to be able to triangulate I would be surprised.  Also as Paul mentioned, the update time is probably much shorter than you want.  I suspect the person could move a couple of feet before you knew it.

779  Using Arduino / Project Guidance / Re: Global variable values rest? on: June 16, 2011, 12:23:33 am
Correct me if I'm wrong because I don't use the String library.  But the line:

String readString = String(30); //string for fetching data from address

Will create a String whose contents is "30", not a thirty byte buffer to hold stuff.  So the line

          readString += c; //replaces readString.append(c);

if it returns an upper case 'H' will make readString become "30H"; at least until you reset it at the bottom of the loop.  Is that what you intended?  Also I couldn't find an example of an array of Strings; lots of examples of strings out there though.  Could it be that there is a problem with the String table you are trying to do the index on?

I'm only jumping in since the experts on the String library haven't jumped in.
780  Using Arduino / Project Guidance / Re: Upgraded Generator control board Possible? on: June 15, 2011, 11:35:31 pm
I disagree.  My neighbor has a new generator for home backup that is totally electronic and works really well.  There's little effort in placing the arduino in a sealed plastic box and taking wires out to "old school relays"  or new school sealed low voltage relays or solid state devices that would last forever without having the contacts burn.  Once you got the basic operation working, adding things like frequency control, oil sensing and altitude sensing would be possible.  You could turn the choke on harder for cold starts, do automatic restarts, disconnects when power came on, etc.  Besides, you could put a cool control panel on it and show it off on trips.

Reliability is not about the era the device was created, it's about testing, adapting and design.  Cars used to be ready for the junk yard in 75,000 miles.  Nowadays we run them twice that before changing the spark plugs.  Something sure seems to be better about electronic controls.  Sure there will be some challenges and it will probably cost twice what you think it will, but you'll have a device that can tell you things like low spark, run temperature and oil temperature that you just can't get now.

Then, when you finish with that project, you'll start to look at the other control systems on the rest of the motorhome.  Automatic leveling and airshock adjustment would be cool too.  Maybe a computer controlled system to keep the batteries in top condition or signal tracking on the satellite TV. 
Pages: 1 ... 50 51 [52] 53 54 ... 64