Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Senior Member
    Join Date
    Jan 2011
    Location
    Minneapolis
    Posts
    699

    Trying to use GPIO Switches on the Tweaks Page of PiCorePlayer ....................

    I have a Fan on my Rpi Model #4 that I am trying to turn off and on
    using the GPIO Switches on the Tweaks Page.

    The Fan is Hooked to Pin #6 - Ground and Pin #1 - 3.3 volts
    I have tried to shut it off using gpio-poweroff, but have not succeeded.
    I set it to pin #1 and rebooted, but the Fan was still on.

    So, is what I'm trying to do Possible? And if so, what settings should I be using?

  2. #2
    Senior Member KeBul's Avatar
    Join Date
    Sep 2009
    Location
    London
    Posts
    221
    I've not played around with these at all but from a quick read up on RPi GPIO's I think Pin #1 is fixed 3.3v

    You need to use a configurable GPIO pin, try Pin #17, set as an output, set to high will give you 3.3v on that pin, set to low will give you 0v on that pin.

    Can't see how to set a pin as an output on pCP though - perhaps that's the default - I'm sure someone else will confirm.

    Kev

  3. #3
    Senior Member KeBul's Avatar
    Join Date
    Sep 2009
    Location
    London
    Posts
    221
    Hi,

    Just tested this for you.

    I used GPIO 17 which is Pin #11 on the 40 way header

    Name:  pipins1.jpg
Views: 68
Size:  62.2 KB

    Name:  pipins2.jpg
Views: 69
Size:  35.4 KB

    I set up pCP gpio-poweroff as follows:

    Name:  pCPGPIO.jpg
Views: 67
Size:  15.7 KB

    When pCP is up and running I have 3.3v on Pin #11 (GPIO17)

    When I shutdown pCP I have 0v on Pin #11 (GPIO17)

    Not sure if this is what you are after, but I hope it helps.

    Kev

  4. #4
    Senior Member
    Join Date
    Jan 2011
    Location
    Minneapolis
    Posts
    699
    Quote Originally Posted by KeBul View Post
    Hi,

    Just tested this for you.

    I used GPIO 17 which is Pin #11 on the 40 way header

    Name:  pipins1.jpg
Views: 68
Size:  62.2 KB

    Name:  pipins2.jpg
Views: 69
Size:  35.4 KB

    I set up pCP gpio-poweroff as follows:

    Name:  pCPGPIO.jpg
