0
\$\begingroup\$

I am really stuck here, our instructor told us not to use the 555 timer (and to be honest I never used it). So we are supposed to make a circuit by using counters only, I guess.

How can I generate time periods, and set time in seconds or minutes? Is Johnson Counter the best to use here?

I included the project needed and the periods I made, if any one could help me on that. My project is due to next Monday, and I would be really grateful if someone could give me an idea or a hint to start.


The Project: Design a digital circuit that can be attached to a school bill which can work automatically from 7:00 AM to 12:45 PM, and it has the following features

1- Rings for 5 seconds.

2- Start ringing 7:00 AM to announce for the field gathering.

3- Rings 7:20 for going to class.

4- Rings for the start of the first class period at 7:35 AM.

5- Rings for end of each period after 40 minutes from its start.

6- Rings for break after 10 minutes from the end of the previous period to announce for the next class period.

7- After the third period, a break of 30 minutes.


*The Bell rings for 5 seconds.

7:00 AM (Ring for field gathering)

7:20 AM (Ring for going to class)

7:35 AM (Ring for the 1st class START)

8:15 AM (Ring for the 1st class END)

8:15 AM – 8:25 AM (Break for 10 minutes)

8:25 AM (Ring for the 2nd class START)

9:05 AM (Ring for the 2nd class END)

9:05 AM – 9:15 AM (Break for 10 minutes)

9:15 AM (Ring for the 3rd class START)

9:55 AM (Ring for the 3rd class END)

9:55 AM – 10:25 AM (Break for 30 minutes)

10:25 AM (Ring for the 4th class START)

11:05 AM (Ring for the 4th class END)

11:05 AM – 11:15 AM (Break for 10 minutes)

11:15 AM (Ring for the 5th class START)

11:55 AM (Ring for the 5th class END)

11:55 AM – 12:05 AM (Break for 10 minutes)

12:05 AM (Ring for the 6th class START)

12:45 AM (Ring for the 6th class END)

\$\endgroup\$
  • \$\begingroup\$ A zip of a word document with a few lines of text in it? Ugh! Give us the information, not links to files within files. \$\endgroup\$ – Majenko Jan 3 '12 at 19:08
  • \$\begingroup\$ LOL. Sorry. I edited the post :D \$\endgroup\$ – Sam Jan 3 '12 at 19:15
  • 1
    \$\begingroup\$ A very very major problem is shown by you saying "So we are supposed to make a circuit by using counters only, I guess." That seems to be an extremely unlikely conclusion. We do not know what the emphasis of your course is or if a microcontroller solution is within the course framework. If it is within what the course covers it is overwhelmingly the best solution ans is what would and should be used. BUT if the course has covered counters and timers and the answer is not expected to contain a microcontroller then counters MAY make sense. BUT only then - and it is a poor way to do it. \$\endgroup\$ – Russell McMahon Jan 4 '12 at 10:19
  • \$\begingroup\$ One of the first things I was taught (as a computing undergrad) was "never assume" (they deliberately gave us some exercises that reinforced this message). So... given: "So we are supposed to make a circuit by using counters only, I guess." I'd strongly suggest you go find out (I know I'm somewhat repeating @RussellMcMahon - but the key here is you don't know so go ask) \$\endgroup\$ – Murph Jan 4 '12 at 17:45
8
\$\begingroup\$

However you do it you will require some kind of time signal as a base for your system.

That could be the (banned by your teacher) 555 timer, or a crystal oscillator, or anything which will give a regular on/off signal with a known frequency.

Then you have your counters.

Now, a binary counter module (like the 74xx393 for example) is also a frequency divider.

Take this truth table for example:

 IN | Q1 | Q2 | Q3 | Q4
