Show Posts
Pages: [1]
1  Using Arduino / General Electronics / Re: [SOLVED] How to read a pulse on: October 05, 2012, 04:27:53 am
Thank you for your help guys, I managed to get it working.
Much appreciated!
2  Using Arduino / General Electronics / Re: How to read a pulse on: October 04, 2012, 02:00:59 pm
Can you post your entire circuit.

The statement that it works and "However when I remove the connection to the computer the whole thing goes crazy printing lots of pulse times which are all wrong as I am not pouring water, and thus should not receive anything." seem mutually exclusive.

One wire will not work; there is a sneaky earth coming in somewhere.

If your bucket tips quite slowly (say, as slow as 10ms which is 1/100 second), you have plenty of time to poll
for a change, double or triple check the signal is stable to allow for debounce, increment your counter, then continue to poll until the end of the pulse.  An arduino runs its main loop about 20000 times a second.  Polling allows debounce,
interrupts make that quite a bit harder.  Try a quick polling sketch to see.

I created a quick scheme how I connected everything. I have a Serial2USB converter on the female serial connector that can be seen in the scheme. When the USB is connected to the computer the Arduino reads more or less the correct result. For each pulse I generate (by pouring water over the sensor) it displays 3 pulses via the serial port of the Arduino which I am listening to. So this might not be totally correct either. I read in the RG-11 documentation that each generated pulse stays HIGH for 50ms.

If I remove the USB from my computer then the Arduino registers hundreds of pulses as can be seen via the Serial listener. When I put a wire from the ground pin to the arduino ground pin then everything seems fine with the detail that it never will sense any pulses at all anymore ...
Also when I place the COM output into the Arduino GND pin and the NO output into the Arduino digital pin 2 then nothing will happen. Same behaviour as the last sentence above.

So somehow I am putting everything wrong together.

3  Using Arduino / General Electronics / Re: How to read a pulse on: October 04, 2012, 12:48:59 pm
Quote
How do I connect this sensor so that I can count it's pulses.

Too many different ways: first, you need to decide if you want to polling or interrupt. Polling is easy but is very sensitive to loop timing. Interrupt frees up the mcu but is a little bit more difficult to program.

With interrupt, you can use an external interrupt, or a port change interrupt, or a timer interrupt.

Without you deciding which approach you would like to try, it is impossible to give you more details.


I would like to use a port change interupt.
For example:
Code:
attachInterrupt(0, some_function, RISING);

However for debugging purposes I was thinking about polling as there will be no other code executed at this time.
4  Using Arduino / General Electronics / Re: How to read a pulse on: October 04, 2012, 12:45:00 pm
One Wire?, any sensor needs at least two connections.

Yes I managed to get the PulseIn function working with just one wire in the digital port smiley
5  Using Arduino / General Electronics / [SOLVED] How to read a pulse on: October 04, 2012, 11:23:14 am
Good afternoon,

I am having a rain sensor which will send a pulse every time it reaches a certain volume (tipping bucket).
I did create a serial link with my computer following the instructions found on: http://www.weather-above.com/Rain%20Tracker%20Rain%20Gage.html

Using CoolTerm as a serial port listener you can see the DSR light blink every time a pulse comes in and thus you can say that it works.
However now I want to read this pulse on my arduino and not anymore on the computer. If I place one wire from the DSR pin of the female serial connector to the arduino digital pin then I can retrieve the length of each pulse with PulseIn. However when I remove the connection to the computer the whole thing goes crazy printing lots of pulse times which are all wrong as I am not pouring water, and thus should not receive anything.

I am using a Arduino Ethernet with PoE as I would like to eventually send the pulse information via the network to my server and display this information on my website.

My code:
Code:
int pin = 2;
unsigned long duration;

void setup()
{
  pinMode(pin, INPUT);
  Serial.begin(9600);
  Serial.println("Started");
}

void loop()
{
  duration = pulseIn(pin, HIGH);
  Serial.println(duration, DEC);
}

So basically my question is: How do I connect this sensor so that I can count it's pulses.
6  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino resetting when connecting USB on: October 13, 2008, 02:58:52 pm
I searched for auto-reset and found a nice page where indeed everything is being explained nicely. I made a hyperlink to it for people that search for usb reset instead on auto-reset like me smiley-wink

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1213719666/0
7  Forum 2005-2010 (read only) / Troubleshooting / Arduino resetting when connecting USB on: October 13, 2008, 12:15:45 pm
Hello,
I'm working with the Arduino Diecimila for a school project. I'm using the USB connection to send data so that the controller can do something. I noticed that the board is resetting pretty often, I think one of the reasons is the USB. If I for example pull the USB cable out of my computer and then re-insert it the board resets. But this is something I don't want.

Is there a way to get rid of this functionality? Anybody else has experience that the board resets because of the USB connection?
Pages: [1]