Here's an "update" to post #1439 in this thread.
This is a real power on - off switch for the WB. The system uses a
double pole push button that functions as a power on and a power off
switch.
When the WB is switched off, simply press the button briefly to power up
the system. To switch off, (wait until the WB is completely booted up)
simply press and hold the push button until the green LED starts to
flash. When the flashing stops the system will remain under power for a
little over a minute. During this time the red LED will be on to let the
user know when the power is actually removed from the system. 

It uses three GPIO's:

GPIO7_8 (pin 12 of JP4): This pin drives the power LED (green) and it
controls the power on state of the system. The electronic around the
relay is setup in such way that it provides a little over a minute delay
before switching off the system after GPIO7_8 drops low. There are two
reasons for this delay: first, it allows the WB to properly shutdown
when power off is initiated and secondly, it allows for a little of a
minute delay so that the WB has the chance to power up and start the
shutdown service (WB boots up in about 32 seconds). This service has two
functions: keep GPIO7_8 high so that power is available for the system
and a second function is to shutdown the WB when instructed.

GPIO3_27 (pin 6 of JP4): This pin is monitored by the shutdown service
and is responsible to shutdown the system when the power button is
pressed. To shutdown, press and hold the push button until the green LED
starts to blink.  

GPIO_19 (pin 18 of JP4): This is actually the GPIO pin used for the
TriggerOutput function. I also use it here to let the user know about
the power state when shutdown sequence is initiated. Since GPO3_27 goes
low to allow a shutdown, the green power LED is no longer on. So the
shutdown service will light up the red LED. This LED will be on for as
long that the system is still under power during shutdown. 
In my WB setup this pin drives my VU lights (instead of a red LED).

You still need to create a csos-shutdown script and a shutdown.service
file as described in post '#1439'
(http://forums.slimdevices.com/showthread.php?99395-Community-Squeeze-OS-F19-Release-1&p=771729&viewfull=1#post771729).

The shutdown.service file is exactly the same but the csos-shutdown
script is a bit different:


Code:
--------------------
    
  #!/bin/bash
  
  sudo echo out > /sys/class/gpio/gpio200/direction
  sudo echo 1 > /sys/class/gpio/gpio200/value
  sudo echo in > /sys/class/gpio/gpio91/direction
  
  while [ true ]; do
        i=`cat /sys/class/gpio/gpio91/value`
        if [ $i -eq 1 ] 
        then
                        sudo echo 0 > /sys/class/gpio/gpio200/value
                        sleep 0.5
                        sudo echo 1 > /sys/class/gpio/gpio200/value
                        sleep 0.5
                        sudo echo 0 > /sys/class/gpio/gpio200/value
                        sleep 0.5
                        sudo echo 1 > /sys/class/gpio/gpio200/value
                        sleep 0.5
                        sudo echo 0 > /sys/class/gpio/gpio200/value
                        sleep 0.5
                        sudo echo 1 > /sys/class/gpio/gpio200/value
                        sleep 0.5
                        sudo echo 0 > /sys/class/gpio/gpio200/value
                        sudo echo 1 > /sys/class/gpio/gpio101/value
                        sudo shutdown -h now
        fi
        sleep 1
  done
  
--------------------


*Note:* Be sure to first implement the shutdown service before
connecting the power on - off hardware. Failing to do so will result in
a power shutdown after about 1 minute. The shutdown needs to be running
in order to prevent this.

Below is the electronics required:

15682

Your power supply must now be connected to the above electronics and not
to the WB. The WB gets its power from JP4 (Switched 5V). Either solder
the wires to the board or make a short wire with a DC plug that connects
between JP4 and the DC power input of the WB.
I'll post some pictures if the prototype later (didn't get to that
yet).
Enjoy.


+-------------------------------------------------------------------+
|Filename: Power On-Off Switch.jpg                                  |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=15682|
+-------------------------------------------------------------------+


1 x SB3, 1 x SB Boom, 1 x SB Radio and 2 x SB Touch - all wireless
1 x Wandboard Dual behind the bedroom ceiling
1 x Wandboard Dual for 'msqueeze' (http://www.msqueeze.co.nf/index.html)
project
ReadyNAS NVX running LMS 7.7.3. w iTunes plugin
iPeng 7 on iPhone.
SqueezePad & iPeng 7 on iPad.
http://www.last.fm/user/phibon
------------------------------------------------------------------------
Pascal Hibon's Profile: http://forums.slimdevices.com/member.php?userid=7969
View this thread: http://forums.slimdevices.com/showthread.php?t=99395

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to