----+----+----+----+----
  0 |  0 |  0 |  0 |  0 
  1 |  0 |  0 |  0 |  0
  0 |  1 |  0 |  0 |  0
  1 |  1 |  0 |  0 |  0
  0 |  0 |  1 |  0 |  0
  1 |  0 |  1 |  0 |  0
  0 |  1 |  1 |  0 |  0
  1 |  1 |  1 |  0 |  0
  0 |  0 |  0 |  1 |  0
  1 |  0 |  0 |  1 |  0
  0 |  1 |  0 |  1 |  0
  1 |  1 |  0 |  1 |  0
  0 |  0 |  1 |  1 |  0
  1 |  0 |  1 |  1 |  0
  0 |  1 |  1 |  1 |  0
  1 |  1 |  1 |  1 |  0
  0 |  0 |  0 |  0 |  1
  1 |  0 |  0 |  0 |  1
  0 |  1 |  0 |  0 |  1
  1 |  1 |  0 |  0 |  1
  0 |  0 |  1 |  0 |  1
  1 |  0 |  1 |  0 |  1
  0 |  1 |  1 |  0 |  1
  1 |  1 |  1 |  0 |  1
  0 |  0 |  0 |  1 |  1
  1 |  0 |  0 |  1 |  1
  0 |  1 |  0 |  1 |  1
  1 |  1 |  0 |  1 |  1
  0 |  0 |  1 |  1 |  1
  1 |  0 |  1 |  1 |  1
  0 |  1 |  1 |  1 |  1
  1 |  1 |  1 |  1 |  1

You can see that Q1 is toggling at half the speed of the IN pin. Q2 is toggling at half the speed again, and Q3 at yet half again - and so on.

So, it could be said that the frequency of Q1 is half IN, and Q2 is 1/4 IN and Q3 is 1/8 IN and q4 is 1/16 IN.

Therefore, if you have an input frequency of, say, 32768Hz (the speed watch crystals run at) then just using counters you can get:

  • 32768Hz
  • 16384Hz
  • 8192Hz
  • 4096Hz
  • 2048Hz
  • 1024Hz
  • 512Hz
  • 256Hz
  • 128Hz
  • 64Hz
  • 32Hz
  • 16hz
  • 8Hz
  • 4Hz
  • 2Hz
  • 1Hz - that's 1 second pulses
  • 0.5Hz - 2 seconds
  • 0.25Hz - you're at 4 second pulses now
  • 0.125Hz - 8 seconds
  • 0.0625Hz - 16 seconds
  • 0.03125Hz - 32 seconds

etc

You can see how it's possible to build up some fairly long periods from what starts out as quite a fast input clock. Combine various counters together and you can soon get lots of different times.

