Академический Документы
Профессиональный Документы
Культура Документы
LED flasher
I made LED flash circuit which is often used as the PIC software making practice.
This circuit controls the blink of eight LEDs with the software of PIC.
The blinking pattern can be changed with five switches.
Pattern 1
Pattern 2
Pattern 3
Pattern 4
Pattern 5
Specification
PIC PIC16F84A
Key-in circuit
Five pins from RA0 to RA4 are used as the input pin.
These pins are pull-uped with 10K ohm resisters. So,
when a switch isn't pushed, the input becomes H level
( +5V ). and when a switch is pushed, it will become
L level ( 0V ). When the switch closes, the chattering
occurs. The chattering is the phenomenon which
occurs with the bound of the point of contact. The opening and shutting of a point of contact
is repeated in short time..
I don't put the prevention circuit of the chattering at the circuit this time. When the software
detects that the switch is closed once, the blink processing of LEDs are executed in the time
which is longer than the chattering.
Eight pins from RB0 to RB7 are used for the output pin.
The anode side of the LED is connected with +5 V and the cathode side is
controlled by PIC via the resistor. So, when the output of PIC is H level (+5V),
the LED goes out and when the output of PIC is L level (0V), the LED lights
up. I am using high brightness type LED to make an current flow little.
……..
3 terminal regulator is used to get +5V output from +12V power in.
Because it is suppressing the current of the LED, a 100 mA-type regulator is
enough.
PIC
78L05
Resonator
I used 10-MHz resonator. A ceramic vibrator and capacitors for the oscillation are combined inside.
Specification
PIC PIC16F84A
Minute : 00 - 99
Display
Second : 00 - 59
Circuit drawing
of Count-down timer
Device selection
by 3-8 decoder
2 Start switch
3 Unused
As for the terminal of the BCD switch, the terminals become a short circuit condition each other with
the specified figure. The illegal current flow through the BCD switch. The diodes are used to prevent
from this.
The 7 segment LEDs are connected with port B,too, but the illegal current dosen't flow because LED
itself is a diode.
When only one BCD-SW is connected with port B, this circuit is unnecessary. However, when more
than one BCD-SW and 7 segment LED are connected, it is indispensable.
The port A which connects a stop switch doesn't have a pull-up function. Therefore, it is pull-uped by
the resistor outside.
RA3 port is used for the relay control to make do a relay in the continuous control action.
The 25-mA can be applied to the port of PIC16F84A.
In case of the relay which was used this time, when adding +5 V to the drive coil, the flowing current is
about 23-mA. This is near the upper limit. So, I decided to drive a relay using the transistor for the
safety. The maximum of 150-mA current can be passed to the collector of the used transistor.
Parts explanation
of Count-down timer
PIC
The following table shows correspondence of the input and the output of 74HC138.
Input Output
C B A 00 01 02 03 04 05 06 07
L L L L H H H H H H H
L L H H L H H H H H H
L H L H H L H H H H H
L H H H H H L H H H H
H L L H H H H L H H H
H L H H H H H H L H H
H H L H H H H H H L H
H H H H H H H H H H L
Start/stop circuit
This is the circuit for the clockwise rotating, the counterclockwise rotating or stopping a
motor. The baton switch of the non lock is used. Pull-up resistor is used for the port to
become H level when the switch is OFF. The RB port of PIC16F84A has an internal pull
up feature. However, because RB5 is used for the voltage detection of the capacitor at the
circuit this time, an internal pull up feature isn't used. If using RA port for the voltage
detection of the capacitor, the RB internal pull up feature can be used. The circuit this
time put an external pull-up resistor in the relation of the pattern
PIC16F84A
At first, I used 2SD1590 ( 8A type ) as the transistor for the drive. However, in case of
the motor which was used this time, the coil current was about 250 mA. So, I changed into the small
type transistor. The maximum collector current of 2SD1209K is 1A and
"hfe" is more than 4000.
Circuit drawing
for DC motor speed controller
Circuit explanation
Control voltage input circuit
This is the circuit which inputs the control voltage
which was created by the turning of the motor in
PIC. The input voltage to PIC is converted by A/D
converter. Changed voltage is used for the PWM
function of the CCP to control the motor drive. At
the circuit this time, a small motor is used as the
generator to detect the number of rotations of the
motor. The input voltage (the control voltage) to PIC
is changed by the fluctuation of the number of
rotations of the motor. The other way can be used to
detect the number of rotations of the motor. It is need to change control voltage to proportional to the
number of rotations of the motor. PIC controls the drive electric current of the motor for the control
voltage to become a regulation value. When the revolution of the motor slows down, i.e. control
voltage goes down, the drive electric current of the motor is increased and number of rotations is
raised. When the control voltage reaches a regulation value, an drive electric current at the point is
held. Oppositely, when the number of rotations of the motor is high, i.e. the control voltage is high, the
drive electric current of the motor is reduced and number of rotations is lowered. When the control
voltage reaches a regulation value, an drive electric current at the point is held.
DB1 is used to make not conscious of the polarity of the motor. When never making a mistake in the
connection, to use isn't necessary. When the voltage of the motor for the speed detection is small, it is
better not to put.
D1 is used to protect PIC when the voltage of the detection motor is high. C1 is to make bypass the
Because the output of the motor which was used this time is big, there is a gravity that the motor for the
speed detection breaks. Therefore, an electric current is suppressed by the resistor to have put in series.
PIC16F873
In the circuit this time, PIC16F873 is used.
At the circuit this time, the control of the drive electric
current of the motor is done using the PWM function of
the CCP. The voltage according to the number of
rotations of the motor is taken in to the analog-to-digital
converter and has the control of the drive electric current.
This time, it is using a motor for the speed detection.
Also, LEDs for the monitor are lit up to know the
situation of the motor drive.
The voltage which is applied to the terminal of PIC is a maximum of +5V. This
diode prevents the destruction of PIC when the speed detection voltage of the motor
exceeds 5V. When more than +5V voltage be applied never from outside, it is
unnecessary.