Show Posts
Pages: 1 2 3 [4] 5 6
46  Using Arduino / Programming Questions / Re: Interfacing with Pachube (One Wire sensor) on: June 26, 2011, 11:46:08 am
I think your pachube ip address is wrong - try 173,203,98,29

see: http://community.pachube.com/IP_address
47  Using Arduino / Programming Questions / Re: Problem with if-else ladder on: June 20, 2011, 03:26:03 pm
sorry about transposing: val > 312

but if it's checked before (as in the example given) then it's useless to check again

48  Using Arduino / Project Guidance / Re: Cloud sensor heater control using PWM on: June 20, 2011, 02:47:11 pm
I can't help with the heater but I built a nickel / penny sensor shown at the bottom of this page http://www.techlib.com/electronics/raindetectors.htm. Using a voltage divider read the analog reading to see if it's wet or not. See graph attached.



49  Using Arduino / Programming Questions / Re: Problem with if-else ladder on: June 20, 2011, 02:18:25 pm
I also think you want greater than and not less than
I also think that you don't need the greater than's because of your order

Code:
else if(312 > val && val <=455)

Code:
else if(val <=455)
50  Using Arduino / Sensors / Re: Reading watermeter on: June 09, 2011, 07:15:50 pm
this guys page might help you:

http://www.edcheung.com/automa/water.htm
51  Community / Exhibition / Gallery / read the icon electric smart meter on: June 07, 2011, 07:44:53 pm
using the detector from the RadioShack #276-0142

had lot's of issues with sunlight - as it get's full sun about noon!

here are my results so far:
BilledMyReading%Delta
10291024.2860.46%
10231017.3310.55%
12121197.2931.21%
19691964.9730.20%
21332140.187-0.34%

I call the arduino every 5 minutes (actual twice) via Ethernet that I also poll some two lines of onewire Dallas Temperature sensors.

So I think I lose a watt/blink or more (i.e. 1 watt) in that time frame...

Code:
#define power_input 0
void loop()
{
  PowerLoop();
}

unsigned long powerCount = 0;
unsigned long powerCountLast = 0;
unsigned long powerLastBlink = 0;
unsigned long powerK5count =0;
unsigned long powerW1=0;
unsigned long powerW2=0;
unsigned long powerW3=0;
unsigned long powerW4=0;
unsigned long powerW5=0;

float powerBlinkLength = 80;
float powerBlinkRate = 200;
int powerBlinkFlag = 1;
float powerFilterR = 600;
float powerFilterH = 600;
float powerFilterC = 600;
float powerMaxL = 1;
float powerMaxH = 0;
int powerReading = 0;

void PowerLoop() {
  
  powerReading = analogRead(power_input);
  powerFilterR += .55 * (powerReading-powerFilterR);
  powerFilterH += .01 * (powerReading-powerFilterH);
  powerFilterC += .9 * (powerReading-powerFilterC);
  
  if (powerFilterC/powerFilterH < powerMaxL) powerMaxL = powerFilterC/powerFilterH;
  if (powerFilterC/powerFilterH > powerMaxH) powerMaxH = powerFilterC/powerFilterH;
  
  serialPrint();
  
  if ((powerFilterC/powerFilterH <.9 && powerBlinkFlag ==1 && millis()-powerLastBlink > 50) || powerLastBlink > millis())
  {
      powerBlinkFlag = 0;
      powerCount++;
      float rate = millis()-powerLastBlink;
      if(rate>0) powerBlinkRate += .05 *(rate-powerBlinkRate);
      powerLastBlink = millis();  
  }
  else if (powerFilterC/powerFilterH > 1.01 && powerBlinkFlag == 0)
  {
    if ( millis()-powerLastBlink > 30|| powerLastBlink > millis()){
      float rate = millis()-powerLastBlink;
      if (rate>0) powerBlinkLength +=  .05*(rate-powerBlinkLength);
      powerBlinkFlag = 1;
    }
  }
 unsigned long w = millis() - lastconnect;
 
 if ( w < 60000) { powerW1 = powerCount; }
 else if (w < 120000) { powerW2 = powerCount; }
 else if (w < 180000) { powerW3 = powerCount; }
 else if (w < 240000) { powerW4 = powerCount; }
 else if (w < 300000) { powerW5 = powerCount; }
}



