Adding Power Button and Real Time Clock to Falcon Player - Raspberry Pi 4

by atairu in Circuits > Raspberry Pi

664 Views, 2 Favorites, 0 Comments

Adding Power Button and Real Time Clock to Falcon Player - Raspberry Pi 4

20230701_153637.jpg

Raspberry Pi is used to control most Falcon Player used to control Christmas light shows all over the world, however Raspberry Pi does not come with dedicated switch to gracefully shutdown the device. Users have to go into the Falcon Player to gracefully shutdown the device or simply unplugging it from power supply. There are risks in simply unplugging the device from power supply which includes potential file corruption among others. Also, Raspberry Pi (at least up until the last major version which is Pi 4) do not come with a real time clock. For those that wants to operate their Falcon Player on a network that does not have internet will face challenges maintaining scheduling light shows because once Pi loses power, time will reset back to time period in the past.

This project tackle both issues highlighted above by designing a Pi Hat with power switch, power indicator, real time clock and battery holder that maintains time even when power is lost. The power switch and power indicator idea was borrowed from the project authored by a guy simply named John and the project can be found using this link. The KiCAD schematic diagram file that can be used to make the PCB is attached that can be used by any DIY person that is able to do so. There are plans to organize a group buy for those interested in the PCB and this will be announced on Do It Yourself Christmas forum

Note that this board and instructions are for Raspberry Pi 4 ONLY. The author designed and tested the board only with Pi 4 and it is recommended to only use Pi 4 board. Chances are that this Pi-hat will work with some older versions of Pi however there may be inconsistent results. Pi zero is rather smaller and the Pi-hat may not seat properly on Pi zero.

Supplies

1-RaspberryPi-4.jpg
2-Power-RTC-Pi-Hat.jpg
3-DS3231SN-RTC-IC.jpg
4-CR1220-Holder.jpg
5-CR1220-CoinCell.jpg
7-PinPH2.54Conector.jpg
6-2-PinPH2.00Conector.jpg
8-PluggableScrew.jpg
9-40-PinFemaleHeader.jpg
10-10Kohm-Resistor.jpg
12-0.1uFCap.jpg
11-10uFCap.jpg
  1. Raspberry Pi version 4 with latest Falcon Player installed and fully configured
  2. Power & RTC Pi Hat board (1)
  3. DS3231SN 16-SOIC RTC Integrated Circuit (1)
  4. CR1220 Coin battery holder (1)
  5. CR1220 Coin battery (1)
  6. Male & female 2-pin XH2.54mm pitch JST connector - standard size (1)
  7. Male & female 2- pin PH2.00mm pitch JST connector - mini size (1)
  8. Male & female 2- pin 5.08mm pitch pluggable screw terminal block (1)
  9. 2x20 40-Pin Female Pin Header Socket Connector
  10. 10Kohm 0805 SMD resistor (2)
  11. 10 uF 0805 SMD ceramic capacitor
  12. 0.1 uF 0805 SMD ceramic capacitor
  13. 12mm Momentary push button with LED (5-12v)
  14. 10mm M3 plastic female standoff (4)
  15. 6mm M3 plastic screw (4)
  16. 1.6mm diameter heat shrink
  17. Soldering iron
  18. Solder flux
  19. Solder lead
  20. Hot air gun

Populate Power & RTC Pi-Hat Board

2-Power-RTC-Pi-Hat.jpg
3-DS3231SN-RTC-IC.jpg
4-CR1220-Holder.jpg
5-CR1220-CoinCell.jpg
8-PluggableScrew.jpg
9-40-PinFemaleHeader.jpg
10-10Kohm-Resistor.jpg
11-10uFCap.jpg
12-0.1uFCap.jpg

