background image

! ! ! ! ! ! ! ! ! ! !

!

!

Copyright!©!2016!UUGear!s.r.o.! ! All!rights!reserved.!

!

!

Witty Pi 

Realtime Clock and Power Management for Raspberry Pi 

User Manual 

!

!

Summary of Contents for Witty Pi

Page 1: ... Copyright 2016 UUGear s r o All rights reserved Witty Pi Realtime Clock and Power Management for Raspberry Pi User Manual ...

Page 2: ...n 4 Mounting Witty Pi on Raspberry Pi 6 Software Usage 8 Making Schedule Script 13 Hardware Configuration 16 Software Customization 17 Witty Pi Log Files 18 Witty Pi gets Dead Locked 18 Witty Pi Immediately Shutdown after Startup 19 What I2C Address is Used by Witty Pi 21 What GPIO Pins are Used by Witty Pi 22 Is Witty Pi Compatible with Other Hardware 23 ...

Page 3: ...herals get fully power cut after shutdown Raspberry Pi knows the correct time even without accessing the Internet You can schedule the startup shutdown of your Raspberry Pi You can even write a script to define complex ON OFF sequence Witty Pi supports Raspberry Pi model A B and Raspberry 2 The picture below shows how is Witty Pi look like 1 DC 5V power in 2 Alternative DC 5V power in 3 On off swi...

Page 4: ... 2 What is in the Package Each Witty Pi package contains Witty Pi board x 1 CR2032 battery x 1 M2 5 x 11mm Copper Standoff x 4 M2 5 screws x 8 ...

Page 5: ... command is received or fade in and out slowly breathing when Witty Pi is standing by Connector 40cpin dual row 2 54 mm pitch female male header Battery CR2032 or CR2025 for time keeping Power In DC 5V via micro USB port or white power jack Output Current Maximum 2A for Raspberry Pi and its peripherals Static Current 10mA Operating Temperature 0 50 Storage Temperature c20 60 Humidity 0 80 RH no co...

Page 6: ...e script from our website and you will then see the installWittyPi sh script in your home directory Then you just need to run it with sudo Please notice that sudo is necessary to run this script This script will automatically do these tasks in order 1 Enable I2C on your Raspberry Pi 2 Install i2cctools if it is not installed yet 3 Configure Bluetooth to use minicUART Raspberry Pi 3 only 4 Install ...

Page 7: ...u wish the syncTime sh script run as early as possible you can edit the etc init d wittypi file line 22 sudo home pi wittyPi syncTime sh 60 The number 60 means running the script 60 seconds after the startup you can set it to 0 to trigger an immediate run after the boot The wittyPi sh is the software that allows you to configure your Witty Pi interactively You can use it to copy time between Realt...

Page 8: ...d it can work just like that However if you wish you can use the copper standoffs and screws in the package to tightly mount Witty Pi on your Raspberry Pi First you can mount the 4 copper standoffs on your Raspberry Pi using the screws Your Raspberry Pi should look like this after mounting the 4 standoffs ...

Page 9: ... put the button battery into the battery holder with the battery Witty Pi can remember the time even after you cut its power After mounting Witty Pi on your Raspberry Pi and plug the power supply to the micro USB port on Witty Pi you can see the white LED fading in and out slowly which means it is standing by Now your Witty Pi is ready to go ...

Page 10: ...ur Raspberry Pi system to the Realtime clock on Witty Pi This option should be used when you find the system time is correct may get pi raspberrypi wittyPi sudo wittyPi sh pi raspberrypi wittyPi sudo wittyPi sh Witty Pi Realtime Clock Power Management for Raspberry Pi Version 2 16 by UUGear s r o Your system time is Sun 01 Nov 2015 16 51 29 CET Your RTC time is Sun 01 Nov 2015 16 51 29 CET Now you...

Page 11: ...nputting the time This gives you the possibility to make a repeatable schedule Please see the table below Here are some examples 15 07 30 00 means 7 30 in the morning on 15th in this month 23 30 00 means 23 30 00 at night everyday daily schedule 15 00 means the 15th minute every hour hourly schedule 05 means the 5th second every minute minutely schedule Please be informed that not all patterns wit...

Page 12: ...means the 15th minute every hour hourly schedule 5 Choose Schedule Script This cool feature brings so many new possibilities to use Witty Pi The RTC chip on Witty Pi only has two alarms and we use one for auto startup and the other for auto shutdown Manually setting the auto shutdown and startup alarm might be enough for the major of use cases but sometimes you may want a more complex schedule For...

Page 13: ...r the example above with state chart From the file name you can know what the script will do For example pi raspberrypi wittyPi sudo wittyPi sh Witty Pi Realtime Clock Power Management for Raspberry Pi Version 2 16 by UUGear s r o Your system time is Sun 01 Nov 2015 16 51 29 CET Your RTC time is Sun 01 Nov 2015 16 51 29 CET Now you can 1 Write system time to RTC 2 Write RTC time to system 3 Set ti...