Of course, if you start with a different frequency you can get different time combinations. For instance, if you create a 0.2Hz clock signal to begin with (that's a 5 second pulse) then use the counters, you can make 10 seconds, 20 seconds, 40 seconds, 80 seconds, 160 seconds, etc quite easily.

\$\endgroup\$
11
\$\begingroup\$

This is just crying out for a microcontroller. Even the simplest dumbest that can drive a crystal (for accurate timing) can do this. That's certainly how it would be done in the real world.

If you've never used a micro before, there is a lot to learn. However, you seem to be in some electronic related field of study, so you'll have to learn this sooner or later. The sooner you do, the more you can have it available as a tool and not contort designs to avoid microcontrollers.

So dig in and get thru it. One of the PIC 12F from Microchip should be able to do this. Anything that can drive a crystal will do. A small 12F is easy to learn on because is has too little RAM and program memory to worry about banking and paging. Since the input to the logic is just the oscillator and the output is a single digital level that would ultimately drive the bells, this can be easily simulated. You can write and verify the whole program on the MPLAB simulator.

Find a PIC 12F that can drive a crystal (most of them I think), get some coming, read the datasheet, install the free MPLAB, and start playing with code in the simulator.

\$\endgroup\$
  • \$\begingroup\$ * and buy a programmer too. \$\endgroup\$ – Majenko Jan 3 '12 at 20:03
  • 2
    \$\begingroup\$ @Majenko: Any EE student is going to have to know microcontrollers. Think of a programmer like a course book, except that it's still useful after the final. \$\endgroup\$ – Olin Lathrop Jan 3 '12 at 21:23
  • \$\begingroup\$ Until you find the pickit2 you bought won't handle the newer chips so you have to shell out for a pickit3 as well :( \$\endgroup\$ – Majenko Jan 3 '12 at 21:25
  • 5
    \$\begingroup\$ Pickits are cheap compared to any textbook I ever had to buy for engineering. \$\endgroup\$ – Kellenjb Jan 4 '12 at 1:44
  • 1
    \$\begingroup\$ @Kortuk: Perhaps, but actually the only requirement was to not use a 555 timer. The OP said nothing about the instructor prohibiting microcontrollers. \$\endgroup\$ – Olin Lathrop Jan 4 '12 at 14:30
2
\$\begingroup\$

A 555 would be an extremely bad tool to use in this solution - so not using any is sensible.

This would be a trivially easy task for eg an Arduino.

If you are expected to NOT use a microcontroller then the following solution is a good one.

But, not using a microcontroller would be a decision verging on madness in any modern environment unless there were exceptional special reasons not to. For example, in some industries such as nuclear plants, use of any programmable equipment in even minor support role requires a degree of certification that makes their use unattractive in many applications. Unless this sort of requirement exists a microcontroller is 6 heads and 27 shoulders above any alternative.

SO

  • Provide a counter chain driven by a clock of adequate stability and with counter outputs that vary with a time resolution at least as fine as your need. eg ignoring the bell's 5 second run time, which is unrelated to the main timing. As your times all seem to be on 1 minute boundaries then a 1 minutes or finer "tick" will (probably) be OK.

  • Have say a binary counter with outputs of 1 2 4 8 16 32 64 128 256 512 minutes.
    Each of the above outputs is a high or a low = a 1 or a 0. To get outputs as above you need 10 outputs.
    A counter with outputs 1 to 512 above will count up to 1023 (= 1 less than what would be the next step ). 1023 minutes =~ 17 hours. Add the 1024 output if you want 34 hours = greater than one day. If you have 14 outputs you can cover a whole 7 day week with a location per 1 second.

    Provide a binary addressable memory with at least 10 address lines.

    Connect counter chain above to memory above and as the counter operates it addresses a new memory location once per minute.

This AT28HC64B 8k x 8 memory is massive overkill for what you'd want but happens to be Digikey's about cheapest electrically programmable PROM that suited. datasheet about $US2.65/1 .

Memories will typically be 8 bit. So you have say 8 on off outputs that can be changed once per minute.

Program the memory with a bell-ring output at times as required. As you have 8 bits you could be creative - eg set a bit for ring with extra blip at end of periods and another bit for different ring at start etc.

Actual duration of ring can be controlled by a counter that is triggered when a memory output goes high and starts counting and stops when it reaches a count corresponding to 5 seconds or whatever ring period is required. CD4060 has all that is required for this.
Seriously old data sheet here. Note fig 12 shows how it can self clock.

\$\endgroup\$
1
\$\begingroup\$

A microcontroller would certainly seem the most natural approach nowadays, given that cheap microcontrollers can be had cheaper than even the simplest programmable logic device or the discrete logic necessary to do just about anything. Nonetheless, from an educational standpoint, there could be some value in trying to figure out the optimal approach using something like a CPLD or a certain library of discrete logic chips.

For example, given that all times are multiples of five minutes, and that bells are supposed to ring for five seconds, it would probably make sense to design a circuit which would generate a five-second pulse every five minutes. Although one could design a circuit that would simply count 288 5-minute intervals per day and use combinatorial logic to decide which of those 288 intervals should ring the bell, it would probably be easier to subdivide the day into 32 variable-length intervals (use a 5-bit counter) and then use a 4-bit counter to generate those intervals (1-15 times five minutes). Use some combinatorial logic to set the length of the 32 variable-length intervals, and determine for each one whether the bell should ring at the beginning.

A discrete-logic solution could probably be realized in a somewhat-reasonable-sized board without overly much difficulty, using entirely 74xx-series counters and logic gates, plus a 32KHz oscillator. Minimizing the chip count might be an interesting challenge in logical thinking.

BTW, if I were designing the device as a practical circuit using 74xx-series logic, I might be inclined to use a 32-input multiplexer wired to the interval counter, and 16 outputs wired to the 5-minute counter, triggered at the very start of each 5-minute interval. A signal received at the currently-selected multiplexer input would sound the bell and/or reset the 5-minute counter and advance the interval counter. If the counter wrapped without a signal appearing on the multiplexer input, the interval counter would advance without ringing the bell. Note that each multiplexer input would have only one output connected to it, so there would be no need for blocking diodes.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.