Views: 67
Size:  15.7 KB

    When pCP is up and running I have 3.3v on Pin #11 (GPIO17)

    When I shutdown pCP I have 0v on Pin #11 (GPIO17)

    Not sure if this is what you are after, but I hope it helps.

    Kev
    Thanks for your help, but I am a bit confused when you said you 'Shut down PcP' -- I was just clicking on the gpio-poweroff button.
    I tried something using Pin #2 on your diagram - as my tiny fan wires would not reach to Pin #11 .... I could not get it to work.

  5. #5
    Senior Member Greg Erskine's Avatar
    Join Date
    Sep 2006
    Location
    Sydney, Australia
    Posts
    1,936
    Remember when connecting devices directly to GPIO's you need to keep in mind the current draw.

    The power and earth pins have higher current capacity than the GPIO's.

    Normally for motors, you would connect a transistor to the GPIO that switches the power to the motor.

  6. #6
    Senior Member KeBul's Avatar
    Join Date
    Sep 2009
    Location
    London
    Posts
    221
    Quote Originally Posted by Cut-Throat View Post
    Thanks for your help, but I am a bit confused when you said you 'Shut down PcP' -- I was just clicking on the gpio-poweroff button.
    I tried something using Pin #2 on your diagram - as my tiny fan wires would not reach to Pin #11 .... I could not get it to work.
    Hmmm, not really sure on the use case for this, my expectation was providing a state indicator for pCP... powered on or powered off, so external equipment can be turned off and on automatically at the same time as pCP, and that seems to be what it is doing, I cannot find the document the <more> link references.

    When I click on the gpio-poweroff button it asks if I want to reboot, click on yes and it saves the changes (even if no changes have been made) and reboots pCP, click on no and it saves the changes and warns you need to reboot at some time. This is on pCP V5

    I've just reconfigured gpio-poweroff for GPIO2 and tested again, and that behaves the same as my GPIO17 test, I'm just using a multimeter to check for 3.3v on the various pins so real current draw, no doubt Greg is spot on with his advice re the gpio driving a switch rather than the fan itself.

    Kev

  7. #7
    Senior Member
    Join Date
    Jan 2011
    Location
    Minneapolis
    Posts
    699
    Quote Originally Posted by Greg Erskine View Post
    Remember when connecting devices directly to GPIO's you need to keep in mind the current draw.

    The power and earth pins have higher current capacity than the GPIO's.

    Normally for motors, you would connect a transistor to the GPIO that switches the power to the motor.
    The Fan is working just fine.. I bought a Zebra Case from C4 Labs that included the Fan with the Case. The Instructions call for hooking the Fan up to Pin #1 for the 3.3V and Pin #6 for Ground... Everything is running fine. I was just wondering if I could turn it off via the GPIO Tweaks page on PiCorePlayer.

  8. #8
    Senior Member Greg Erskine's Avatar
    Join Date
    Sep 2006
    Location
    Sydney, Australia
    Posts
    1,936
    The power/earth pins are not GPIO's. They are fixed at 5V, 3.3V or 0V and can't be turned on and off. piCorePlayer can't do anything about that.

    The GPIO's can be turned off and on but don't have much current capacity so extra circuitry is usually required. Usually a transistor and a resistor or 2. This solution will typically have 3 connections, one to 3.3V, one to 0V and one to a GPIO. The GPIO usually connects to the base of the transistor which works like a switch.

    So once you decide on your circuitry and pick the GPIO you need to load the gpio-fan overlay. This will turn your fan on if it gets hot.

    Code:
    Name:   gpio-fan
    Info:   Configure a GPIO pin to control a cooling fan.
    Load:   dtoverlay=gpio-fan,<param>=<val>
    Params: gpiopin                 GPIO used to control the fan (default 12)
            temp                    Temperature at which the fan switches on, in
                                    millicelcius (default 55000)
    Last edited by Greg Erskine; 2020-09-17 at 00:02.

  9. #9
    Senior Member
    Join Date
    Jan 2011
    Location
    Minneapolis
    Posts
    699
    Quote Originally Posted by Greg Erskine View Post
    The power/earth pins are not GPIO's. They are fixed at 5V, 3.3V or 0V and can't be turned on and off. piCorePlayer can't do anything about that.

    The GPIO's can be turned off and on but don't have much current capacity so extra circuitry is usually required. Usually a transistor and a resistor or 2. This solution will typically have 3 connections, one to 3.3V, one to 0V and one to a GPIO. The GPIO usually connects to the base of the transistor which works like a switch.

    So once you decide on your circuitry and pick the GPIO you need to load the gpio-fan overlay. This will turn your fan on if it gets hot.

    Code:
    Name:   gpio-fan
    Info:   Configure a GPIO pin to control a cooling fan.
    Load:   dtoverlay=gpio-fan,<param>=<val>
    Params: gpiopin                 GPIO used to control the fan (default 12)
            temp                    Temperature at which the fan switches on, in
                                    millicelcius (default 55000)
    OK, Thanks..... More involved than I had thought.

  10. #10
    Senior Member KeBul's Avatar
    Join Date
    Sep 2009
    Location
    London
    Posts
    221
    Quote Originally Posted by Greg Erskine View Post
    The power/earth pins are not GPIO's. They are fixed at 5V, 3.3V or 0V and can't be turned on and off. piCorePlayer can't do anything about that.

    The GPIO's can be turned off and on but don't have much current capacity so extra circuitry is usually required. Usually a transistor and a resistor or 2. This solution will typically have 3 connections, one to 3.3V, one to 0V and one to a GPIO. The GPIO usually connects to the base of the transistor which works like a switch.

    So once you decide on your circuitry and pick the GPIO you need to load the gpio-fan overlay. This will turn your fan on if it gets hot.

    Code:
    Name:   gpio-fan
    Info:   Configure a GPIO pin to control a cooling fan.
    Load:   dtoverlay=gpio-fan,<param>=<val>
    Params: gpiopin                 GPIO used to control the fan (default 12)
            temp                    Temperature at which the fan switches on, in
                                    millicelcius (default 55000)
    Cheers Greg,

    As I said previously never played around with this side, how and where would one load the gpio-fan overlay?

    Kev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •