# single pules in, multiple pulse output circuit

G

#### gazz

Jan 1, 1970
0
i'm making a home games room, currently have a few old fruit machines, a
pinball machine, jukebox, japanese pachislo machine and so on,

i've converted the coin mechs on them all to take the pachislo tokens,
because i have lots of them, and it's a lot easier than having to keep each
machine stocked with real money for wins.

i've also made a token dispenser, simble wooden cabinet, a coin controls
universal hopper holds the tokens, which it spits out 1 for every pulse of
12 volts it gets,

a coin validator takes real money (to save up for the electric bills

The coin validator takes care of checking the coin is real and it's value,
it then puts out a + 12 volt pulse on one of 5 pins (i.e. so 5p gives a
pulse on say pin 1, 20p gives a pulse on pin 3, 1 pound gives a pulse on pin
5 and so on) each coin registered gives out 1 single pulse.

There are commercial credit boards i can buy for about £30 to convert the
single pulse on different pins, to output multiple pulses to drive the coin
hopper, but my budget dosent stretch to the price of the commercial board,
not to mention the company that sells it are a pain to order from.

so i thought i'd build my own, should be simple?

i was thinking of maybe 555 timers, but was wondering if anyone has a better
idea, and can give me a circuit diagram to do what i want,
i can solder, draw pcb's in eagle, etch them, buy components,
i just fall down designing the circuits.

what i need is... 5 input pins, which each can take a 12 volt pulse of about
250 milliseconds duration,

depending on which input pin is pulsed, it outputs a set number of 12 volt
pulses on a single ouput pin,
these need to be greater than 5 milliseconds in duration and appart, the
hopper has circuitry in it to store the pulses it recieves, so it can
recieve 100 pulses in what ever time it takes to send them with 5ms delays
and durations, and will pay out 100 tokens in what ever time it takes to do
that.

i need pin 1's input to output 5 pulses, pin 2's input to output 10 pulses,
pin 3's input to output 20 pulses, pin 4's input to output 50 pulses, and
pin 5's input to output 100 pulses.

If possible i'd like it to be able to take multiple input pulses and count
the correct output pulses.. i.e. put in 5 x 20p coins, which will pulse pin
three 5 times, and it outputs 100 pulses,

or it could have a seperate output that goes to 0 volts whilst it is
outputting the pulses... this would be connected to the coin lockout pins on
the coin validator, preventing any new coins being registered and rejecting
them untill the circuit is ready to acceps another coin/pulse output.

Can anyone come up with a circuit diagram to do this?

J

#### Jasen Betts

Jan 1, 1970
0
The coin validator takes care of checking the coin is real and it's value,
it then puts out a + 12 volt pulse on one of 5 pins (i.e. so 5p gives a
pulse on say pin 1, 20p gives a pulse on pin 3, 1 pound gives a pulse on pin
5 and so on) each coin registered gives out 1 single pulse.

There are commercial credit boards i can buy for about Â£30 to convert the
single pulse on different pins, to output multiple pulses to drive the coin
hopper, but my budget dosent stretch to the price of the commercial board,
not to mention the company that sells it are a pain to order from.

that sounds like a good price to me.

unless you want to 'do some electronics' go with the board
so i thought i'd build my own, should be simple?

i was thinking of maybe 555 timers, but was wondering if anyone has a better
idea, and can give me a circuit diagram to do what i want,
i can solder, draw pcb's in eagle, etch them, buy components,
i just fall down designing the circuits.

there are circuits that use astable and monostable multivabrators
(like 555) to multiply pulses, but you're looking at using (at least)
6 555s and a bunch of other parts

or you could use a single microcontroller and a few other bits (this
is probably how the board is made)

Bye.
Jasen

P

#### petrus bitbyter

Jan 1, 1970
0
gazz said:
i'm making a home games room, currently have a few old fruit machines, a
pinball machine, jukebox, japanese pachislo machine and so on,

i've converted the coin mechs on them all to take the pachislo tokens,
because i have lots of them, and it's a lot easier than having to keep
each machine stocked with real money for wins.

i've also made a token dispenser, simble wooden cabinet, a coin controls
universal hopper holds the tokens, which it spits out 1 for every pulse of
12 volts it gets,

a coin validator takes real money (to save up for the electric bills

The coin validator takes care of checking the coin is real and it's value,
it then puts out a + 12 volt pulse on one of 5 pins (i.e. so 5p gives a
pulse on say pin 1, 20p gives a pulse on pin 3, 1 pound gives a pulse on
pin 5 and so on) each coin registered gives out 1 single pulse.

There are commercial credit boards i can buy for about £30 to convert the
single pulse on different pins, to output multiple pulses to drive the
coin hopper, but my budget dosent stretch to the price of the commercial
board, not to mention the company that sells it are a pain to order from.

so i thought i'd build my own, should be simple?

i was thinking of maybe 555 timers, but was wondering if anyone has a
better idea, and can give me a circuit diagram to do what i want,
i can solder, draw pcb's in eagle, etch them, buy components,
i just fall down designing the circuits.

what i need is... 5 input pins, which each can take a 12 volt pulse of

depending on which input pin is pulsed, it outputs a set number of 12 volt
pulses on a single ouput pin,
these need to be greater than 5 milliseconds in duration and appart, the
hopper has circuitry in it to store the pulses it recieves, so it can
recieve 100 pulses in what ever time it takes to send them with 5ms delays
and durations, and will pay out 100 tokens in what ever time it takes to
do that.

i need pin 1's input to output 5 pulses, pin 2's input to output 10
pulses, pin 3's input to output 20 pulses, pin 4's input to output 50
pulses, and pin 5's input to output 100 pulses.

If possible i'd like it to be able to take multiple input pulses and count
the correct output pulses.. i.e. put in 5 x 20p coins, which will pulse
pin three 5 times, and it outputs 100 pulses,

or it could have a seperate output that goes to 0 volts whilst it is
outputting the pulses... this would be connected to the coin lockout pins
on the coin validator, preventing any new coins being registered and
rejecting them untill the circuit is ready to acceps another coin/pulse
output.

Can anyone come up with a circuit diagram to do this?

I think that £30 to be a reasonable price for what you want. If you want to
make it yourself using convertional logic the design of a board like this is
a lot of work. Personally I'd use a micro keeping the board simple and
moving most of the designwork to the programming. But in both cases the cost
will rise beyond £30.

petrus bitbyter

A

#### Allen Bong

Jan 1, 1970
0
i'm making a home games room, currently have a few old fruit machines, a
pinball machine, jukebox, japanese pachislo machine and so on,

i've converted the coin mechs on them all to take the pachislo tokens,
because i have lots of them, and it's a lot easier than having to keep each
machine stocked with real money for wins.

i've also made a token dispenser, simble wooden cabinet, a coin controls
universal hopper holds the tokens, which it spits out 1 for every pulse of
12 volts it gets,

a coin validator takes real money (to save up for the electric bills

The coin validator takes care of checking the coin is real and it's value,
it then puts out a + 12 volt pulse on one of 5 pins (i.e. so 5p gives a
pulse on say pin 1, 20p gives a pulse on pin 3, 1 pound gives a pulse on pin
5 and so on) each coin registered gives out 1 single pulse.

There are commercial credit boards i can buy for about £30 to convert the
single pulse on different pins, to output multiple pulses to drive the coin
hopper, but my budget dosent stretch to the price of the commercial board,
not to mention the company that sells it are a pain to order from.

so i thought i'd build my own, should be simple?

i was thinking of maybe 555 timers, but was wondering if anyone has a better
idea, and can give me a circuit diagram to do what i want,
i can solder, draw pcb's in eagle, etch them, buy components,
i just fall down designing the circuits.

what i need is... 5 input pins, which each can take a 12 volt pulse of about
250 milliseconds duration,

depending on which input pin is pulsed, it outputs a set number of 12 volt
pulses on a single ouput pin,
these need to be greater than 5 milliseconds in duration and appart, the
hopper has circuitry in it to store the pulses it recieves, so it can
recieve 100 pulses in what ever time it takes to send them with 5ms delays
and durations, and will pay out 100 tokens in what ever time it takes to do
that.

i need pin 1's input to output 5 pulses, pin 2's input to output 10 pulses,
pin 3's input to output 20 pulses, pin 4's input to output 50 pulses, and
pin 5's input to output 100 pulses.

If possible i'd like it to be able to take multiple input pulses and count
the correct output pulses.. i.e. put in 5 x 20p coins, which will pulse pin
three 5 times, and it outputs 100 pulses,

or it could have a seperate output that goes to 0 volts whilst it is
outputting the pulses... this would be connected to the coin lockout pinson
the coin validator, preventing any new coins being registered and rejecting
them untill the circuit is ready to acceps another coin/pulse output.

Can anyone come up with a circuit diagram to do this?

If you really want to save money like I used to do, you should start
reading the 555 datasheets and search for sample circuits using 555
and try to construct a simple circuit that outputs 20 pulses when
there is a +12V pulse coming into the 555. Once this is working, the
rest will automatically fall into place. COnstruct 555 circuits which
output 5, 10, 50 and 100 pulses based on the first.

Just logical OR the outputs of the 5 sets of circuits that output
different numbers of pulses so it comes out with a single output and
you're almost done. After constructing the first one with 20 pulses
output you'll be able to calculate the cost of the final product and
see if your effort is worthwhile or not. This is the way how I learnt
electronics when I was younger. The experts here are willing to help
but you must show some efforts on your part !

Of course using a uC would be simpler but which uC are you familiar
with? Do you have any means to program a uC of your choice? Let's
see who come out with the circuit first.

Allen

G

#### gazz

Jan 1, 1970
0
If you really want to save money like I used to do, you should start
reading the 555 datasheets and search for sample circuits using 555
and try to construct a simple circuit that outputs 20 pulses when
there is a +12V pulse coming into the 555. Once this is working, the
rest will automatically fall into place. COnstruct 555 circuits which
output 5, 10, 50 and 100 pulses based on the first.

Just logical OR the outputs of the 5 sets of circuits that output
different numbers of pulses so it comes out with a single output and
you're almost done. After constructing the first one with 20 pulses
output you'll be able to calculate the cost of the final product and
see if your effort is worthwhile or not. This is the way how I learnt
electronics when I was younger. The experts here are willing to help
but you must show some efforts on your part !

Of course using a uC would be simpler but which uC are you familiar
with? Do you have any means to program a uC of your choice? Let's
see who come out with the circuit first.

----------------------

Cheers for that, the kind of answer i was hoping for,

i've never touched any kind of programmable chip, so prolly best to leave
that idea for now.

way i was thinking, 555's are about 50p each at maplins, a lot cheaper at
any other place i imagine, should need a few transistors, resisters and
capacitors and the pcb,

i have the copper clad board already, the ferric chloride, air pump, laser
printer to print the mask out on to iron to the pcb, so that bit is covered.

with the ready build circuit, it's £17 for the actual board, but they then
double the price with postage, packing, vat etc, that's the bit i dont like.

i dont need exactly 20 outputs, can go to 21, or 19 occasionaly, as it's
just family and friends who will be obtaining tokens,

so i was thinking a 555 that outputs for a set time upon an input pulse,
that timed output feeds another 555 that is pulsing it's output as long as
it's got an input.

am i on the right track?

A

#### Allen Bong

Jan 1, 1970
0
If you really want to save money like I used to do, you should start
reading the 555 datasheets and search for sample circuits using 555
and try to construct a simple circuit that outputs 20 pulses when
there is a +12V pulse coming into the 555.  Once this is working,  the
rest will automatically fall into place.  COnstruct 555 circuits which
output 5, 10, 50 and 100 pulses based on the first.

Just logical OR the outputs of the 5 sets of circuits that output
different numbers of pulses so it comes out with a single output and
you're almost done.  After constructing the first one with 20 pulses
output you'll be able to calculate the cost of the final product and
see if your effort is worthwhile or not.  This is the way how I learnt
electronics when I was younger.  The experts here are willing to help
but you must show some efforts on your part !

Of course using a uC would be simpler but which uC are you familiar
with?  Do you have any means to program a uC of your choice?  Let's
see who come out with the circuit first.

----------------------

Cheers for that, the kind of answer i was hoping for,

i've never touched any kind of programmable chip, so prolly best to leave
that idea for now.

way i was thinking, 555's are about 50p each at maplins, a lot cheaper at
any other place i imagine, should need a few transistors, resisters and
capacitors and the pcb,

i have the copper clad board already, the ferric chloride, air pump, laser
printer to print the mask out on to iron to the pcb, so that bit is covered.

with the ready build circuit, it's £17 for the actual board, but they then
double the price with postage, packing, vat etc, that's the bit i dont like.

i dont need exactly 20 outputs, can go to 21, or 19 occasionaly, as it's
just family and friends who will be obtaining tokens,

so i was thinking a 555 that outputs for a set time upon an input pulse,
that timed output feeds another 555 that is pulsing it's output as long as
it's got an input.

am i on the right track?

OK go to the website below:

http://home.cogeco.ca/~rpaisley4/LM555.html#6

and click on item #6, "controlling circuits for LM555 timers."
and see the circuit "oneshot controlling an astable oscillator."

The idea is to use your +12V pulse to trigger the first LM555 which is
configured as monostable. Its output will be used to trigger the
LM555 connected as an astable. Use the 555 calculator to get the the
5ms from the second 555 below. I just change the .1uF to 470nF (.
47uF) and I can get 131Hz which is about 7.63ms which I think should
work. The first 555 would control how long you want the 2nd 555 to
run. So to get 20 pulses I change the 1M resistor to a 1M preset and
1uF to 470nF and adjust the preset until you get 20 pulses from the
output of the 2nd 555.

http://ourworld.compuserve.com/homepages/Bill_Bowden/555.htm

Since your input is a positive 12V pulse, you need to invert it to a
negative going pulse. Using a NPN transistor will acomplish that.

I will get the schematics in ascii form when it's ready.

Allen

A

#### Allen Bong

Jan 1, 1970
0
OK go to the website below:

http://home.cogeco.ca/~rpaisley4/LM555.html#6

and click on item #6, "controlling circuits for LM555 timers."
and see the circuit "oneshot controlling an astable oscillator."

The idea is to use your +12V pulse to trigger the first LM555 which is
configured as monostable.  Its output will be used to trigger the
LM555 connected as an astable.  Use the 555 calculator to get the the
5ms from the second 555 below.  I just change the .1uF to 470nF (.
47uF) and I can get 131Hz which is about 7.63ms which I think should
work.  The first 555 would control how long you want the 2nd 555 to
run.  So to get 20 pulses I change the 1M resistor to a 1M preset and
1uF to 470nF and adjust the preset until you get 20 pulses from the
output of the 2nd 555.

http://ourworld.compuserve.com/homepages/Bill_Bowden/555.htm

Since your input is a positive 12V pulse, you need to invert it to a
negative going pulse.  Using a NPN transistor will acomplish that.

I will get the schematics in ascii form when it's ready.

Allen- Hide quoted text -

- Show quoted text -

So here goes the circuit in ascii form. You have to view it in
courier font.

+------+--------+-------+---+-------+---------+
| | | | | | |
| | | .-. |1M | .-.
| | | | |<-+PRESET | | |
| | |8 | | |8 | |3K3
| | .--+----. '-' .--+----. '-'
|100K |100K | | | | |7 |
.-. .-. | | | 4| |----+-+
| | | | | A1 |3-|---+----| A2 |3-----|----OUTPUT
| | | | | 555 | | | | 555 | .-.
'-' '-' | |7-+ .-. | |6 | |
| || | 2| | | | | | |-+ | |10K
+--||--+-----| |6-+ | |2K2| | | '-'
| ||100nF '-+-----' | '-' '-+--+--' | |
| 1| --- | 1| 2+----+--+-+
| | 470nF --- | | |
+---------+ | | === | ---
| | | GND | ---470nF
| === === === |
___ |/ GND GND GND |
-|___|-+-| BC547 ===
IN 10K | |> GND
.-. |
| | |
4K7| | |
'-' |
| |
+---+
|
===
GND
(created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de)

So once you get this working on a breadboard. The next step is to
construct 4 more monostables using 4 LM555 and feed their outputs to
the pin 4 of the 2nd LM555. As the output of LM555 is not open-
collector, you need to get a 5-input-OR gate in cmos 40XX (use google
to find it) and connect each output of the 1st 555 to the OR gate
input and the output to the 2nd 555 chip.

If you can go this far, I will try to figure out how to get the logic
Low which is require to signal to the coin dispenser so it won't
accept the next coin during the pulse-sending occasion.

Hope you now get the fun of circuit designing.

Allen

G

#### gazz

Jan 1, 1970
0
cant access the binary groups unfortunately,

i'm going to get a breadboard and have a play with that as suggested by
allen, been reading up on the 555 chip a little,

the thing that was throwing me was the triggers are done on the negative
side, and my coin validator outputs a positive pulse.... there is another
one that can output either a neg or pos pulse, but i need that validator in
one of my fruit machines, the one i have in the change machine is the one
that came out of that fruit machine.

i think and hope this project will be enough to kickstart me into getting
into electronics more, i like to take apart mechanical items and find out
how they work (my 1975 bell fruit machines are great for that, all relays,
timers and motor driven cam switches, i can figure out what happens when in
the cycle of a go on that)

But the electronic boards are still a bit of a mystery to me, the only
electronics i did from school to now have been following circuit diagrams to
make up a board, so all i was really doing was soldering them in the right
holes, never had to really think what each component was doing further than
switches and resistors.

thanks for the help so far, will let you know when i've either made a
sucsessful circuit on breadboard, or let all the magic smoke out and take
it from there,

might get adventurous and try to make the circuit so it can handle multiple
coin inserts rather than making them go in one at a time, i.e. put in 3 x
20p's one after the other, first pulse starts the 20 token output timer, 2nd
and 3rd pulses get held so to speak (buffered?), when the timer has run out,
it gets re-triggered 2 more times,

G

#### gazz

Jan 1, 1970
0
John Fields said:

JF
i might have found it, would it be labeled 'pulse delay timer' by any
chance??

found that by searching on usnet replayer for anything with 555 in the
title, found 2 versions, one has some components added listed as spare.

A

#### Allen Bong

Jan 1, 1970
0
cant access the binary groups unfortunately,

i'm going to get a breadboard and have a play with that as suggested by
allen, been reading up on the 555 chip a little,

the thing that was throwing me was the triggers are done on the negative
side, and my coin validator outputs a positive pulse.... there is another
one that can output either a neg or pos pulse, but i need that validator in
one of my fruit machines, the one i have in the change machine is the one
that came out of that fruit machine.

i think and hope this project will be enough to kickstart me into getting
into electronics more, i like to take apart mechanical items and find out
how they work (my 1975 bell fruit machines are great for that, all relays,
timers and motor driven cam switches, i can figure out what happens when in
the cycle of a go on that)

But the electronic boards are still a bit of a mystery to me, the only
electronics i did from school to now have been following circuit diagramsto
make up a board, so all i was really doing was soldering them in the right
holes, never had to really think what each component was doing further than
switches and resistors.

thanks for the help so far, will let you know when i've either made a
sucsessful circuit on breadboard, or let all the magic smoke out and take
it from there,

might get adventurous and try to make the circuit so it can handle multiple
coin inserts rather than making them go in one at a time, i.e. put in 3 x
20p's one after the other, first pulse starts the 20 token output timer, 2nd
and 3rd pulses get held so to speak (buffered?), when the timer has run out,
it gets re-triggered 2 more times,

might get adventurous and try to make the circuit so it can handle
multiple
coin inserts rather than making them go in one at a time, i.e. put in 3 x
20p's one after the other, first pulse starts the 20 token output timer, 2nd
and 3rd pulses get held so to speak (buffered?), when the timer has run out,
it gets re-triggered 2 more times,

I dont think it is that easy to design one that will remember the
coins that was thrown in succession before the tokens were out. It
has to be remembered in registers or latches. So a uC like PIC would
remember each input in the RAM as variables like _5P, _10P, _20P, _50P
and _100P. Then the software pulse generator inside would generate
the requite number of pulses and each time enough pulses are
generated, the variable would be decremented by one. This continues
until all the variables become zero. I guess you would have to use
interrupts at the input so no input pulse is missed.

BTW, I check that there wasn't any 8-input OR gate:

http://www.kpsec.freeuk.com/components/cmos.htm#4068

so you can construct it using 3 input OR gates like this:

__ 4075
A ------\ \
B -------| |---+
C ------/__/ | __
+---\ \
__ +--| |-P4 OF 555
D ------\ \ +-+-/__/
E ---+---| |---+
+--/__/

(created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de)

Have you got the schematics from John Field? I would like to have a
look at it as well as I am learning too!

Allen

J

#### Jasen Betts

Jan 1, 1970
0
I dont think it is that easy to design one that will remember the
coins that was thrown in succession before the tokens were out. It
has to be remembered in registers or latches. So a uC like PIC would
remember each input in the RAM as variables like _5P, _10P, _20P, _50P
and _100P. Then the software pulse generator inside would generate
the requite number of pulses and each time enough pulses are
generated, the variable would be decremented by one. This continues
until all the variables become zero. I guess you would have to use
interrupts at the input so no input pulse is missed.

the input pulses are so slow (250ms) that it's enough to check for one
before each output pulse (every 10 ms)

this problem could be solved with a very simple program
(this for Atmel AtTiny13, chosen because they can be programmed using
just a PC and a DB25 plug (no silly voltages or anything like that))

#define F_CPU 1200000UL
/* uncalibarated this is the fastest an atTiny12 will go */
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/interrupt.h>
#include <util/delay.h>

long int pulses_due = 0;
unsigned char instate = 0,newin,coinbits;

int main(void)
{
cli();
# ifdef CLOCK_CALIBRATION_BYTE
OSCCAL=CLOCK_CALIBRATION_BYTE;
# endif
PORTB=1;
DDRB=1;
while(1)
{
wdt_reset();
newin=PINB;
coinbits=newin & ~instate;
instate=newin;
if( coinbits & 2 ) pulses_due=pulses_due+5;
if( coinbits & 4 ) pulses_due=pulses_due+10;
if( coinbits & 8 ) pulses_due=pulses_due+20;
if( coinbits & 16) pulses_due=pulses_due+50;
if( coinbits & 32) pulses_due=pulses_due+100;
if( pulses_due > 0 )
{
PORTB=0 ; // writing 0 turns off bc547 transistor
// and produces high output
--pulses_due;
}
_delay_ms(6); // 6ms incase the clock drifts
PORTB=1; // turn transistor back on
wdt_reset();
_delay_ms(6); // 6ms incase the clock drifts
}
}

BTW, I check that there wasn't any 8-input OR gate:

if you're going to do it that way,
just use diodes, they'll be easily fast enough.

here's the circuit for the above program.

.-------------------------------------------------------------.
| This is an ascii schematic, if the diagram appears garbled |
| try switching to a fixed-pitch font (courier works well) |
| pasting it into notepad works well on ms-windows. |
| or in google groups "show original" (under more options) |
-------------------------------------------------------------'

1n914
.----->|--------------+----[1K]---< +12V
| |
| . . . . . . . |
| . | | . | 5.1V zener
100p >--[10K]-+-[. O \_/ .]-----+------Z<-------.
. . |
. . ---+--- GND
20p >--[10k]---[. .]---[10K]--< 10p
. . +--[1K]--< +12V
. atTiny13 . |
50p >--[10K]---[. .]---[10K]--< 5p +--+--------> out
. . /c
. . |/
.---[. .]----[1K]------| BC547
| . . |\|
| . . . . . . . ~\e
| +
| |
gnd ----+-----------------------------------+--

use high fuse byte 0x01 to enable the 100p input (this can't be
reversed and makes reprogramming the chip impossible without
expensive hardware so do it after the other functions are
tested), while testing wire pin 1 to pin 8 or connect the 100p input

Bye.
Jasen

A

#### Allen Bong

Jan 1, 1970
0
I dont think it is that easy to design one that will remember the
coins that was thrown in succession before the tokens were out.  It
has to be remembered in registers or latches.  So a uC like PIC would
remember each input in the RAM as variables like _5P, _10P, _20P, _50P
and _100P.  Then the software pulse generator inside would generate
the requite number of pulses and each time enough pulses are
generated, the variable would be decremented by one.  This continues
until all the variables become zero.  I guess you would have to use
interrupts at the input so no input pulse is missed.

the input pulses are so slow (250ms) that it's enough to check for one
before each output pulse (every 10 ms)

this problem could be solved with a very simple program
(this for Atmel AtTiny13, chosen because they can be programmed using
just a PC and a DB25 plug (no silly voltages or anything like that))

#define F_CPU 1200000UL
/* uncalibarated this is the fastest an atTiny12 will go */
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/interrupt.h>
#include <util/delay.h>

long int pulses_due = 0;
unsigned char instate = 0,newin,coinbits;

int main(void)
{
cli();
#       ifdef CLOCK_CALIBRATION_BYTE
OSCCAL=CLOCK_CALIBRATION_BYTE;
#       endif
PORTB=1;
DDRB=1;
while(1)
{
wdt_reset();
newin=PINB;
coinbits=newin & ~instate;
instate=newin;
if( coinbits & 2 ) pulses_due=pulses_due+5;
if( coinbits & 4 ) pulses_due=pulses_due+10;
if( coinbits & 8 ) pulses_due=pulses_due+20;
if( coinbits & 16) pulses_due=pulses_due+50;
if( coinbits & 32) pulses_due=pulses_due+100;
if( pulses_due > 0 )
{
PORTB=0 ; // writing 0 turns off bc547 transistor
// and produces high output
--pulses_due;
}
_delay_ms(6); // 6ms incase the clock drifts
PORTB=1;      // turn transistor back on
wdt_reset();
_delay_ms(6); // 6ms incase the clock drifts
}

}
BTW, I check that there wasn't any 8-input OR gate:

if you're going to do it that way,
just use diodes, they'll be easily fast enough.

here's the circuit for the above program.

.-------------------------------------------------------------.
| This is an ascii schematic, if the diagram appears garbled  |
| try switching to a fixed-pitch font (courier works well)    |
| pasting it into notepad works well on ms-windows.           |
| or in google groups "show original" (under more options)    |
-------------------------------------------------------------'

1n914
.----->|--------------+----[1K]---< +12V
|                     |
|  . . . . . . .      |
|  .   |   |   .      |    5.1V zener
100p >--[10K]-+-[. O  \_/    .]-----+------Z<-------.
.           .                      |
.           .                   ---+--- GND
20p >--[10k]---[.           .]---[10K]--< 10p
.           .                     +--[1K]--< +12V
. atTiny13  .                     |
50p >--[10K]---[.           .]---[10K]--< 5p   +--+--------> out
.           .                 /c
.           .               |/
.---[.           .]----[1K]------|   BC547
|    .           .               |\|
|    . . . . . . .               ~\e
|                                   +
|                                   |
gnd ----+-----------------------------------+--

use high fuse byte 0x01 to enable the 100p input (this can't be
reversed and makes reprogramming the chip impossible without
expensive hardware so do it after the other functions are
tested),  while testing wire pin 1 to pin 8 or connect the 100p input

Bye.
Jasen

This design was really cool and simple. C program is really so neat
and short. I've never program in atTiny13 only the at89s51 series and
PICs. What did you mean by "the high fuse byte 0x01" ? Was pin 1 the
security bit for the chip and after burning this bit you have to erase
the flash using high voltage?

I will try to order some of these chip and try it out some day. Was
the assembly lang hard to learn?

Allen

G

#### gazz

Jan 1, 1970
0
wow, getting heavy now

thanks for all the suggestions and replies,

i'm going to build the 555 timer version first, once i can master them i'll
look into the pic's and all that.

G

#### gazz

Jan 1, 1970
0
i have the schematic from john fields,

uses a 40103, i'm trying to lay it out in eagle (the pcb designer software)
but their libraries dont have a 40103 listed, just a 40106, which is a
schmidt trigger, and a 40193, which is a binary up down counter,

would the 40193 be similar enough to use for laying out a pcb?

G

#### gazz

Jan 1, 1970
0
FAO John Fields,

can i just check i have the right parts list....

The part numbers are what my local electronics place list, tell me if i have
any wrong.

1 x CD74HCT40103E.... that's the 40103 down binary counter.

1 x 4011B... the quad 2 input nand gate,

18 x 1N4148 signal diodes, is 75V 150Ma enough?

1 x 10Nf capacitor... ceramic disc type?

1 x 100Nf capacitor.. again ceramic disc?

9 x 10k Resistors.... 0.1% 0.4w?

1 x 100k Resistor... same spec as above,

1 x 5100 resistor... that's thrown me a bit, 5.1k? this is for R11

1 x low current red led.

1 x 2N3904 NPN transistor, in a TO-92 package, 60V

Have i missed anything out? or got any components wrong?
just that 5100 resistor thats got me really,

regards,

gazz

J

#### Jasen Betts

Jan 1, 1970
0
This design was really cool and simple. C program is really so neat
and short.

Actually I like Johns better
I've never program in atTiny13 only the at89s51 series and
PICs. What did you mean by "the high fuse byte 0x01" ? Was pin 1 the
security bit for the chip and after burning this bit you have to erase
the flash using high voltage?

the fuse bytes are configuration bytes that aren't part of the
executable program portion of the flash the documentation with
the programming tool will explain say how to program them

setting that bit turns off the reset pin's reset function, the reset
signal is also used to program the chip (in low voltage mode), and so,
with it disabled, the chip can only be rewritten in high-voltage mode.
I will try to order some of these chip and try it out some day. Was
the assembly lang hard to learn?

I found it quite easy. there's 32 registers that are mostly
interchangable and that makes life easy for many things.
I found it somewhat like a Z80 but with more registers

the same program should work in any of the larger atTiny series.
but will not need the fuse bit as the larger ones come with at-least
5 IO pins on PORTB in their default configuration.
It could probably be re-written in assember for the atTiny12

(GCC likes to have a processor with a stack and the atTiny12 has no
ram but its registers, and no stack pointer)

it compiles, and looks good to me, I have not tested it.

Bye.
Jasen

G

#### gazz

Jan 1, 1970
0
Gotya, i want to keep the circuit as 12 volts, so will search out the
correct part.

G

#### gazz

Jan 1, 1970
0
darn it, can get the CD40103B ar RS components, but gotta buy 10 of them at
29p each, BUT they are part of the extended range, and incur a £10 order
fee!!!! nuts to that.

farnell has the CD40103BE, is that the same? that one is 55p and can buy
singles, but they have a minimum order of £25,

B

#### [email protected]

Jan 1, 1970
0
i'm making a home games room, currently have a few old fruit machines, a
pinball machine, jukebox, japanese pachislo machine and so on,

i've converted the coin mechs on them all to take the pachislo tokens,
because i have lots of them, and it's a lot easier than having to keep each
machine stocked with real money for wins.

i've also made a token dispenser, simble wooden cabinet, a coin controls
universal hopper holds the tokens, which it spits out 1 for every pulse of
12 volts it gets,

a coin validator takes real money (to save up for the electric bills

The coin validator takes care of checking the coin is real and it's value,
it then puts out a + 12 volt pulse on one of 5 pins (i.e. so 5p gives a
pulse on say pin 1, 20p gives a pulse on pin 3, 1 pound gives a pulse on pin
5 and so on) each coin registered gives out 1 single pulse.

There are commercial credit boards i can buy for about ?30 to convert the
single pulse on different pins, to output multiple pulses to drive the coin
hopper, but my budget dosent stretch to the price of the commercial board,
not to mention the company that sells it are a pain to order from.

so i thought i'd build my own, should be simple?

i was thinking of maybe 555 timers, but was wondering if anyone has a better
idea, and can give me a circuit diagram to do what i want,
i can solder, draw pcb's in eagle, etch them, buy components,
i just fall down designing the circuits.

what i need is... 5 input pins, which each can take a 12 volt pulse of about
250 milliseconds duration,

depending on which input pin is pulsed, it outputs a set number of 12 volt
pulses on a single ouput pin,
these need to be greater than 5 milliseconds in duration and appart, the
hopper has circuitry in it to store the pulses it recieves, so it can
recieve 100 pulses in what ever time it takes to send them with 5ms delays
and durations, and will pay out 100 tokens in what ever time it takes to do
that.

i need pin 1's input to output 5 pulses, pin 2's input to output 10 pulses,
pin 3's input to output 20 pulses, pin 4's input to output 50 pulses, and
pin 5's input to output 100 pulses.

If possible i'd like it to be able to take multiple input pulses and count
the correct output pulses.. i.e. put in 5 x 20p coins, which will pulse pin
three 5 times, and it outputs 100 pulses,

or it could have a seperate output that goes to 0 volts whilst it is
outputting the pulses... this would be connected to the coin lockout pins on
the coin validator, preventing any new coins being registered and rejecting
them untill the circuit is ready to acceps another coin/pulse output.

Can anyone come up with a circuit diagram to do this?

i am looking for a 16 pin hopper can anyone help? [email protected]

Replies
21
Views
543
Replies
1
Views
321
Replies
5
Views
442
Replies
8
Views
1K
Replies
4
Views
1K