Page 14: ...by the script you can check the schedule log file in the wittyPi directory when your Raspberry Pi is on You can create your own schedule script too If you are interested please read the Making Schedule Script chapter 6 Reset Data If you want to erase the data you already set into Witty Pi autocstartup time autocshutdown time currently used schedule script you can choose this option Once you select...

Page 15: ... the time range defined by the schedule script the incoming shutdown and next startup will be scheduled pi raspberrypi wittyPi sudo wittyPi sh Witty Pi Realtime Clock Power Management for Raspberry A B and 2 Version 2 16 by UUGear s r o Your system time is Sun 01 Nov 2015 16 51 29 CET Your RTC time is Sun 01 Nov 2015 16 51 29 CET Now you can 1 Write system time to RTC 2 Write RTC time to system 3 ...

Page 16: ... HH MM SS You can use one or more white characters space or tab between BEGIN END and the time string The rest of the script defines the states in the loop It could be ON or OFF and you should define at least one ON and one OFF states in the loop Usually the ON and OFF states are used in pair You should also specify the duration of each state You can do so by putting one or Turn on Raspberry Pi fo...

Page 17: ...ecuted an incoming startup will be scheduled at the end of the OFF state There are some schedule scripts in the schedules directory and they all have comments inside to explain themselves You can take them as example to learn how to create the Witty Pi schedule script Advanced Usage Although the schedule script can be chosen by wittyPi sh you can use it without the help from wittyPi sh Just copy t...

Page 18: ...fy which GPIO pin is used to drive the LED indicator GPIOc17 is used by default and you can change it to any GPIO pin you want Just put the jumper cap on the right side and wire the left pin of the jumper to the target GPIO pin The green jumper is to configure which GPIO pin will be used to shutdown your Raspberry Pi GPIOc4 is used by default Please notice that not every GPIO pin could be used for...

Page 19: ...alarms to schedule the Pi s startup shutdown We will keep writing tutorials for this part and update the examples in this manual Meanwhile you could also checkout the datasheet for DS1337 chip and its ALARMS section has the information that needed for programming the alarms There is another choice which we think is even better That is to use the schedule script as an interfacing language You don t...

Page 20: ...ply connected to Witty Pi and pressing the button on Witty Pi could not startup your Raspberry Pi you may or may not see your Raspberry Pi get powered for 1 2 seconds only then your Witty Pi gets dead locked If you are using Raspberry Pi 3 this problem most probably comes from the Bluetooth which is newly on board since Pi3 In the newly released firmware GP14 and GP15 pins are mapped to UART1 sinc...

Page 21: ...n h now command by yourself and not to unplug disconnect the power supply for Witty Pi before finishing the gracefully shutdown process This can avoid the first scenario mentioned above If you use schedule script or manually schedule a shutdown in very short future it is better to let Witty Pi to shutdown your Raspberry Pi otherwise it will become the second scenario that causes the dead lock when...

Page 22: ...nce the GPIOc4 listener is started any action that pulls down GPIOc4 will be regarded as a shutdown command So if GPIOc4 pin doesn t really get stable after the given 10 seconds Witty Pi will take it as a shutdown command lights up the white LED and then shutdown the system There are many factors that might cause the GPIO pin unstable and the most common one is the power supply If your power suppl...

Page 23: ...you have Witty Pi connected to Raspberry Pi and run sudo i2cdetect cy 1 in the console you will see this This address is fixed and you can never change it If you want to use other I2 C devices on your Raspberry Pi please make sure they have different I2 C addresses pi raspberrypi sudo i2cdetect y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00 10 20 30 40 50 60 68 70 pi raspberrypi ...

Page 24: ...ame wiring Pi wPi GPIO BCM 3 3V 1 2 5V 2 8 SDA 1 3 4 5V 3 9 SCL 1 5 6 GND 4 7 GPIO 7 7 8 TXD 15 14 GND 9 10 RXD 16 15 17 0 GPIO 0 11 12 GPIO 1 1 18 27 2 GPIO 2 13 14 GND 22 3 GPIO 3 15 16 GPIO 4 4 23 3 3V 17 18 GPIO 5 5 24 10 12 MOSI 19 20 GND 9 13 MISO 21 22 GPIO 6 6 25 11 14 SCLK 23 24 CE0 10 8 GND 25 26 CE1 11 7 0 30 SDA 0 27 28 SCL 0 31 1 5 21 GPIO 21 29 30 GND 6 22 GPIO 22 31 32 GPIO 26 26 12...

Page 25: ...hardware you have on hand and even if we have it is difficult for us to make tests on all these hardware with Witty Pi Fortunately it is not that difficult to figure out the answer by yourself Basically you just need to consider the I2 C address and GPIO pins used by the Other Hardware If the Other Hardware uses 0x68 I2 C address it will be a confliction with Witty Pi s RTC chip and you can not us...

Reviews: