Author Topic: Storing a momentary input, using hardware ONLY.  (Read 3710 times)

0 Members and 1 Guest are viewing this topic.

Offline McPeteTopic starter

  • Regular Contributor
  • *
  • Posts: 163
  • Country: au
  • Layout Designer, AKA eCAD monkey
Storing a momentary input, using hardware ONLY.
« on: April 24, 2011, 11:57:09 am »
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.
 

Offline johnwa

  • Frequent Contributor
  • **
  • Posts: 255
  • Country: au
    • loopgain.net - a few of my projects
Re: Storing a momentary input, using hardware ONLY.
« Reply #1 on: April 24, 2011, 01:19:48 pm »
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
 

Offline bilko

  • Frequent Contributor
  • **
  • Posts: 405
  • Country: 00
Re: Storing a momentary input, using hardware ONLY.
« Reply #2 on: April 24, 2011, 02:37:15 pm »
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
 

Offline Tony R

  • Regular Contributor
  • *
  • Posts: 117
  • Country: 00
Re: Storing a momentary input, using hardware ONLY.
« Reply #3 on: April 24, 2011, 02:58:18 pm »
Humm... well read switches are fine but

You will probably have some fairly severe 'contact bounce' to deal with due to the float bobbing up and down.

You 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.
Tony R.
Computer Engineering Student
Focus: Embedded Assembly Programming, Realtime Systems,  IEEE Student Member
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: Storing a momentary input, using hardware ONLY.
« Reply #4 on: April 24, 2011, 03:10:07 pm »
I never got to build that. Do we think it will work?

If 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.
 

Online Fraser

  • Super Contributor
  • ***
  • Posts: 13319
  • Country: gb
Re: Storing a momentary input, using hardware ONLY.
« Reply #5 on: April 24, 2011, 03:28:13 pm »
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 wrong  ;) It's basically 'bulb, switch & battery' technology  ;D

Your 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/1181048

http://uk.farnell.com/jsp/search/results.jsp?N=500006+1000186&Ntk=gensearch_001&Ntt=latching+relay&Ntx=mode+matchallpartial&isGoback=false&displaytext=&isRedirect=false

If I have helped you please consider a donation : https://gofund.me/c86b0a2c
 

Offline McPeteTopic starter

  • Regular Contributor
  • *
  • Posts: 163
  • Country: au
  • Layout Designer, AKA eCAD monkey
Re: Storing a momentary input, using hardware ONLY.
« Reply #6 on: April 26, 2011, 12:51:41 am »
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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf