PI-Clock with a shift register.

Tutorial Pi-Clock

What you need:

Connect the Parts

Shift Register

Connect a wire from CE0(pin 24) to pin 12 of the shift register.
Connect a wire from CE1(pin 26) to pin 14 of the shift register.
Connect a wire from CLK(pin 23) to pin 11 of the shift register.
Connect pin 16(Vcc) of the shift register to 5V
Connect pin 8(GND) of the shift register to ground
Connect pin 10(Master reset) of the shift register to 5V
Connect pin 13(Output enable) of the shift register to ground
image

Resistors

Connect to every output of the shift register a 220Ω resistor, pin 1(Q1) up to pin 7(Q7)
image

Display’s

image
Connect the resistor of pin 1(Q1) to the a-pin(4th pin on top of the 7 segment display.)
Connect the resistor of pin 2(Q2) to the b-pin(5th pin on top of the 7 segment display.)
Connect the resistor of pin 3(Q3) to the c-pin (4th pin on the bottom of the 7 segment display.)
Connect the resistor of pin 4(Q4) to the d-pin (2nd pin on the bottom of the 7 segment display.)
Connect the resistor of pin 5(Q5) to the e-pin (1st pin on the bottom of the 7 segment display.)
Connect the resistor of pin 6(Q6) to the f-pin (2nd pin on top of the 7 segment display.)
Connect the resistor of pin 7(Q7) to the g-pin (1st pin on top of the 7 segment display.)
Connect the wires to every(4) display.

Transistor’s

Connect to one of every display a transistor.
Connect the emitter(pin by the jut) to ground.
Connect the base(middle pin) to 4.7kΩ resistor.
Connect the collector to a ground pin of a shift register(one transistor per display)
Connect to the 1st(left to right) resistor a wire to GPIO#18(pin 12)
Connect to the 2nd(left to right) resistor a wire to GPIO#22(pin 15)
Connect to the 3rd(left to right) resistor a wire to GPIO#21(v1) GPIO#27(v2)(pin 13)
Connect to the 4th(left to right) resistor a wire to GPIO#17(pin 11)
image

Button

To stop the clock without using a screen or terminal we use a pushbutton
Connect a wire from GPIO#23(pin 16) to a 1kΩ resistor
Connect that resitor to a pushbutton.
Connect to the same pin of that pushbutton a 10kΩ resistor(pullup resistor)
Connect that resistor to a 3v3 pin on the raspberrry.
Connect another pin of the pushbutton to ground, check first if it doesn’t connect to the “resistorpin”
Done connecting the parts
With all the wires and components you will get:
image

Software

Get the code from HERE.
Copy the code to /home/pi(default save location)
and save it al clock.py
Now set the code to start on boot-up.
Typ in the terminal:
sudo crontab -e
Than you have to go to the end of the file and typ:
@reboot sudo python /home/pi/clock.py &
then press CTRL+X, Yes and Enter.
Than you are back in the terminal, you typ:
sudo reboot
than is your pi-clock going to restart and showing the time.
NOTE:
The raspberry pi has to be online.
When you press the button when it is showing the time the clock stops, so you can use all the CPU.
When you press the button 4 seconds or longer the raspberry pi is going to shutdown.
Get the .fzz(fritzing) files from here.

comments powered by Disqus