UUGear Witty Pi User Manual

UUGear Witty Pi User Manual

Realtime clock and power management for raspberry pi

Advertisement

Quick Links

!
! ! ! ! ! ! ! ! ! ! !
!
!
Witty Pi
Realtime Clock and Power Management for Raspberry Pi

User Manual

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

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Witty Pi and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for UUGear Witty Pi

  • Page 1: User Manual

    ! ! ! ! ! ! ! ! ! ! ! Witty Pi Realtime Clock and Power Management for Raspberry Pi User Manual Copyright!©!2016!UUGear!s.r.o.! ! All!rights!reserved.!
  • Page 2: Table Of Contents

    ! ! ! ! ! ! ! ! ! ! ! Table!of!Content! What!is!Witty!Pi?!....................!1 What!is!in!the!Package?!..................!2 Witty!Pi!Specifications!..................!3 Software!Installation!.....................!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 Copyright!©!2016!UUGear!s.r.o.! ! All!rights!reserved.!
  • Page 3: What!Is!Witty!Pi

    ! ! ! ! ! ! ! ! ! ! ! What!is!Witty!Pi?! Witty!Pi!is!small!extension!board!that!can!add!realtime!clock!and!power!management! to! your! Raspberry! Pi.! After! installing! Witty! Pi! on! your! Raspberry! Pi,! you! get! some! amazing!new!features:! !! You!can!properly!turn!on/off!Raspberry!Pi!with!single!tap!on!the!switch.! !! Raspberry!Pi!and!all!its!USB!peripherals!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!
  • Page 4: What!Is!In!The!Package

    ! ! ! ! ! ! ! ! ! ! ! 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: Witty!Pi!Specifications

    ! ! ! ! ! ! ! ! ! ! ! Witty!Pi!Specifications! Dimension:! ! 65mm!x!56mm!x!19mm! Weight! 23g!(net!weight!without!battery)! Realtime!Clock!Chip! DS1337!(datasheet)! A!white!LED,!which!lights!up!for!a!few!seconds!when!a! LED!Indicator! shutdown! 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 !
  • Page 6: Software!Installation

    The! software! has! been! tested! under! Raspbian! Wheezy! and! Raspbian! Jessie.! It! might!also!works!on!other!operating!systems!with!or!without!modification.! First!step!is!to!run!this!command!in!your!home!directory:! pi@raspberrypi!~!$!wget!http://www.uugear.com/repo/WittyPi/installWittyPi.sh If! your! Pi! has! internet! connection,! it! will! immediately! download! the! 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:! pi@raspberrypi!~!$!sudo!sh!installWittyPi.sh Please!notice!that!sudo!is!necessary!to!run!this!script.!This!script!will!automatically!do!
  • Page 7 ! ! ! ! ! ! ! ! ! ! ! pi@raspberrypi!~!$!cd!wittyPi! pi@raspberrypi!~!/wittyPi!$!ls! daemon.sh! ! init.sh! ! syncTime.sh! ! utilities.sh! ! wittyPi.sh! 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! suppose! to! be! manually! run! either,! it! will! run! automatically! at! about! one! minute! 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! correct!time!and!your!Raspberry!Pi!hasn’t!(because!of!the!lacking!of!Internet),!it!will!
  • Page 8: Mounting!Witty!Pi!On!Raspberry!Pi

    ! ! ! ! ! ! ! ! ! ! ! Mounting!Witty!Pi!on!Raspberry!Pi! You!can!simply!plug!Witty!Pi!on!your!Raspberry!Pi’s!40cpin!header,!and!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 ! ! ! ! ! ! ! ! ! ! ! Then!you!can!connect!Witty!Pi’s!female!header!(at!bottom)!with!Raspberry!Pi’s!40cpin! male!header,!and!then!tighten!the!screws.! Don’t!forget!to!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: Software!Usage

    ~/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:...
  • Page 11 ! ! ! ! ! ! ! ! ! ! ! synchronized!from!Internet)!and!RTC!time!is!not.! 2.! Write!RTC!time!to!system! This!option!will!copy!the!time!from!the!Realtime!clock!on!Witty!Pi!to!your!Raspberry!Pi! system.!This!option!should!be!used!when!you!find!the!RTC!time!is!correct!while!the! system!time!is!not.! 3.! Set!time!for!auto!startup! This!option!allows!you!to!specify!when!your!Raspberry!Pi!should!auto!startup.!Please! notice!the!input!format!should!be!“DD!HH:MM:SS”,!DD!means!the!day!in!the!month,! HH!is!the!hour,!MM!is!the!minute!and!SS!is!the!second.!All!these!should!be!2!digits! and!24!hours!system!is!used.! You! can! also! use! “??”! as! wildcard! while! inputting! 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!15 !in!this!month.! !! ??!23:30:00!means!23:30:00!at!night!everyday!(daily!schedule)!
  • Page 12 ! ! ! ! ! ! ! ! ! ! ! 4.! Set!time!for!auto!shutdown! This! option! allows! you! to! specify! when! your! Raspberry! Pi! should! auto! shutdown.! Please!notice!the!input!format!should!be!“DD!HH:MM”,!it!is!basically!the!same!with! the!previous!option!but!without!the!second!in!the!end.!It!is!a!hardware!limitation!and! only!day,!hour!and!minute!could!be!specified!for!auto!shutdown.! Here!are!some!examples:! !! 15!21:45!means!9:45!at!night,!on!15 !in!this!month.! Similar!with!the!auto!startup!schedule,!you!can!use!“??”!as!wildcard!as!well,!and!the! rules!to!use!wildcards!are!the!same.! !! ??!23:30!means!23:30!at!night!everyday!(daily!schedule)! !! ??!??:15!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!
  • Page 13 ~/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:...
  • Page 14 ! ! ! ! ! ! ! ! ! ! ! on_10m_every_2h.wpi!will!turn!on!your!Raspberry!Pi!for!10!minutes,!in!every!two! hours.! ! If!you!want!to!stop!using!the!schedule!script,!please!choose!the!6 !item!in!the! menu!(“Reset!Data…”)!and!then!select!“Perform!all!actions!above”.!This!will!delete! the!“schedule.wpi”!file!in!Witty!Pi’s!install!directory,!and!clear!the! autocstartup/shutdown!time!that!already!gets!scheduled.! Remarks:!if!you!use!a!schedule!script,!please!make!sure!to!let!Witty!Pi!to!shutdown! your!Pi,!and!do!not!shut!it!down!manually.!Otherwise!Witty!Pi!will!try!to!shutdown!your! Pi!when!your!Pi!is!actually!off,!and!that!may!cause!a!dead!lock.!You!may!need!to!reset! your!Witty!Pi!if!that!happens.! If!you!wish!to!confirm!what!has!been!done!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!this!option,!the!software!will!display!a!sub!menu,!which!allows!you!to:! !! Clear!auto!startup!time:! The!autocstartup!time!will!be!erased!and!Witty!Pi!will!not!autocstart!your! Raspberry!Pi.! !! Clear!auto!shutdown!time:! The!autocshutdown!time!will!be!erased!and!Witty!Pi!will!not!autocshutdown!your! Raspberry!Pi.! !! Stop!using!schedule!script:! The!“schedule.wpi”!file!will!be!removed.! !! Perform!all!actions!above:!
  • Page 15: Making!Schedule!Script

    ! ! ! ! ! ! ! ! ! ! ! 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 >>>...
  • Page 16 ! ! ! ! ! ! ! ! ! ! ! automatically.! Below!is!a!very!simple!schedule!script!and!it!will!keep!your!Raspberry!Pi!on!for!5! minutes!in!every!20!minutes.! #"Turn"on"Raspberry"Pi"for"5"minutes,"in"every"20"minutes" BEGIN! 2015c08c01!00:00:00! END! 2025c07c31!23:59:59! ON! ! ! ! M5! ! #"keep"ON"state"for"5"minutes" OFF! M15! #"keep"OFF"state"for"15"minutes" Like!many!other!scripting!language,!Witty!Pi!schedule!script!also!uses!“#”!to!make! single!line!comment.! The!first!two!lines!define!the!time!range!for!executing!the!script.!Please!make!sure!to! use!the!correct!time!format!(YYYYcmmcDD!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!
  • Page 17 ! ! ! ! ! ! ! ! ! ! ! more!parameters!after!ON/OFF,!separated!by!space!or!tab.!Each!parameter!starts! with!a!capital!letter!and!follows!by!a!number,!where!the!capital!letter!is!the!unit!of!time:! !! D!=!Days!(D2!means!2!days)! !! H=Hours!(H3!means!3!hours)! !! M=Minutes!(M15!means!15!minutes)! !! S=Seconds!(S30!means!30!seconds)! For!example,!if!you!wish!to!define!an!ON!state!for!one!and!a!half!hour,!you!can!write:! ON! ! H1! !M30! When!the!script!engine!executes!this!line,!it!will!actually!schedule!a!shutdown!at!the! end!of!the!ON!state.! If!you!wish!to!define!an!OFF!state!for!two!days,!you!can!write:! OFF! When!this!line!gets!executed,!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!the!schedule!script!file!to!“~/wittyPi/schedule.wpi”!and! then!run!“sudo!./runScript.sh”!in!the!“~/wittyPi”!directory,!the!script!will!start!to!work.! This!allows!you!to!use!schedule!script!as!an!interface!to!integrate!other!tools!with! Witty!Pi!together.!For!example,!you! can!create!your!own!tool!to!visually!
  • Page 18: Hardware!Configuration

    ! ! ! ! ! ! ! ! ! ! ! Hardware!Configuration! There! are! three! colorful! jumpers! on! the! board,! and! they! allow! you! to! make! some! customization!on!your!Witty!Pi.! The!red!jumper!can!decide!if!you!Raspberry!Pi!get!powered!immediately!when!you! connect!the!5V!power!supply!to!Witty!Pi.!By!default,!this!jumper!is!set!to!“Default!Off”,! so!you!have!to!click!the!switch!once!to!power!on!your!Raspberry!Pi.! The!yellow!jumper!allows!you!to!specify!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!this!purpose.!The!GPIO!pin!should!have!initial!high!voltage!level!after!the! booting,!otherwise!your!Raspberry!Pi!will!get!shutdown!immediately.!The!way!to! configure!this!jumper!is!the!same!with!the!yellow!one.!
  • Page 19: Software!Customization

    ! ! ! ! ! ! ! ! ! ! ! You!will!also!need!to!modify!the!software!a!little!bit!to!use!different!GPIO!pins.!More! details!can!be!found!here:! http://www.uugear.com/portfolio/changecthecpincthatcusedcbycwittycpi/! Software!Customization! If!You!like!programming,!you!could!customize!or!even!write!your!own!software!for! Witty!Pi.!The!software!from!us!is!a!good!example!to!start!learning!how!to!write! program!for!Witty!Pi.!We!believe!the!most!interesting!part!is!to!program!the!RTC!chip! and!make!different!setups!of!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!need!to!really!understand!how!Witty!Pi’s! software!worksu!instead!you!just!create!your!own!schedule!script,!and!let!Witty!Pi’s! software!to!take!care!of!the!rest.!Programming!Witty!Pi!becomes!so!easy!because! your!application!only!need!to!generate!a!text!file,!according!to!user’s!input.!
  • Page 20: Witty!Pi!Log!Files

    ! ! ! ! ! ! ! ! ! ! ! Witty!Pi!Log!Files! In!the!directory!that!you!install!your!Witty!Pi!software,!you!can!find!two!log!files:! schedule.log!and!wittyPi.log.! The!“schedule.log”!file!contains!the!history!of!schedule!script!executions.!Here!you! can!see!how!the!next!shutdown!and!startup!get!scheduled.!If!you!saw!unexpected! schedule!script!behavior,!this!log!should!be!the!first!file!to!check.! The!“wittyPi.log”!file!records!the!history!of!all!Witty!Pi!activities.!If!you!think!your!Witty! Pi!doesn’t!behave!right,!this!log!file!might!provide!more!information!for!debugging.! If!you!need!our!help!for!solving!a!problem,!please!kindly!put!the!log!files!in!email! attachment!too.!This!will!help!us!to!help!you!better.! Witty!Pi!gets!Dead!Locked?! If!you!have!power!supply!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,!since!the!UART0!is!used!by!Bluetooth!now.!As! a!result,!the!TXD!pin!(GP14)!is!in!“INPUT”!state!after!the!boot,!and!it!gets!internally! pulled!down,!which!causes!the!dead!lock!status!of!Witty!Pi.!The!solution!is!to!install! the!latest!software!(version!2.16!or!higher),!which!has!taken!care!of!this!situation.! ! ! When!dead!lock!happens,!you!will!need!to!reset!your!Witty!Pi.!Just!remove!the!battery! on!Witty!Pi,!and!unplug!the!power!supply.!Then!you!wait!for!1!minute!so!the!RTC!chip! forgets!the!alarm!state,!later!you!will!be!able!to!power!it!on!again.!
  • Page 21: Witty!Pi!Immediately!Shutdown!After!Startup

    ! ! ! ! ! ! ! ! ! ! ! There!are!two!scenarios!that!could!cause!the!“dead!lock”!status:! !! Witty!Pi!schedules!the!next!auto!shutdown,!and!then!Raspberry!Pi!gets!shutdown! in!a!way!that!without!pulling!down!the!GPIOc4!pin,!such!as!disconnecting!power! supply!directly,!or!calling!“sudo!shutdown!–h!now”!command!by!the!user.!Since! the!GPIOc4!pin!is!not!pulled!down,!Witty!Pi’s!daemon!is!not!aware!of!the! shutdown,!and!hence!it!will!not!disable!the!auto!shutdown!alarm!before!cutting! the!power.!When!the!shutdown!alarm!gets!activated!while!Witty!Pi!and!Raspberry! Pi!are!not!powered,!Witty!Pi’s!software!doesn’t!have!a!chance!to!clear!the!alarm! state,!and!that!equals!to!long!hold!the!button!without!releasing!it,!which!prevents! your!Raspberry!Pi!to!get!powered!on!again.! !! The!scheduled!shutdown!comes!when!your!Raspberry!Pi!is!on!the!process!of! shutting!down.!Since!the!software!may!have!been!closed!when!the!shutdown! alarm!comes,!it!may!not!be!able!to!clear!the!shutdown!alarm,!and!the!result!will! be!the!same!as!the!previous!scenario.! To!avoid!the!dead!lock,!please!make!sure!not!to!call!the!“sudo!shutdown!–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!the!scheduled!shutdown!comes! during!the!manually!shutdown!process.! If!you!are!expecting!an!auto!startup,!please!make!sure!your!Witty!Pi!has!power!supply! connected.! If!you!want!to!shutdown!your!Raspberry!Pi!manually,!please!tap!the!button!on!Witty! Pi.!If!you!want!to!shutdown!Raspberry!Pi!in!your!own!script,!you!can!call!“gpio!mode! 7!out”!(GPIOc4!pin!is!pin!7!in!the!wiringPi).! Witty!Pi!Immediately!Shutdown!after!Startup?! Some!customers!meet!the!situation!that!after!installing!the!software!and!reboot,!Witty! Pi!immediately!shutdown!Raspberry!Pi!after!successfully!boot,!with!or!without!having!
  • Page 22 ! ! ! ! ! ! ! ! ! ! ! 1.! Scripts!do!not!get!executed!automatically!after!Raspberry!Pi!system!is!on! After!installing!the!software,!you!will!have!“daemon.sh”,!“syncTime.sh”!and! “runScript.sh”!scripts!in!the!directory!that!has!software!installed.!These!scripts!should! be!executed!automatically!after!the!operating!system!is!up.! If!these!scripts!are!not!automatically!executed!for!any!reason,!Witty!Pi!will!cut!the! power!of!Raspberry!Pi,!without!lighting!up!the!white!LED.!In!this!case,!the!first! place!to!check!is!the!“/etc/init.d/wittypi”!file,!and!there!is!possibility!that!it!contains! wrong!paths!to!these!scripts.! If!you!are!running!a!special!distribution!of!OS,!make!sure!to!check!if!the!commands!in! the!“/etc/init.d/wittypi”!file!do!exist!in!the!system,!or!it!will!fail!silently.!For!example,! Minibian!doesn’t!have!“sudo”!command.! 2.! GPIO\4!pin!doesn’t!reach!a!stable!status!in!given!time! After!the!system!is!on,!GPIOc4!pin!should!be!in!input!mode!and!gets!internally!pulled! up.!However,!during!the!startup!the!GPIOc4!pin!could!be!unstable.!In!the!daemon.sh! script,!the!GPIOc4!listener!will!be!started!once!the!pin!state!hasn’t!changed!for!10! seconds.!Once!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!supply!is!not!strong!enough,!during! the!booting!its!voltage!may!drop!from!time!to!time,!which!may!also!make!the!GPIO!pin! voltage!drop,!and!trigger!the!GPIOc4!listener!to!shutdown!your!Raspberry!Pi.! If!it!is!the!case,!you!don’t!have!to!replace!the!power!supply.!Just!try!to!delay!the! starting!of!GPIOc4!listener,!and!in!the!major!of!cases!it!will!help.!You!can!modify!the! "daemon.sh"!script,!in!line!44:! while![!$counter!clt!10!]u!do! Try!to!change!the!number!10!to!25.!The!bigger!number!you!use,!the!later!the!GPIOc4! listener!will!be!started.! This!modification!may!workaround!the!problem.!If!it!doesn’t,!it!means!your!GPIOc4!is!
  • Page 23: What!I2C!Address!Is!Used!By!Witty!Pi

    ! ! ! ! ! ! ! ! ! ! ! What!I2C!Address!is!Used!by!Witty!Pi?! Raspberry!Pi!communicates!with!the!RTC!chip!(DS1337)!on!Witty!Pi!via!I C!protocol.! The!DS1337!chip!has!a!fixed!I C!address:!0x68.! If!you!have!Witty!Pi!connected!to!Raspberry!Pi!and!run!“sudo!i2cdetect!cy!1”!in!the! console,!you!will!see!this:! sudo i2cdetect -y 1 pi@raspberrypi 2 3 4 5 8 9 a d e f -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --...
  • Page 24: What!Gpio!Pins!Are!Used!By!Witty!Pi

    ! ! ! ! ! ! ! ! ! ! ! What!GPIO!Pins!are!Used!by!Witty!Pi?! The!GPIO!pins!used!by!Witty!Pi!are!marked!with!green!color!in!the!table!below.! ! Please!notice!the!same!pin!may!have!different!pin!number!in!different!numbering! systems.!In!documents!we!always!use!BCM!numbering,!while!in!the!software!(bash! script)!we!use!the!wiring!Pi!numbering.! GPIO! wiring!Pi! wiring!Pi! GPIO! Name! Physical! Name! (BCM)! (wPi)! (wPi)! (BCM)! 3.3V! SDA!1! SCL!1! GND! GPIO!7! TXD! GND! RXD! GPIO!0! GPIO!1! GPIO!2! GND! GPIO!3! GPIO!4! 3.3V!
  • Page 25: Is!Witty!Pi!Compatible!With!"Other!Hardware

    ! ! ! ! ! ! ! ! ! ! ! As!you!can!see!in!the!table,!Witty!Pi!uses!GPIO\4,!GPIO\17,!GPIO\2!(SDA!1),! GPIO\3!(SCL!1)!and!GPIO\14!(TXD).! ! The!usage!of!GPIOc4!and!GPIOc17!are!customizable.!If!you!want!to!use!other!GPIO! pins!to!do!their!job,!you!can!follow!this!tutorial:! http://www.uugear.com/portfolio/changecthecpincthatcusedcbycwittycpi/! GPIOc2!and!GPIOc3!are!for!I C!communication!between!Raspberry!Pi!and!the!RTC! chip!(DS1337).!I C!devices!are!indentified!by!I C!address,!and!they!can!share!the!I pins!as!long!as!they!have!different!I C!addresses.! GPIOc14,!as!the!TXD!pin!for!serial!communication,!is!quite!special!in!Raspberry!Pi.!It! will!keep!on!HIGH!state!after!system!is!up,!and!will!become!LOW!after!system!has! been!shut!down.!It!is!used!for!detecting!the!system!up!or!down,!so!Witty!Pi!can!fully! cut!the!power!after!system!has!been!shut!down.!Since!it!is!the!only!pin!that!could!be! used!for!this!purpose,!it!is!not!customizable!either.! Is!Witty!Pi!Compatible!with!“Other!Hardware”?! We!have!got!a!lot!of!emails!asking!this!question,!and!the!only!difference!is!the!“Other! Hardware”!got!replaced!by!various!kinds!of!hardware.! Please!understand!that!we!might!not!have!the!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!I C!address!and!GPIO!pins!used!by!the!“Other!Hardware”.! If!the!“Other!Hardware”!uses!0x68!I C!address,!it!will!be!a!confliction!with!Witty!Pi’s! RTC!chip!and!you!can!not!use!it!with!Witty!Pi!together.! If!the!“Other!Hardware”!doesn’t!use!any!GPIO!pin!that!used!by!Witty!Pi,!and!it!doesn’t!

Table of Contents