This step is for those that prefer to manufacture the Pi-Hat board themselves using the attached KiCAD schematic diagram file. The board is a two layer PCB and uses mostly SMD components. Populate the board and solder the listed components as labelled on the PCB. Use either a hot plate or reflow oven to solder the SMD components first. Then use soldering iron to attach battery holder, and all the two pin terminal blocks. Note that the 2-pin PH2.0mm JST (mini size) must be soldered to the Power indicator while the 2-pin XH2.54mm JST must be soldered to the Power switch label point.

The 40-pin female header must be soldered to the 40-holes closer to the edge of the board. Do not solder it to the other 40-holes as those are reserved to those that want to connect other Pi-hats. Make sure there are no shorts by testing continuity with a multimeter

Attach a CR1220 coin cell battery to the holder to finish the building of the board

Connect Power Switch and Power Indicator to Momentary Switch

6-2-PinPH2.00Conector.jpg
7-PinPH2.54Conector.jpg
13-12mmMomentrySwitch.jpg

The steps below applies to those that just completed making the board and those that ordered completed board

NOTE: If you ordered completed board, your package will come with all the components pre-soldered and 2-pin XH2.4 (standard size) and PH2.0 JST (mini size) connector and momentary switch with LED

Attach 2-pin PH2.0mm JST to the Momentary Switch

  1. Cut and insert heat shrink to the red and black wires on the momentary switch
  2. Solder red wire on the momentary switch to red wire on the 2-pin female PH2.0mm JST connector, push the heat shrink to cover the joint and apply heat using hot air gun until it the heat shrink is firmly attached to the joint
  3. Solder black wire on the momentary switch to black wire on the 2-pin female PH2.0mm JST connector, push the heat shrink to cover the joint and apply heat using hot air gun until it the heat shrink is firmly attached to the joint
  4. Push the female PH2.0mm JST connector to the male on the board labelled "Power Indicator"
  5. Cut and insert heat shrink to two other similar colored wires on the momentary switch
  6. Solder one of the similar colored wire on momentary switch to the red wire on the 2-pin female XH2.54mm JST connector, push the heat shrink to cover the joint and apply heat using hot air gun until it the heat shrink is firmly attached to the joint
  7. Solder the other similar colored wire on momentary switch to the black wire on the 2-pin female XH2.54mm JST connector, push the heat shrink to cover the joint and apply heat using hot air gun until it the heat shrink is firmly attached to the joint
  8. Push the female XH2.54mm JST connector to the male on the board labelled "Power Switch"


Attach Power & RTC Pi-Hat to Raspberry Pi

NOTE

Raspberry can be powered using traditional method by using the USB-C power in on the pi, or you can use the 2- pin 5.08mm pitch pluggable screw terminal block

If you plan to power your raspberry pi using the supplied 5.08mm pluggable terminal block, please be reminded that of the following

  1. YOU CAN ONLY USE 5V SWITCHING POWER SUPPLY. USE OF ANY VOLTAGES OTHER THAN 5V WILL DESTROY YOUR RASPBERRY PI
  2. OBSERVE CORRECT POLARITY. NEGATIVE IS ON THE LEFT, POSITIVE IS ON THE RIGHT WHEN THE PLUGGABLE SCREW IS USED
  3. AUTHOR IS NOT RESPONSIBLE FOR ANY LOSS OF YOUR DEVICE


Attach and power up Raspberry Pi

  1. Attach the Pi-Hat to your raspberry Pi
  2. Connect the female 5.08mm pluggable screw to a 5v switching power supply (Do not plug to the wall yet). Ensure that the negative end of the power supply is attached to the left side of the pluggable screw and positive is attached to the right side
  3. Attach the female 5.08mm pluggable screw to the male on the Pi-Hat. Confirm that the negative is on the left side while positive is on the right side
  4. Connect any other devices you typically connect to your pi such as network cable, audio card, keyboard and so on
  5. Plug the switching 5v power supply to the wall
  6. Turn on the power on switching power supply to turn on the raspberry pi

When USB-C is used to power raspberry pi, connect power supply to the USB-C as you normally do and power up Pi with the Pi-hat attached

