UUGear Witty Pi 3 Manuel utilisateur

Copyright © 2019 UUGear s.r.o. All rights reserved.
Witty Pi 3
Realtime Clock and Power Management for Raspberry Pi
User Manual (revision 1.03)

Copyright © 2019 UUGear s.r.o. All rights reserved.
Table of Content
What is Witty Pi?................................................................................ 1
What is in the Package? ...................................................................... 3
Witty Pi 3 Specifications..................................................................... 4
Software Installation ........................................................................... 5
Software Update/Uninstallation.......................................................... 7
Mounting Witty Pi 3 on Raspberry Pi................................................. 8
Input Voltage..................................................................................... 10
Software Usage ................................................................................. 11
1. Write system time to RTC ...........................................................................................12
2. Write RTC time to system ...........................................................................................12
3. Synchronize time .........................................................................................................12
4. Schedule next shutdown ..............................................................................................13
5. Schedule next startup...................................................................................................13
6. Choose Schedule Script ...............................................................................................14
7. Set low voltage threshold.............................................................................................15
8. Set recovery voltage threshold.....................................................................................15
9. View/change other settings..........................................................................................16
10. Reset Data… ............................................................................................................17
11. Exit...........................................................................................................................17
How Schedule Script Works?........................................................... 18
Make Schedule Script ....................................................................... 20

Copyright © 2019 UUGear s.r.o. All rights reserved.
Using Schedule Script Generator...................................................... 22
Advanced Usage of Schedule Script................................................. 23
The Unpopulated 3-Pin Header (P2)................................................. 24
The Unpopulated 7-Pin Header (P3)................................................. 24
Frequently Asked Questions (FAQ) ................................................. 27
What I2C Address is Used by Witty Pi 3?...........................................................................27
What I2C Registers Are Provided by Witty Pi 3?................................................................28
What GPIO Pins Are Used by Witty Pi 3?..........................................................................31
Is Witty Pi 3 Compatible with “Other Hardware”? .............................................................32
Witty Pi 3 does not boot?.....................................................................................................32
Revision History................................................................................ 35

1
What is Witty Pi?
Witty Pi is small electronic circuit board that can add realtime clock and power management to your
Raspberry Pi. Witty Pi 3 is the third generation of Witty Pi. After installing Witty Pi 3 on your
Raspberry Pi, you get some amazing new features:
You can power your Raspberry Pi with higher voltage.
You can gracefully turn on/off Raspberry Pi with single tap on the switch.
After shutdown, Raspberry Pi and all its USB peripherals’ power are fully cut.
Raspberry Pi knows the correct time, even without accessing the Internet.
Raspberry Pi knows the temperature thanks to the sensor in RTC chip.
You can schedule the startup/shutdown of your Raspberry Pi.
You can even write a script to define complex ON/OFF sequence.
Shutdown Raspberry Pi when input voltage is lower than pre-set value.
Turn on Raspberry Pi when input voltage raise to pre-set value.
When the OS loses response, you can long hold the switch to force power cut.
Witty Pi 3 supports all Raspberry Pi models that has the 40-pin GPIO header, including A+, B+, 2B,
Zero, Zero W, 3B, 3B+, 3A+ and 4B.
Comparing to Witty Pi 2, Witty Pi 3 uses the same RTC chip (DS3231SN) and introduces a new
micro-controller (ATtiny841), which allows it to behave smarter and handle more complex

2
situations. Thanks to the new on-board LDO voltage regulator (LM29150), Witty Pi 3 can accept DC
voltage higher than 5V (up to 26V, depends on the load and heat sink).
Witty Pi 3 doesn't have any jumper, and all configurations are done via I2C interface. Witty Pi's
software can help you to make configuration very quickly.
The picture below shows how is Witty Pi 3 look like:
1) Micro USB connector as DC 5V power input
2) XH2.54 connector as higher voltage DC power input
3) Unpopulated 3-pin header/connector for VIN, GND and 5V
4) White LED as indicator
5) On/off switch
6) 2x20 pin stacking header (connects to Raspberry Pi)
7) Unpopulated 2x3 pin ICSP header for uploading firmware
8) Battery holder for CR2032 button cell lithium battery
9) Unpopulated 7-pin header for extension or integration

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

4
Witty Pi 3 Specifications
Dimension:
65mm x 56mm x 19mm
Weight
20g (net weight without battery)
Micro Controller
ATtiny841(datasheet)
Realtime Clock
DS3231SN (datasheet)
LDO Voltage Regulator
LM29150 (datasheet)
Battery
CR2032 (for time keeping)
Power In
DC 5V (via micro USB) or DC5.3V~26V (via
XH2.54 connector, better no higher than 8V without
additional heat sink)
Output Current
Up to 3A for Raspberry Pi and its peripherals if input
via micro USB port. Up to 2A if input via XH2.54
connector.
Standby Current
~ 1mA
Operating Temperature
-30℃~80℃(-22F~176F)
Storage Temperature
-40℃~85℃(-40F~185F)
Humidity
0~80%RH, no condensing

