Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Circuit to count LED pulses and latch on right number

Status
Not open for further replies.

Err404

Junior Member level 1
Junior Member level 1
Joined
Mar 20, 2011
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
London
Activity points
1,429
Circuit to count LED pulses and latch on right number

Should be quite simple.... I think...?
Say cct 'sees' 24 blinks - then no more (ie, too many means no_good)
I'd prefer it f this can be done without a microcontroller - ie. a simple fixed cct (no need to be able change the correct count once built).

If the right number - then latch is Set otherwise Restart test condition.

I would think the programming (of success on 24 pulses, say) can be don with logic (ie. 1100b), to set a flag line.
Of course it might be simpler to use a PIC or something anyway (I don't know I've not ever used them)... ?

Thanks.
 

if you are using a PIC10F series IC,It will be easier and simple. This system can be done within that small 6 pin single chip.
 
  • Like
Reactions: Err404

    Err404

    Points: 2
    Helpful Answer Positive Rating
if you are using a PIC10F series IC,It will be easier and simple. This system can be done within that small 6 pin single chip.

Thanks!
I'm going to look the IC up now, but I may be asking for programming help some time soon! :)
 

Okay - I've got a PIC programmer on on order and have been reading up on the assembler/reminding myself how assembler works.

In the meantime I am thinking about a slightly different project on similar lines.
- I have an old dial off an old and cheap combination padlock.
- I also have the guts of an old ball-mouse(ps/2) - with wheel optical encoding on it.

By means that I haven't got sorted yet I want to have the dial rotation to turn the encoder wheel (instead of the ball).
I'm going to use one of the micro-switches to 'see' a bump on the back of the dial at zero.
By this method the PIC will know the where any number on the dial is.

The first thing I need to do is work out whether the PIC can take an input signal direct from the opto at the wheel or needs some amplification/conditioning. Any idea?
 

A very common setup in idustry is very similar to what you describe, a quadrature encoder.
The encoder in a mouse is similar except for it doesnt have a 'z' pulse (one pulse each rev), but you allreready explained your gonna implent this sith a dimple and a microswitch.
The software is fairly simple, if you get pulse a before b the wheel is going one way, and b before a for t'other way, and the numer of pulses is how far the wheel has turned, you just need to impement a counter is software, simple using the incf n,F instruction n bieng the name of the register for the counter, then subtract 24 from it, if the zero flag isnt set you know the number isnt 24.
To get the thing to work you need to suss out which is the infra red led and which is the phototransistor on the encoder from the mouse, looking at the layout might tell you, the led will go to a resistor of a few hundred ohms, and the phototransistor will go to a resistor of a few k ohms.
Connect the led as you would any other to the 5v supply through a 470ohm resistor, then connect the emmiter of the phototranny to ground, connect the collector to the pic input and also to the collector a 4k7 resistor to +5, when the beam is unbroken you'll have a logic low, and a high when it is broken.
If your not sure which is which on the led try it both ways while viewing it using the camera on your 'phone, it can see infra red, once you got that working try the phototranny both ways round also while monitoring the output with a logic probe, one way will work, one not.
 
  • Like
Reactions: Err404

    Err404

    Points: 2
    Helpful Answer Positive Rating
Dr pepper - Thanks for the info on quadrature encoding.
The main limitation (not major one) with my method is either the operator has to 'zero' before starting the dial-in the sequence, or the PIC has to be in a state where it 'remembers' it's current position. And even with it remembering I suspect it could go out of tolerance over time.
Can you explain where the count of 24 comes from? (Something to do with having a 12-bit register?)
Thanks.

The guy who was going to supply me the programmer has gone flakey - so it may be a few weeks before I can get going on this. But I'm trying to get up on the code in the meantime.
 

if you are trying to save the last state, the PIC contains the integrated eeprom memory, the non volatile memory.
 

if you are trying to save the last state, the PIC contains the integrated eeprom memory, the non volatile memory.

It is more a concern about the mechanical aspect of the slotted wheel moving slightly whilst the PIC is 'asleep'.
However it does sound like (having read up a bit more) that I can use Wake-On-Change for this and still enjoy an almost unnoticeable power consumption.
Overall, though for simplicity, I think I'll just have a situation where the operator zero's before each entry of the combination.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top