Show Posts
Pages: 1 2 [3] 4 5 6
31  Using Arduino / Project Guidance / Re: 9vac to 4n35 to ardunio on: August 05, 2011, 10:24:55 pm
my cap's are in the basement so they will have to wait until later - but I moved declarations above setup and used const HIGH.

Same result.

Here's my serial output - as I expect until it locks up- the zero's are when I pull one leg of the 9vac output from the circuit - 1's are if line has power in that second.

It's only when I pull the transformer from the wall (i.e. 110vac), reinsert it, pull it out, reinsert that it locks up - so only when I'm doing that does it lock up.

Start
00000000000000+1+1+1+1+1+100+1+100+1+1+100+1+1+100+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+x
[Hh]38[Ht]38
1+1+1+1+10

another run:

Start
+1+1+1+1+1+1+1+1+1+1000+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+x
[Hh]57[Ht]57
1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+x
[Hh]117[Ht]117
1+1+1+1+1+1+1+1+1+1+1000000000000000000000000000+1+1+1+1+1+1+1+1+1+1+1+10000000000x
[Hh]139[Ht]139
000000000000000000000000000000000000000000000000000000000000x
[Hh]139[Ht]139
000000000000000+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+x
[Hh]185[Ht]185
1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+x
[Hh]245[Ht]245
1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+10000000000000000000+1+1000000000+1+100+10+100+10000x
[Hh]267[Ht]267
000
32  Using Arduino / Project Guidance / Re: 9vac to 4n35 to ardunio on: August 05, 2011, 09:05:14 pm
thanks for the suggestions

I wasn't very clear - I'm not looking to measure the Hz cycle - I'm just looking to see if the power is on during one second as I want to record the number of seconds it's on during a 5 minute period. 