5
Software Installation
It is recommended to install the software for Witty Pi 3 before physically mount Witty Pi 3 on your
Raspberry Pi.
Before installing the software, please check whether you have 1-Wire interface enabled. This is
important because 1-Wire interface uses GPIO-4 by default, which will conflict with Witty Pi. If you
need to use 1-Wire interface, please assign it to a different GPIO pin.
You can assign different GPIO pin to 1-Wire interface in /boot/config.txt file, find the
“dtoverlay=w1-gpio” text and replace it with:
dtoverlay=w1-gpio,gpiopin=18
If you don’t need 1-Wire interface for now, you can disable it:
#dtoverlay=w1-gpio
If you have 1-Wire interface enabled on GPIO-4 and installed Witty Pi’s software, you may not be
able to login to your Raspberry Pi because it always shuts itself down before you get the chance to
login. To solve this problem, you will need to take out the micro-SD card on your Raspberry Pi, and
access its file system via a card reader. You need to edit the config.txt file (as mentioned above) in the
"boot" volume to change the GPIO pin used by 1-Wire interface, or you can disable 1-Wire interface if
you don't need it for now. After saving the file and put the micro SD card back to Raspberry Pi, you
should be able to boot it again.
In order to install the software, you will need to have your Raspberry Pi connected to the Internet.
The installation will be very simple if you run our installing script.
First step is to run this command in your home directory:
If your Raspberry Pi has internet connection, it will immediately download the script from our
website, and you will then see the “install.sh”script in your home directory. Then you just need to
run it with sudo as follows:
Please notice that sudo is necessary to run this script. This script will automatically do these tasks
in sequence:
1. Enable I2C on your Raspberry Pi
2. Install i2c-tools, if it is not installed yet
pi@raspberrypi ~ $ wget http://www.uugear.com/repo/WittyPi3/install.sh
pi@raspberrypi ~ $ sudo sh install.sh

6
3. Configure Bluetooth to use mini-UART (Raspberry Pi 3 only)
4. Install wiringPi, if it is not installed yet (Raspberry Pi 4 needs version 2.52+)
5. Install Witty Pi programs, if they are not installed yet
You can also manually install these packages and make those configurations, if you prefer to. After
the installation, please remember to reboot your Raspberry Pi, so the Realtime clock I2C hardware
will be loaded correctly.
You will then see a new “wittypi”directory, and it contains 6 runnable files… viz.:
Although the daemon.sh is runnable, you should not run it manually. The installing script has
registered it into /etc/init.d and it will run automatically after the start up.
The syncTime.sh script is not supposed to be manually run either; it will run automatically after the
start up. It will copy the time from Raspberry Pi system to RTC if you have never set the RTC time
before. If RTC has the correct time and your Raspberry Pi has the wrong time –perhaps because of
the lack of Internet connection, it will copy the RTC time to your Raspberry Pi system.
The runScript.sh script is the one who takes charge of the schedule script running. Usually you
don’t need to run it manually, as it will be executed after the system is up. If there is a schedule script
in use, it will schedule the next shutdown and next startup, according to the schedule script.
The wittyPi.sh is the software that allows you to configure your Witty Pi interactively. You can use
it to copy time between Realtime clock and the system, and schedule the time for auto shutdown
and/or startup. Please see the “Software Usage”chapter for more information.
The afterStartup.sh script will be run automatically after system is up. You can execute your own
commands here if you wish them to be run after boot.
The beforeShutdown.sh script will be run automatically before system gets shut down by Witty Pi
3. You can also place your commands here. Please notice that, if the system is not shut down by
Witty Pi 3 (tapping button, schedule shutdown or auto-shutdown due to low input voltage), this script
will not be executed.
Now the software has been installed and you will need to physically mount/install Witty Pi 3 on your
Raspberry Pi and connect power supply to Witty Pi 3 only.
pi@raspberrypi ~ $ cd wittypi
pi@raspberrypi ~ /wittypi $ ls
afterStartup.sh daemon.sh runScript.sh schedules utilities.sh wittyPi.sh
beforeShutdown.sh init.sh schedule.log syncTime.sh wittyPi.log

7
Software Update/Uninstallation
If you want to update the software to newer version, you don’t have to uninstall it first. Just remove
or rename your “wittypi” directory and repeat the installing process, then you are all set.
If you prefer to completely remove the software, besides removing the “wittypi” directory, you
should also remove the “/etc/init.d/wittypi” file. There are some dependencies (such as wiringPi,
i2c-tools etc.), which may be installed during the software installation. In the majority of cases you
don’t have to remove them, but if you wish to you can check the content of “install.sh”script and do
the reverse.
pi@raspberrypi ~ $ mv wittypi wittypi.bak
pi@raspberrypi ~ $ wget http://www.uugear.com/repo/WittyPi3/install.sh
pi@raspberrypi ~ $ sudo sh install.sh
Table des matières
Autres manuels UUGear Unité de contrôle
Manuels Unité de contrôle populaires d'autres marques

Festo
Festo Compact Performance CP-FB6-E Manuel de la liste des pièces

Elo TouchSystems
Elo TouchSystems DMS-SA19P-EXTME Manuel utilisateur

JS Automation
JS Automation MPC3034A Manuel utilisateur

JAUDT
JAUDT SW GII 6406 Series Guide rapide

Spektrum
Spektrum Air Module System Manuel utilisateur

BOC Edwards
BOC Edwards Q Series Manuel utilisateur












