Storing a momentary input, using hardware ONLY. - Page 1
Forum section: electronics / beginners

author: McPete
author_rank: Regular Contributor
timestamp: April 24, 2011, 11:57:09 am
content: Hey all,Just chasing a bit of advice, perhaps starting with a simple yes/no question. First, my situation.I'm revising project with 7400 series logic, to make a water tank level meter. The general idea is; There are a column of eight reed switches down the side of the tank, which are triggered by magnet attached to captive float.Now, the obvious problem that I faced originally was that between switches, there would be no indication- My teacher at the time told me not to worry about such practicalities (!). My solution was a 8-way OR of the inputs, using that to clock the active input (or a BCD representation of it) into a register, which would hold the output until the next switch is triggered, when the new level would be stored and held.I never got to build that. Do we think it will work?My aim, for the moment is to do this purely with hardware, then repeat it later with a uC.Thanks!P.

author: johnwa
author_rank: Frequent Contributor
timestamp: April 24, 2011, 01:19:48 pm
content: Hi,OK, it sounds like you just want to remember which input was the last one to go high. In principle, your idea should work, though you will have to take into account the 'set-up' time, and ensure the data is presented to the latch before it is clocked - see the timing diagrams on the datasheet of the part you are using. A simple, although slightly inelegant solution would be to add an R-C delay into the clock line. (you don't want to clock on the trailing edge, as the level will probably change fairly slowly, and the output would not reflect the actual level for long periods)There are probably a few other practical issues you will have to look at. Make sure that the magnet can never activate more than one switch at once. You will probably have some fairly severe 'contact bounce' to deal with due to the float bobbing up and down, and ripples on the surface of the water. This should not be a problem by itself, but could cause problems if the level alternates between two of the switches.I hope this is of assistance. I am looking at doing my own tank level meter fairly soon, though I was going to try an analogue capacitive probe. But I have just remembered that I have a bag of about 200 reed switches floating around somewhere, so I might do a high resolution meter using some of these.John

author: bilko
author_rank: Frequent Contributor
timestamp: April 24, 2011, 02:37:15 pm
content: It all sounds far too complicated (and unreliable). What's wrong with using something like an LM3914 with the reed switches switching in the resistors ?Failing that two or three quad comparators will do the same job

author: Tony R
author_rank: Regular Contributor
timestamp: April 24, 2011, 02:58:18 pm
content: Humm... well read switches are fine butQuote from: johnwa on April 24, 2011, 01:19:48 pmYou will want to debouce them (which is easy with a cap and a 74ls244 (or 240 one of them is inverting the other is not)I would also use a priority encoder 74LS148 you can set it up so if it does trigger more then one at a time it takes which ever is greater, this will allow for 8 switches and will encode it into a 3 bit output. you can then latch it from the priority encoder 74LS76 is a JK Flip Flop and should work quite well, you just have to make sure that you clear them when a new level is found.now, as for the BCD. A BCD need a 4 bit input, we have 3, so you can either only have it go 0-7 or you need to find another way to get one more bit.You can make almost anything in electronics work, sometimes you just need to find a way to get it to work.

author: Rufus
author_rank: Super Contributor
timestamp: April 24, 2011, 03:10:07 pm
content: Quote from: McPete on April 24, 2011, 11:57:09 amIf you fiddle around to ensure the clock you generate from data is timed to clock the data you want, and are careful about contact bounce and noise.If you insist on a logic solution you can make slightly nasty n way latches with n n-1 input nand gates. 3 way version attached. You can use open collectors and pull ups if you don't like shorting the outputs.

author: Fraser
author_rank: Super Contributor
timestamp: April 24, 2011, 03:28:13 pm
content: If you really want to work in the Hardware domain and even avoid semiconductors... how about using latching relays. They use to be quite common but I'm not sure these days. The relays latch when the relay is energised. They de-latch when operating a 'reset' using another relay winding. Not much to go wrongIt's basically 'bulb, switch & battery' technologyYour relay contacts can power any light current indicator.http://uk.farnell.com/omron-electronic-components/g6ak-234p-st-us-5dc/relay-pcb-dpco-5v-latching/dp/1181048http://uk.farnell.com/jsp/search/results.jsp?N=500006+1000186&Ntk=gensearch_001&Ntt=latching+relay&Ntx=mode+matchallpartial&isGoback=false&displaytext=&isRedirect=false

author: McPete
author_rank: Regular Contributor
timestamp: April 26, 2011, 12:51:41 am
content: Thanks for the replies!johnwa and Tony R; The spacing between the switches should ensure that there's no double-closed switches. I am still using a priority encoder though. Good point about debouncing, that's the next job.Yachtronics; Now that is something I'd thought about- I remember using one of those, or something similar, many moons ago in a kit that I half-assedly assembled when I was quite small. Not a bad idea, but I'm trying to see if I can do this purely with logic- I might thrown in a DAC as well, just for the heck of it.Aurora; I would love to do a proper old-school relay card with reed relays, but not on this project!By the by, does anyone know a source for an Eagle Library with a 74??48 or similar display driver? I'd like to avoid CMOS/TTL interfacing if I can, and eagle only seems to have 4000/4500 display drivers.Thanks!P.