Confirm that Pi is powered and you are able to login to Falcon Player, the LED on the momentary switch should also be turned on

Install Pi Power Button Switch and Configure RTC

  • Download Pi Power Button Switch Script and move it to Upload folder in Falcon Player


  1. From any computer connected to the internet, click this link to get to the git hub website where the script can be downloaded
  2. Look for the green button with <> Code click the download the zip, to save the zip file into a location on your computer
  3. Launch Falcon Player on Raspberry Pi
  4. If UI login is enabled, login with correct credentials
  5. Navigate to Content Setup -> File Manager
  6. Click Uploads button
  7. Click Select Files button and browse to the location where the downloaded zip file is stored
  8. Confirm that the zip file is uploaded, validate the the file pi-power-button-master.zip is out there
  9. Navigate to Help -> >_SSH Shell to open shell command line interface
  10. Supply correct login ID and password


  • Install Pi Power Button Switch Script


  1. Navigate to Help -> >_SSH Shell to open shell command line interface
  2. Supply correct login ID and password
  3. Type the following commands one line after another install the script. Remember to push enter after you finish typing each line

cd/home/fpp/media/upload

unzip pi-power-button-master.zip -d ../..

cd ../../pi-power-button-master/script

sudo ./install

NOTE: Push enter line again to get back to command line prompt when you see last line with text like the one in quote. "GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)"


  • Configure Real Time Clock


  1. Type the following commands one line after another to configure real time clock. Remember to push enter after you finish typing each line

sudo nano /boot/config.txt

NOTE: Scroll to the last line on the text file by pushing arrow down button or Page Down on your keyboard, then type the following commands one line after another and push enter after each line

dtoverlay=gpio-shutdown

dtparam=i2c_vc=on

dtoverlay=i2c-rtc,ds1307,wakeup-source,i2c0

NOTE: Push and hold down Control button on keyboard and push letter "o" (CTRL + o) to get prompt to save the file. Push enter to save

NOTE: Push and hold down Control button on keyboard and push letter "x" (CTRL + x) to exit the file and betaken to command line


  • Reboot Falcon Player


  1. Type the command below to reboot Falcon Player. Remember to push enter after you finish typing line

sudo shutdown -r now

NOTE: The command line page will show that it is closed, you can close the page on the browser.


  • Validate Power Button Work


  1. After Falcon Player is back up and running, push the button on the momentary switch
  2. Falcon Player should shutdown and the LED light should be off
  3. Push the momentary button again
  4. Falcon player should come back up and the LED light should stay on


  • Configure Real Time Clock


  1. Once the power button is confirmed working, validate that Falcon Player is up and running
  2. Go to Status Control -> FPP Settings -> Time
  3. Click the drop down on the Real Time Clock and select DS1305 / DS1307 DS3231 (PiCap)
  4. Falcon Player will prompt to reboot. Accept OK to reboot
  5. Once Falcon Player is back up and running
  6. Go to Status Control -> FPP Settings -> Time
  7. Select correct option on the Time Zone field for your area
  8. Set the correct Date by clicking on the Set Date field, use the calendar to set correct date
  9. Set the correct time by clicking on the Set Time field, use the drop down to set correct time


  • Validate Real Time Clock Work


  1. Confirm that Falcon player is up and running after the last step was carried out
  2. Confirm that the correct date and time is getting displayed by going to Status Control -> Status Page
  3. Check the date and time on the top right corner
  4. Shutdown Falcon Player either by pushing the power button or pushing the Shutdown button at the bottom of the Falcon Player page
  5. Disconnect power completely by removing power supply from the wall for about 1 minute
  6. Connect power back to Falcon Player to start it back up
  7. Confirm that Falcon Player is up and running
  8. Validate that Falcon Player is displaying correct date and time by going to Status Control -> Status Page and checking the top right corner where data and time is displayed