Home » Posts filed under Digital Circuit
PIC16F684 Digital Ammeter
Automated Digital Camera Shutter

In 1984 I made a camera trigger to capture transient phenomena. I had a Mamiya ZE 35mm camera and Mamiyalite ZE flash unit. Common for bodies of its time, the only indicates of remotely triggering the camera was the cable release socket built into its shutter release button. This was meant to get employed having a purely mechanical cable; it allow you to operate the shutter release from a smaller distance away, and inside a manner that avoided introducing vibration towards the camera at the moment a image was taken. My remedy for releasing the shutter electrically was to make a solenoid set off. I rewound the coil of a little solenoid so that it could produce the required force when operated at 9V. It had been a retraction sort solenoid, which means that applying current to it pulled the armature in. I needed an extension solenoid, so I drilled a hole within the rear of it. I removed the camera end from a cable release - the component that screws to the cable release hole - and soldered it to the rear. I drilled a hole inside the finish of your armature, lower the pusher end from the cable that was part of the release, soldered that in to the armature, and then fed the pusher down through the solenoid and out the finish from the cable release.
The entire thing was light sufficient that I could basically screw it onto the shutter release of the camera and it would be supported with out depressing the button. The other end of the solenoid was threaded for mounting in the way it absolutely was initially designed for. I found a cap that might match this thread. This turned out to get particularly useful, because if set for automated coverage, the camera required that the shutter release be partially depressed for lengthy enough for it to complete its calculation. If the shutter release was basically slammed down as fast since the solenoid did it, the shutter was launched instantly and with incorrect coverage. By adjusting how far I screwed the cap down I could make the shutter release be originally depressed far enough to activate the camera. To run the solenoid I created a circuit that might briefly use present to it when triggered. Additionally, it had a “test” place that will operate a sounder as an alternative to the solenoid, to facilitate setup. I ended up using this program mainly for taking photos of rockets lifting off.
The products that I utilised together with the trigger integrated hardwired circuits and an ultrasonic remote. The ultrasonic remote is at left. I created it with a pair of surplus forty kHz transducers. The green extension cord at proper has an inline switch to set no matter whether units plugged in to the mini jack on the end operate as normally-closed or normally-open triggers. The equipment using the bolt was utilized to consider the tennis-ball cannon pictures beneath.
Digital Electronic Lock Circuit Schematic
Digital Electronic Lock
Parallel Port Relay Interface Circuit
Parallel Port Relay Interface
Below are three examples of controlling a relay from the PC's parallel printer port (LPT1 or LPT2). Figure A shows a solid state relay controlled by one of the parallel port data lines (D0-D7) using a 300 ohm resistor and 5 volt power source. The solid state relay will energize when a "0" is written to the data line. Figure B and C show mechanical relays controlled by two transistors. The relay in figure B is energized when a "1" is written to the data line and the relay in figure C is energized by writing a "0" to the line. In each of the three circuits, a common connection is made from the negative side of the power supply to one of the port ground pins (18-25).
There are three possible base addresses for the parallel port You may need to try all three base addresses to determine the correct address for the port you are using but LPT1 is usually at Hex 0378. The QBasic "OUT" command can be used to send data to the port. OUT, &H0378,0 sets D0-D7 low and OUT, &H378,255 sets D0-D7 high. The parallel port also provides four control lines (C0,C1,C2,C3) that can be set high or low by writing data to the base address+2 so if the base address is Hex 0378 then the address of the control latch would be Hex 037A. Note that three of the control bits are inverted so writing a "0" to the control latch will set C0,C1,C3 high and C2 low.
Reading Data From The Parallel Port
The diagram below shows 5 switches connected to the 5 input lines of the parallel port. An external 5 volt power supply is used to provide high logic levels to the input pins when the switches are open. Three 1.5 volt batteries in series can be used to obtain 4.5 volts which is close enough. The 330 ohm resistors in series with the port connections provide some protection in case a connection is made to the wrong pin. If you are sure of the connections, the 330 ohm resistors can be left out and the switches connected directly to the input pins. The negative side of the power supply should be connected to the ground point, or any pin from 18 to 25.
-----------------------------------------------------------------------
CLS
DEFINT A-Z
PRINT "Press the enter key to read printer port pins (15,13,12,10,11)"
PRINT "A (0) reading indicates the pin is at ground level, (1) indicates"
PRINT "the pin is at a high level or unterminated."
INPUT A$
V = INP(Address)
PRINT V
P11 = 1
IF V > 127 THEN P11 = 0: V = V - 128
IF V > 63 THEN P10 = 1: V = V - 64
IF V > 31 THEN P12 = 1: V = V - 32
IF V > 15 THEN P13 = 1: V = V - 16
IF V > 7 THEN P15 = 1
PRINT
PRINT "Pin 15 ="; P15
PRINT "Pin 13 ="; P13
PRINT "Pin 12 ="; P12
PRINT "Pin 10 ="; P10
PRINT "Pin 11 ="; P11
END
32 Bit CMOS Serial Receiver
This circuit was designed to control a 32 channel Christmas light
it has been simplified using CMOS circuits to reduce component
few discrete components. The schematic diagram (SERIAL.GIF)
illustrates the circuit with 16 outputs which can be expanded with
additional 8 bit shift registers.
Disclaimer
This circuit requires physical connections be made to the
computer's serial port (COM1 or 2). To the best of my knowledge,
it is difficult to cause damage to yourself or your computer
by improper connections to this port, but there is no guarantee
that damage will not result. Use caution when making any external
electrical connections.
Basic RS232 serial transmission
Serial data is transmitted from the PC as a series of positive and
negative voltages on a single wire which occur at predetermined
times established by the baud rate. Both the transmitter and
receiver must be operating at the same baud rate so that the
receiver knows when to expect the next bit of information. For the
PC serial port, baud rate and bit rate are the same thing, but this
is not necessarily true with modems that can detect more than two
states of the line.
In the quiescent state, with no load on the line, the voltage on
the transmit line (pin 2 of the 25 pin connector) will be about
-12 relative to the signal ground (pin 7), which corresponds to a
logical "1". The output impedance of the serial port is about 1K
ohm which yields about 6 milliamps at 6 volts. A typical data
transmission frame consists of a start bit, 8 data bits, and one
to three stop bits. The start bit which is always positive,
signals the beginning of the transmission and is used by the
receiver to synchronize the clock so that the data bits can be
sampled at the proper times. After the 9th time interval passes
(start bit plus 8 data bits) a dead time occurs which allows the
receiver time to get ready for the next character. This dead time
is referred to as a stop bit, which is always negative or the same
circuitry would require only one.
Transmitted character examples
The letter "A" has a ASCII decimal value of 65. The "1" and "64"
bits are transmitted as a negative voltage (logical "1"), and the
others are transmitted as a positive voltage (logical "0").
64 + 1 = 65 = "A"
+ _____ _____________________________ _____
| | | | | |
| | | | | |
- ----- ----- ----- ---------
Start D0 D1 D2 D3 D4 D5 D6 D7 Stop Stop
Decimal value 1 2 4 8 16 32 64 128
Receiver's
Clock _______ __ __ __ __ __ __ __ ____________
| | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | |
-- -- -- -- -- -- -- --
bits are transmitted as a negative voltage (logical "1"), and the
others are transmitted as a positive voltage (logical "0").
64 + 2 = 66 = "B"
+ ___________ _______________________ _____
| | | | | |
| | | | | |
- ----- ----- ----- ---------
Start D0 D1 D2 D3 D4 D5 D6 D7 Stop Stop
The input terminals (pins 1 and 2) of the optical isolator are
connected through a 1K resistor to the transmit and signal ground
pins of the PC's serial port (pins 2 and 7 of the 25 pin connector).
A small signal diode is connected across the isolator input
terminals to protect the isolator from reverse voltage. In the
idle state, the isolator input voltage will be about -0.7 volts
and the isolator LED and transistor will be off. When a start bit
is received, about 5 milliamps will flow through the isolator LED
causing the isolator transistor to conduct at about 80 microamps
which in turn causes the external switching transistor (Q1) to
turn off. The rising voltage at the collector of Q1 is coupled
through a 510 pF capacitor to produce a narrow positive pulse
which sets the Q output of the first RS data latch (1/2 CD4013)
and enables the dual NAND gate clock oscillator.
The clock oscillator runs at a frequency equal to the baud rate
(9600 Hz) and must maintain a frequency accuracy of less than 5%
over the temperature range. High stability R and C components
are recommended.
The clock output is delayed by one cycle so that the start bit
will not be received as a valid data bit. This is accomplished
by the two remaining NAND gates (1/2 CD4093) and the second RS
data latch (1/2 CD4013). One of these gates is used to invert
the clock phase so that the first clock edge seen by the latch
(clock pin 11) will be going the wrong direction and so ignored.
The remaining gate, which is enabled by the second latch, opens on
the third clock edge, but also inverts the clock phase, and so
supplies a falling clock edge to the counter and shift registers
which is again the wrong direction, and is ignored. The fourth
clock edge will be rising and active and will occur near the
middle (about 52 microseconds) of the first data bit which will be
shifted into the registers. The remaining 7 bits are shifted into
the registers on each successive rising clock edge. Data is
inverted at the register outputs, a logical "1" will correspond to
zero volts, and a logical "0" will correspond to +6 volts.
Transmitting character (255) will set all outputs low, and
transmitting character (0) will set them all high.
The 4017 decade counter increments one count on each rising clock
edge and resets both data latches on the 8th edge. This in turn
stops the clock and resets the counter, and the circuit remains in
a waiting state until the next start bit arrives. Two stop bits of
dead time are required to allow the voltage at the input of the
NAND gate (pin 2) to reach a logic "1" before the next start bit
arrives. Erratic operation may occur when 2 or more characters are
transmitted as a string and only one stop bit is used.
The circuit may be modified to run at different baud rates by
adjusting the clock frequency. This can be accomplished by
temporally connecting pin 6 of the CD4013 to the positive supply
and then selecting R and C values for the desired frequency. You
may need to use a 1% resistor or a couple 5% resistors in series
or parallel to get the value close enough. Or use a variable
resistor in series of about 10% the total value.
At 9600 baud, data output at the shift registers will be unstable
for about a millisecond per word while the incoming data bits
are shifted into the registers and the existing bits are shifted
out (into bit heaven). Higher baud rates will reduce this time
proportionally and the original circuit operates at 57.6K baud
to eliminate a slight flickering of the lights which was noticed
at 9600.
The 74HCT164 shift register outputs will sink or source about
4 milliamps at 6 volts which can be increased with medium power
transistors or FETs to drive relay coils, incandescent lights
and other electronic devices. If relays are used, a small signal
diode will need to be added across the relay coil to suppress
the inductive voltage.
Power supply
It is recommended that 0.1 uF capacitors be installed near the
power pins of each CMOS device and a well regulated/filtered power
supply be used. For test purposes, a 6 volt battery will work
but the clock frequency will change slightly with power supply
voltage variations.
CD4011 Quad NAND gate
14 | Vdd
________|_______
| |
| CD4011 |
| |____ |
1 -----|----| \ |
| | 0 ---|----- 3
2 -----|----|____/ |
| | |
| |
| |____ |
5 -----|----| \ |
| | 0 ---|----- 4
6 -----|----|____/ |
| | |
| |
| |____ |
8 -----|----| \ |
| | 0 ---|----- 10
9 -----|----|____/ |
| | |
| |
| |____ |
12 -----|----| \ |
| | 0 ---|----- 11
13 -----|----|____/ |
| | |
|________________|
|
7 | Vss
14 | Vdd
________|_______
| |
6 -----| Set 1 Q1 |-----1
5 -----| D1 |
3 -----| Clock 1 _ |
4 -----| Reset 1 Q1 |-----2
| |
| CD4013 |
| |
8 -----| Set 2 Q2 |-----13
9 -----| D2 |
11 -----| Clock 2 _ |
10 -----| Reset 2 Q2 |-----12
|________________|
|
7 | Vss
16 | Vdd
________|_______
| |
| CD4017 |
| |
| "0" |----- 3
| "1" |----- 2
| "2" |----- 4
14 -----| Clock "3" |----- 7
| "4" |----- 10
13 -----| Clock "5" |----- 1
| Enable "6" |----- 5
| "7" |----- 6
15 -----| Reset "8" |----- 9
| "9" |----- 11
| Carry out |----- 12
|________________|
|
8 | Vss
14 | Vdd
________|_______
| |
| 74HCT164 |
| |
1 -----| AND Gated Q0 |----- 3
| Serial Q1 |----- 4
2 -----| Inputs Q2 |----- 5
| Q3 |----- 6
| Q4 |----- 10
9 ----0| Reset Q5 |----- 11
| Active Q6 |----- 12
| Low Q7 |----- 13
| |
8 -----| Clock |
|________________|
|
7 | Vss
1 13 1 5
_____________________________ _____________
( . . . . . . . . . . . . . ) ( . . . . . )
\ . . . . . . . . . . . . / \ . . . . /
------------------------- ---------
14 25 6 9
---------------------------------------------------------
Transmit Data O 2 3
Receive Data I 3 2
Request To Send O 4 7
Clear To Send I 5 8
Data Terminal Ready O 20 4
Data Set Ready I 6 6
Ring Indicator I 22 9
Data Carrier Detect I 8 1
Signal ground - 7 5
Power line ground - 1 -
QBasic test program for 8 bit receiver
CLS
DEFINT A-Z
PRINT "Test sequence in progress, press any key to quit."
OPEN "COM1:9600,n,8,2,CD0,CS0,DS0,OP0,RS,TB2048" FOR OUTPUT AS #1
Sequence:
FOR Bit = 0 TO 7
PRINT #1, CHR$(255 - (2 ^ Bit)); ' Set one of 8 outputs high.
SLEEP 1 ' Wait 1 sec between characters.
IF INKEY$ <> "" THEN CLOSE : SYSTEM
NEXT Bit
GOTO Sequence
END
PC Serial Receiver (57.6K Baud / TTL & CMOS)
AT89C4051 Digital Real Time Clock Circuit
When the power supply is switched on it will give you the default date and time, but later you can change it to the desired value.
The source code for the project is written in C-language, and compiled using Keil C compiler, you can download the c-code, schematic, and if you don't have a cross compiler then you can directly burn the HEX file on to your chip,clock.zip.
Source: www.kmitl.ac.th
Digital Remote Thermometer Circuit With Receiver and Transmitter
This circuit is intended for precision centigrade temperature measurement, with a transmitter section converting to frequency the sensor's output voltage, which is proportional to the measured temperature. The output frequency bursts are conveyed into the mains supply cables. The receiver section counts the bursts coming from mains supply and shows the counting on three 7-segment LED displays. The least significant digit displays tenths of degree and then a 00.0 to 99.9 °C range is obtained. Transmitter-receiver distance can reach hundred meters, provided both units are connected to the mains supply within the control of the same light-meter.
Transmitter circuit operation:
IC1 is a precision centigrade temperature sensor with a linear output of 10mV/°C driving IC2, a voltage-frequency converter. At its output pin (3), an input of 10mV is converted to 100Hz frequency pulses. Thus, for example, a temperature of 20°C is converted by IC1 to 200mV and then by IC2 to 2KHz. Q1 is the driver of the power output transistor Q2, coupled to the mains supply by L1 and C7, C8.
Circuit diagram:
R1 = 100K 1/4W Resistors
R2 = 47R 1/4W Resistor
R3 = 100K 1/4W Resistors
R4 = 5K 1/2W Trimmer Cermet
R5 = 12K 1/4W Resistor
R6 = 10K 1/4W Resistor
R7 = 6K8 1/4W Resistor
R8 = 1K 1/4W Resistors
R9 = 1K 1/4W Resistors
C1 = 220nF 63V Polyester Capacitor
C2 = 10nF 63V Polyester Capacitor
C3 = 1µF 63V Polyester Capacitor
C4 = 1nF 63V Polyester Capacitors
C5 = 2n2 63V Polyester Capacitor
C6 = 1nF 63V Polyester Capacitors
C7 = 47nF 400V Polyester Capacitors
C8 = 47nF 400V Polyester Capacitors
C9 = 1000µF 25V Electrolytic Capacitor
D1 = 1N4148 75V 150mA Diode
D2 = 1N4002 100V 1A Diodes
D3 = 1N4002 100V 1A Diodes
D4 = 5mm. Red LED
IC1 = LM35 Linear temperature sensor IC
IC2 = LM331 Voltage-frequency converter IC
IC3 = 78L06 6V 100mA Voltage regulator IC
Q1 = BC238 25V 100mA NPN Transistor
Q2 = BD139 80V 1.5A NPN Transistor
T1 = 220V Primary, 12+12V Secondary 3VA Mains transformer
PL = Male Mains plug & cable
L1 = Primary (Connected to Q2 Collector): 100 turns
Secondary: 10 turns
Wire diameter: O.2mm. enameled
Plastic former with ferrite core. Outer diameter: 4mm.
Receiver circuit operation:
The frequency pulses coming from mains supply and safely insulated by C1, C2 & L1 are amplified by Q1; diodes D1 and D2 limiting peaks at its input. Pulses are filtered by C5, squared by IC1B, divided by 10 in IC2B and sent for the final count to the clock input of IC5. IC4 is the time-base generator: it provides reset pulses for IC1B and IC5 and enables latches and gate-time of IC5 at 1Hz frequency. It is driven by a 5Hz square wave obtained from 50Hz mains frequency picked-up from T1 secondary, squared by IC1C and divided by 10 in IC2A. IC5 drives the displays' cathodes via Q2, Q3 & Q4 at a multiplexing rate frequency fixed by C7. It drives also the 3 displays' paralleled anodes via the BCD-to-7 segment decoder IC6. Summing up, input pulses from mains supply at, say, 2KHz frequency, are divided by 10 and displayed as 20.0°C.
Circuit diagram:
R1 = 100K 1/4W Resistor
R2 = 1K 1/4W Resistor
R3 = 12K 1/4W Resistors
R4 = 12K 1/4W Resistors
R5 = 47K 1/4W Resistor
R6 = 12K 1/4W Resistors
R8 = 12K 1/4W Resistors
R9-R15=470R 1/4W Resistors
R16 = 680R 1/4W Resistor
C1 = 47nF 400V Polyester Capacitors
C2 = 47nF 400V Polyester Capacitors
C3 = 1nF 63V Polyester Capacitors
C4 = 10nF 63V Polyester Capacitor
C7 = 1nF 63V Polyester Capacitors
C5 = 220nF 63V Polyester Capacitors
C6 = 220nF 63V Polyester Capacitors
C8 = 1000µF 25V Electrolytic Capacitor
C9 = 100pF 63V Ceramic Capacitor
C10 = 220nF 63V Polyester Capacitors
D1 = 1N4148 75V 150mA Diodes
D2 = 1N4148 75V 150mA Diodes
D3 = 1N4002 100V 1A Diodes
D4 = 1N4002 100V 1A Diodes
D5 = 1N4148 75V 150mA Diodes
D6 = Common-cathode 7-segment LED mini-displays
D7 = Common-cathode 7-segment LED mini-displays
D8 = Common-cathode 7-segment LED mini-displays
IC1 = 4093 Quad 2 input Schmitt NAND Gate IC
IC2 = 4518 Dual BCD Up-Counter IC
IC3 = 78L12 12V 100mA Voltage regulator IC
IC4 = 4017 Decade Counter with 10 decoded outputs IC
IC5 = 4553 Three-digit BCD Counter IC
IC6 = 4511 BCD-to-7-Segment Latch/Decoder/Driver IC
Q1 = BC239C 25V 100mA NPN Transistor
Q2 = BC327 45V 800mA PNP Transistors
Q3 = BC327 45V 800mA PNP Transistors
Q4 = BC327 45V 800mA PNP Transistors
PL = Male Mains plug & cable
T1 = 220V Primary, 12+12V Secondary 3VA Mains transformer
L1 = Primary (Connected to C1 & C2): 10 turns
Secondary: 100 turns
Wire diameter: O.2mm. enameled
Plastic former with ferrite core. Outer diameter: 4mm.
Notes:
- D6 is the Most Significant Digit and D8 is the Least Significant Digit.
- R16 is connected to the Dot anode of D7 to illuminate permanently the decimal point.
- Set the ferrite cores of both inductors for maximum output (best measured with an oscilloscope, but not critical).
- Set trimmer R4 in the transmitter to obtain a frequency of 5KHz at pin 3 of IC2 with an input of 0.5Vcc at pin 7 (a digital frequency meter is required).
- More simple setup: place a thermometer close to IC1 sensor, then set R4 to obtain the same reading of the thermometer in the receiver's display.
- Keep the sensor (IC1) well away from heating sources (e.g. Mains Transformer T1).
- Linearity is very good.
- Warning! Both circuits are connected to 230Vac mains, then some parts in the circuit boards are subjected to lethal potential! Avoid touching the circuits when plugged and enclose them in plastic boxes.