Hello Everyone
I am relatively new to electronics but am a seasoned programmer. I'm currently building a weather station based on the ATMega1284P Microcontroller. My rain gauge is of the tipping bucket style which works by way of a reed-switch. For various reasons I don't want to use an interrupt to detect when the reed-switch activates so I have decided to use a flip-flop. I just happen to have quite a few 74HC74 D-Type flip-flops available so it is convenient to use that IC.
When the rain gauge tips, it sends a pulse to the SET pin of the FF which of course causes Q1 to go HIGH. The Microcontroller then looks at Q1 and if HIGH adds to a counter and then resets the FF. All well and good! The problem with this FF is that it needs GND in order to SET and RESET. This is of course not a problem when setting however, it is a little awkward in code for me to send the reset pin to ground. I would much prefer (cleaner) to send a HIGH signal.
So my question is merely some advise:
I have decided to use a NPN transistor (2N3904) in a switch configuration to reverse the polarity required to reset the FF.
This configuration seems to work perfectly. My question? Is this an acceptable practice or are there hidden issues that I am not considering?
Many thanks
Amanda
I am relatively new to electronics but am a seasoned programmer. I'm currently building a weather station based on the ATMega1284P Microcontroller. My rain gauge is of the tipping bucket style which works by way of a reed-switch. For various reasons I don't want to use an interrupt to detect when the reed-switch activates so I have decided to use a flip-flop. I just happen to have quite a few 74HC74 D-Type flip-flops available so it is convenient to use that IC.
When the rain gauge tips, it sends a pulse to the SET pin of the FF which of course causes Q1 to go HIGH. The Microcontroller then looks at Q1 and if HIGH adds to a counter and then resets the FF. All well and good! The problem with this FF is that it needs GND in order to SET and RESET. This is of course not a problem when setting however, it is a little awkward in code for me to send the reset pin to ground. I would much prefer (cleaner) to send a HIGH signal.
So my question is merely some advise:
I have decided to use a NPN transistor (2N3904) in a switch configuration to reverse the polarity required to reset the FF.
- 74HC74 Reset Pin to the transistor's Collector
- Transistor's Emitter to Ground
- Transistor's Base to the Microcontroller via a 500R resistor
This configuration seems to work perfectly. My question? Is this an acceptable practice or are there hidden issues that I am not considering?
Many thanks
Amanda