Page 1 of 1

SB70LC - input circuit for a bucket tipper rain guage

Posted: Wed Jul 27, 2011 10:00 am
by BillC
Hi all, I am looking for information on a circuit that will allow me to interface a bucket tipper rain guage to a SB72LC dev kit or a SB72EX, the rain guage gives a reed switch pulse output and needs to be opto-isolated for lightening protection.

I guess that I will need to input this to an IRQ line input.

Has anyone done this before ?, and can they give me any advise.

Thanks in advance, Bill

Re: SB70LC - input circuit for a bucket tipper rain guage

Posted: Wed Jul 27, 2011 6:58 pm
by ecasey
Hi Bill,

I just did exactly what you are looking for with a MOD5282 board. I used the Pulse Accmulator, that way there is no CPU overhead, but it looks like the 5272 doesn't have that feature. My design also has an anenometer and a geiger counter that send pulses. Since the 5285 only has two pulse accumulators, I implemented the third one with an IRQ.

IRQ method was fairly simple:

Basically, the ISR just adds one to a global long variable and clears the interrupt. That way it has low overhead and the global variable just accumulates the pulses.

ISR looks like this:

unsigned long int Pulse;

Code: Select all

INTERRUPT( IRQ1_ISR, 0x2100 )
{
	Pulse++;
	sim.eport.epfr = IRQ1_ON;
}
Initializer looks like this:

Code: Select all

#define INTC0 0 /*Interrupt Controller 0 is the one that has the IRQ pins*/
#define IRQ_1 1
#define IRQ_LEVEL 1    /*Levels are 1 (lowest) to 7 (highest)*/
#define IRQ_PRIORITY 8 /*IRQ's are fixed mid level priority */
#define IRQ1_ON 0x02
#include <..\mod5282\system\sim5282.h>
#include <cfinter.h> /*this has to come afer include <ucos.h> I think.*/
#include <pins.h>
void InitializeIRQS(void) {
	sim.eport.epddr = 0x00; /*Set Edge Port ddr to input */
	J2[43].function(PINJ2_43_IRQ1_FET); /*FET = Falling Edge Trigger */
	sim.eport.epier |= IRQ1_ON;
	SetIntc(INTC0, (long) IRQ1_ISR, IRQ_1, IRQ_LEVEL, IRQ_PRIORITY);
}
Then all you should have to do is read "Pulse" and divide by the "tips per inch" of the tipping bucket.
That's the easy part. Next you have to figure out how to show a rolling 10 minute, hourly and daily reading.

Hope you can port it to the 5272.

I isolated with a schmidt trigger, but I think the IRQ's are schmidt inputs. I don't think that lightening cares how you isolate, I put a lightening rod (14 guage copper wire pointing up above the unit and grounded) with a view to bleeding off the static.

Good luck with this. Let me know if I can help further.

Ed

Re: SB70LC - input circuit for a bucket tipper rain guage

Posted: Sat Jul 30, 2011 3:48 am
by BillC
Thanks Ed, exactly what I needed to know.

I will let you know how I get on.

Bill

Re: SB70LC - input circuit for a bucket tipper rain guage

Posted: Sat Jul 30, 2011 5:23 am
by Ridgeglider
Most lightening protection uses some combination of TVS/Tranzorbs, sparkgap, or crowbar circuits.
If you look into the literature, there is a lot of info on AC power line surge protection, but you probably want to telcom / dataline protection devices.

Here is a TVS I've used:
http://www.semtech.com/images/datasheet/sdc36.pdf
http://www.digikey.com/ca/en/ph/Littelfuse/spa.html

Here are some manufactured modules for protecting telcom or data lines.
http://www.eaton.com/ecm/idcplg?IdcServ ... A01001005E
http://www.te.com/documentation/whitepa ... evices.pdf


Here are some descriptive articles and design guides:
http://www.littelfuse.com/data/en/Appli ... _Guide.pdf
http://en.wikipedia.org/wiki/Surge_protector
http://en.wikipedia.org/wiki/Transil
http://www.nist.gov/pml/quantum/spd.cfm