52  Community / Exhibition / Gallery / Read the itron 100g dl gas meter on: June 07, 2011, 07:15:51 pm
so the meter - if you look closely you can see the gear that rotates in the attached pictures

I used the RadioShack Emitter and Detector #276-0142 set and some pvc and duck tape (to block the sun light and to hold it in place)

here's the meat of the code
because it get's full on sun I use filters for the cross over counts

Code:
#define gas_analog_in 4
#define gas_digital_out 4
void loop()
{
    GasLoop();
}

unsigned long gasTotalCount = 0;
unsigned long gasLastCount = 0;
unsigned long gasG5count = 0;

unsigned long gaslastMillis = millis();
unsigned long gasReading = 0;
unsigned long gasReadingMax = 0;
unsigned long gasReadingMin = 1023;
unsigned int gasFlag = 0;
unsigned long gasTripHigh = 0;
unsigned long gasTripLow = 1023;
int gasTripOffset = 75;
float gasFilterL = 900;
float gasFilterOff = 900;

int gasOut = HIGH;

void GasLoop()
{
  gasReading = analogRead(gas_analog_in);
 
  gasFilterL += .01 * (gasReading-gasFilterL);
 
    gasReading = gasFilterL;
   
  if(gasReading>gasReadingMax) gasReadingMax = gasReading;
  if(gasReading<gasReadingMin) gasReadingMin = gasReading;
   
  if(gasReading<gasTripLow) {
    gasFlag = 1;
  } else if (gasFlag == 1 && gasReading>gasTripHigh) {
    gasFlag =0;
    gasTotalCount++;
  }
   
  if (gasReading>gasTripHigh) {
    gasTripLow = gasReading - gasTripOffset;
    gasTripHigh = gasReading;
  }
  if (gasReading<gasTripLow) {
    gasTripHigh = gasReading + gasTripOffset;
    gasTripLow = gasReading;
  }

}


over the last two months I had:
BilledMyReading%Delta
1211.881.00%
1111.16-1.45%

so over the 2 months -0.17% (seeing they bill at 1ccf and I measure at .01)

I'm happy with results so far!



53  Using Arduino / Audio / Re: Toilet Flushing Recognition on: March 31, 2011, 08:24:04 am
I sort of started looking at this but then when on to something else

http://arduino.cc/forum/index.php/topic,20158.msg148630.html#msg148630

I did attach a piezo for a bit to my main line - and felt that I could get an indication when different water sources were on - I also got noise from walking across the wood floors but the profiles were different.

the following might also give you some ideas

http://www.google.com/search?q=Detecting+Human+Movement+by+Differential+AirPressure+Sensing+in+HVAC+System+Ductwork%3A+AnExploration+in+Infrastructure+Mediated+Sensing&rls=com.microsoft:en-us&ie=UTF-8&oe=UTF-8&startIndex=&startPage=1

http://books.google.com/books?id=J-I0RLNph_4C&pg=PA271&dq=Detecting+and+Classifying+Unique+Electrical+Events+on+the+Residential+Powerline.&hl=en&ei=vn-UTdn3CYO40QGhurz0Cw&sa=X&oi=book_result&ct=result&resnum=1&ved=0CEAQ6AEwAA#v=onepage&q&f=false
54  Using Arduino / Sensors / Re: infrared emitter / detector on: February 28, 2011, 08:25:02 am
I've used these - I used something like a 220 ohm for the emitter - can't recall on the detector but believe it to be in the 20k to 50k ohm range. We aware that ambient light will effect your readings and could be why our only seeing 700's readings - try the detector in the dark without the emitter - should get about 1023 - then add the emitter and see what you get.
55  Using Arduino / Sensors / Re: Bizarre Reading from DS18B20's after adding 5th Sensor on: February 09, 2011, 11:49:51 am