Most of my Serial.prints are to figure out if my code (I'm really good at causing buffer overruns) was the issue or if fly-back noise is causing the arduino to lockup - so I understand that serial output can cause you to miss events.

I'll try and add some cap's.

I thought that my "digitalWrite(pin,1)" pulls sets the internal pullup resister so I'll look to see what's needed to do that.

I first wired it up with just one diode reverse the led - and that was giving me what I wanted until I would plug and unplug the 9vac transformer and the arduino would then lock up - I'm guessing from fly-back/emf noise. I then when to the bridge to see if that corrected the issue but it didn't.

At some point I'm actually looking to use the circuit at a 18vac (hvac) - But I figured I would start with 9volts first cause that's the transformer that I had.
33  Using Arduino / Project Guidance / Re: 9vac to 4n35 to ardunio on: August 05, 2011, 07:15:09 pm
optocoupler/phototransistor http://www.vishay.com/docs/83717/83717.pdf
34  Using Arduino / Project Guidance / 9vac to 4n35 to ardunio on: August 05, 2011, 10:13:35 am
I've got the 9vac transformer connected to (4) 1N4001 in a diode bridge
 + out is connected to the 4n35 via a 1k to pin 1 (anode)
 - out is connected to the 4n35 pin 2 (cathode)

I've connected the 4n35 pin 5 (collector) to arduino d4
and 4n35 pin 4 (emitter) to arduino gnd

arduino is powered via the usb cable

all seams to work as I expect if I disconnect one leg - but if I pull out the transformer I believe I'm getting emf/noise back that locks up the arduino.

so am I using the wrong diodes? wrong photo-transistor?

looking to count on second times that it's powered.

Code:
const int pin = 4;

void setup(){
  pinMode(pin, INPUT);
  digitalWrite(pin,1);
  Serial.begin(115200);
  Serial.println("Start");
 
}

unsigned long millisLastMin = 0;
unsigned long millisLast = 0;
const int pinOn = LOW;
unsigned long onSeconds = 0;
unsigned long onSecondsLast = 0;
int thisSecondOn = 0;
int pin60[60];
int pin60Pos = 0;

void loop()
{
  int r = digitalRead(pin);
  if (thisSecondOn == 0) {
    if (r == pinOn) {
      Serial.print("+");
      thisSecondOn = 1;
      onSeconds++;
    }
  }
  if (millis() - millisLast > 1000) {
    millisLast = millis();
    Serial.print(thisSecondOn);
    thisSecondOn = 0;

  }
  if (millis() - millisLastMin > 60000){
    millisLastMin = millis();
    Serial.println("x");
    pin60[pin60Pos++] = (onSeconds - onSecondsLast);
   
    int pin60Sum = 0;
    for (int x=0;x<60;x++)
    {
      pin60Sum +=pin60[x];
    }
    if (pin60Pos > 59) pin60Pos = 0;
    onSecondsLast = onSeconds;
   
    Serial.print("[Hh]");
    Serial.print(pin60Sum);
    Serial.print("[Ht]");
    Serial.println(onSeconds);
  }
}

35  Using Arduino / Sensors / Re: Using phototransistors - hardware check. on: August 02, 2011, 07:30:51 pm
i'll add that you can have wildly different affects with: sunlight (time of day i.e. angle), fluorescent bulbs, incandescent bulbs and led bulbs
36  Using Arduino / Interfacing w/ Software on the Computer / Re: Bash comm. with arduino uno over ttyACMx on: July 31, 2011, 04:07:34 pm
to kill pico have to use the ctrl but I've not figured out actual what it wants - so I do ctrl-a, ctrl-x, ctrl-c until it stops - some times toss a shift in too!

did you try with the head command?
head -n10 /dev/ttyUSB0

37  Using Arduino / Interfacing w/ Software on the Computer / Re: Bash comm. with arduino uno over ttyACMx on: July 31, 2011, 03:00:53 pm
is the arduino resetting on your connection?

Have you tried sending data from the arduino to your box first?
vary the data sent so you can verify it's not resetting on each connection.
/opt/bin/head -n2 /dev/ttyUSB0

the -n2 will return two lines

if you don't have screen - what about picocom?

picocom -r -b 9600 /dev/ttyUSB0
the -r is a noreset switch on exit



38  Using Arduino / Programming Questions / Re: Email attachments from arduino as an SMTP client on: July 27, 2011, 10:41:57 am
some cam's already have email and ftp build-in like the Trendnet TV-IP110 (cheap as in like $49)

but your issue with that model and google is ssl - there might be other cams that support ssl.

You could also look into plug computers or routers that support open source firmware (I use a reflashed unslung nslu2) then you can use bash, c or php to do what ever you want.

I looked at trying to reflash the cams but way less info and way over my head to try and be the first to do it - when compared to plug/router/nas reflashing there's a ton of info for those devices.




39  Using Arduino / Project Guidance / Re: Behavior when receiving data over serial port (PC to Arduino) on: July 14, 2011, 09:51:25 pm
look at your serial software for a no reset command on exit i.e. the DTR line

for example picocom uses the -r

picocom -r -b 9600 /dev/ttyUSB0
40  Using Arduino / Motors, Mechanics, and Power / Re: Other ways of controlling water flow on: July 11, 2011, 07:42:46 am
http://www.irrigationdirect.com/irrigation-products-and-supplies/irrigation-valves/plastic-residential-valves

don't know if they will ship to you.

I used their valves for my sprinkler system and have been happy with them. All these types of valve leak a bit so don't use them inside...

I used a normal (their controller).
41  Using Arduino / Programming Questions / Re: Out of Memory on: June 30, 2011, 07:21:01 pm
this gives you a function that can check your ram
http://jeelabs.org/2011/05/22/atmega-memory-use/
42  Using Arduino / Project Guidance / Re: Flowmeter Node: RFM12b + Ethernet Shield on: June 29, 2011, 07:00:13 pm
I would put serial print statements at the beginning and ending of all your functions: "1s", "1e", "2s" etc - the last item that shows up when it locks up is then the point you can put even more serial print statements...
43  Using Arduino / Project Guidance / Re: Flowmeter Node: RFM12b + Ethernet Shield on: June 28, 2011, 04:23:44 pm
I'm using a different Ethernet shield then you - it put's all the returned postback into a char array - I don't think that it checks the sizeof of the char array so it overruns it if the returned postback stuff is larger then the length of the array. for example if I defined it at 200 chars then it would lock up but 500 worked. anyways I sort of found mine by trial and error - so I'm not sure how you track down buffer overflow's other then finding them...
44  Using Arduino / Project Guidance / Re: Flowmeter Node: RFM12b + Ethernet Shield on: June 28, 2011, 08:27:44 am
check if your running out of ram

http://jeelabs.org/2011/05/22/atmega-memory-use/

I would also look at a buffer overflow on the postback data from pachude
45  Using Arduino / Programming Questions / Re: Interfacing with Pachube (One Wire sensor) on: June 26, 2011, 11:47:28 am
you should also not post your api key - you should re-create it or someone will hack your account
Pages: 1 2 [3] 4 5 6