try looking at these:
http://arduino.cc/forum/index.php/topic,21762.msg162089.html
http://arduino.cc/forum/index.php/topic,21392.msg158967.html
56  Forum 2005-2010 (read only) / Syntax & Programs / Re: vs2005/C#/MS Access: Insert doesn't add row to db on: August 24, 2010, 06:58:38 am
did you review this?

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1282530420/2#2


I'm sure your having an issue with your strings in that your NOT INCLUDING a ' around your string.

get your code to work with only one value - like one of your int/long data fields.

then add one field into your insert field at a time.

"INSERT INTO Temp (id) VALUES(100);"

"INSERT INTO Temp (id,stype) VALUES(100,'Temp');"

then change your code to use variables - one at a time.

"INSERT INTO Temp (id)" + " VALUES (" + SQLid + ");";
"INSERT INTO Temp (id,stype)" + " VALUES (" + SQLid + ",'" + SQLtype +"');";
57  Forum 2005-2010 (read only) / Syntax & Programs / Re: Man, lcd.print is big, but sprintf is bigger! on: August 22, 2010, 05:51:20 pm
good point on using the char '0' over ascii code 48

as bad points about writing char's over using itoa type fucntions- when you get numbers outside your range you can get nice things like "((*5" as you flow over and under your 0 to 9 values... like when you assign a long to an unsigned int.

In my case I was thinking I might have an issue with program size so I went without the itoa and sprintf to write my strings.



58  Forum 2005-2010 (read only) / Syntax & Programs / Re: Man, lcd.print is big, but sprintf is bigger! on: August 21, 2010, 09:43:24 am
I do something like this:

#define STRING_BUFFER_SIZE 200
char buffer[STRING_BUFFER_SIZE];

void BufferPrint(unsigned long reading,unsigned long i) {
  //reading is the value to print, i is the total padded size to print
  unsigned long temp;
  while (i>0){
     temp = reading/i;
     reading -= temp * i;
     buffer[bufindex++] = 48+temp;
     i/=10;
    }
  
}

   buffer[bufindex++] = '[';
   buffer[bufindex++] = 'K';
   buffer[bufindex++] = '0';
   buffer[bufindex++] = ']';
  

   BufferPrint(counter,1000000);

     buffer[bufindex++] = '[';
     buffer[bufindex++] = 'P';
     buffer[bufindex++] = 'A';
     buffer[bufindex++] = ']';
    
     BufferPrint(pyramometerTotal/count,1000);
  
     buffer[bufindex++] = '[';
     buffer[bufindex++] = 'R';
     buffer[bufindex++] = 'A';
     buffer[bufindex++] = ']';
    
     BufferPrint(rainDetectorTotal/count,1000);

So may output is padded and looks like:

[K0]00000020[PA]0934[RA]0010


  
59  Forum 2005-2010 (read only) / Interfacing / Re: getting local time over internet (NTP?) on: December 08, 2010, 10:09:32 pm
your router might have a page with the time on it - mine does
60  Forum 2005-2010 (read only) / Interfacing / Re: Can't pass data from Arduino to MS Access DB on: August 23, 2010, 09:38:07 am

if SQLname and SQLlocation are defined as strings/text in the access db then do the following:

",'" + SQLname + "','" + SQLlocation + "')";


if number keep as you have it:

"," + SQLtemp + ","


and for a database date field use #:


",#" + SQLtoday + "#"

as a side note the you might have to use a format or tostring on the SQLtoday if it's date variable to get it into the correct format.

I always get confussed between oracle, mysql and access date format requirements....
Pages: 1 2 3 [4] 5 6