Coder Social home page Coder Social logo

Comments (13)

gh3rann avatar gh3rann commented on September 6, 2024

If I run it without the debug part this is the output:
`
pi@raspberrypi:~/fanshim-python/examples $ sudo ./install-service.sh --on-threshold 60 --off-threshold 50 --delay 2
Setting up with:
Off Threshold: 50 C
On Threshold: 60 C
Delay: 2 seconds
Preempt: no
Disable LED: no
Disable Button: no
Brightness: 255

To change these options, run:
sudo ./install-service.sh --off-threshold --on-threshold --delay --brightness (--preempt) (--noled) (--nobutton)

Or edit: /etc/systemd/system/pimoroni-fanshim.service

Checking for rpi.gpio>=0.7.0 (for Pi 4 support)
rpi.gpio >= 0.7.0 already installed
Checking for Fan SHIM
Installing Fan SHIM
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: fanshim in /usr/local/lib/python3.7/dist-packages/fanshim-0.0.2-py3.7.egg (0.0.2)
Requirement already satisfied: plasmalights in /usr/local/lib/python3.7/dist-packages/plasmalights-0.0.1-py3.7.egg (from fanshim) (0.0.1)
Requirement already satisfied: RPi.GPIO in /usr/lib/python3/dist-packages (from plasmalights->fanshim) (0.7.0)
Checking for psutil
psutil already installed

Installing service to: /etc/systemd/system/pimoroni-fanshim.service

`

from fanshim-python.

druck13 avatar druck13 commented on September 6, 2024

from fanshim-python.

gh3rann avatar gh3rann commented on September 6, 2024

Hello Druck, indeed I tried this and:

pi@raspberrypi:~ $ sudo systemctl status pimoroni-fanshim.service
● pimoroni-fanshim.service - Fan Shim Service
Loaded: loaded (/etc/systemd/system/pimoroni-fanshim.service; enabled; vendor preset: enabled)
Active: inactive (dead)

I was trying to status/stop/start/ctrl+c/status:
pi@raspberrypi:~ $ sudo systemctl stop pimoroni-fanshim.service
pi@raspberrypi:~ $ sudo systemctl status pimoroni-fanshim.service
● pimoroni-fanshim.service - Fan Shim Service
Loaded: loaded (/etc/systemd/system/pimoroni-fanshim.service; enabled; vendor preset: enabled)
Active: inactive (dead)
pi@raspberrypi:~ $ sudo systemctl start pimoroni-fanshim.service
^C
pi@raspberrypi:~ $ sudo systemctl status pimoroni-fanshim.service
● pimoroni-fanshim.service - Fan Shim Service
Loaded: loaded (/etc/systemd/system/pimoroni-fanshim.service; enabled; vendor preset: enabled)
Active: inactive (dead)
pi@raspberrypi:~ $

And it keeps being inactive. Also there is no led lit on the fan itself.

from fanshim-python.

gh3rann avatar gh3rann commented on September 6, 2024

Also
pi@raspberrypi:~/fanshim-python/examples $ python automatic.py
Traceback (most recent call last):
File "automatic.py", line 2, in
from fanshim import FanShim
File "/home/pi/fanshim-python/examples/fanshim.py", line 1, in
from fanshim import FanShim
ImportError: cannot import name FanShim

from fanshim-python.

Gadgetoid avatar Gadgetoid commented on September 6, 2024

The latter is to be expected- since Fan Shim runs with (and is installed for) Python 3- you'd have to test with python3 automatic.py and see if you get any useful output.

from fanshim-python.

gh3rann avatar gh3rann commented on September 6, 2024

Hello & thank you for your response. The output its preetty much the same:
pi@raspberrypi:/fanshim-python/examples $ alias python37
alias python37='/usr/bin/python3.7'
pi@raspberrypi:
/fanshim-python/examples $ python37 -m pdb automatic.py

/home/pi/fanshim-python/examples/automatic.py(2)()
-> from fanshim import FanShim
(Pdb)

from fanshim-python.

Gadgetoid avatar Gadgetoid commented on September 6, 2024

I'm guessing in your case the library just hasn't been installed for your Python version- I merged a fix earlier today which might help if you "git pull" the repository and run "examples/install-service.sh" again.

from fanshim-python.

gh3rann avatar gh3rann commented on September 6, 2024

Thank you for your suggestion. Same thing - please see attached log (http://s000.tinyupload.com/index.php?file_id=03746890479925919913)

I am including the part where I am checking that the library was installed before/after refreshing the repo.

from fanshim-python.

Gadgetoid avatar Gadgetoid commented on September 6, 2024

Do you still see "inactive (dead)" when you sudo systemctl status pimoroni-fanshim.service?

I'm starting to wonder if the code is fine, but the physical connection between Fan SHIM and your Pi is flaky. It might be worth trying to adjust the fit of Fan SHIM, giving it a wiggle to make sure the friction-fit header is making good contact.

from fanshim-python.

gh3rann avatar gh3rann commented on September 6, 2024

Hello again. Unfortunately, yes:

pi@raspberrypi:~ $ sudo systemctl status pimoroni-fanshim.service
● pimoroni-fanshim.service - Fan Shim Service
Loaded: loaded (/etc/systemd/system/pimoroni-fanshim.service; enabled; vendor preset: enabled)
Active: inactive (dead)
pi@raspberrypi:~ $ date
Mon 19 Aug 2019 03:04:45 PM CEST

Actually its a bit weird since at the moment the fan is all the time on. I would assume its really fitting the GPIO.

from fanshim-python.

Gadgetoid avatar Gadgetoid commented on September 6, 2024

Possible thought- is the exec bit set on automatic.py? Since the unit file for the service is running ExecStart=/home/pi/fanshim-python/examples/automatic.py directly.

The fan should be on-by-default which means it's getting power- the enable pin is pulled up. It not turning off could be indicative of a flaky connection.

It might be worth trying to toggle it more directly by running something like this in python3:

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
GPIO.output(18, 0) # SHould turn fan off
GPIO.output(18, 1) # Should turn fan on

This should help narrow down if it's the software or the hardware/connection causing the problem.

from fanshim-python.

gh3rann avatar gh3rann commented on September 6, 2024

Thank you for your reply. It took a while since I couldnt physically check on the fan until now.

I did what you suggested (just adding the GPIO.cleanup() at the end), but it did not shutdown the fan at all. It just kept going. I kind of saved the output to the file below.

http://s000.tinyupload.com/index.php?file_id=03743350135855647087

Forgot to mention here that script indeed is executable:

pi@raspberrypi:~/fanshim-python/examples $ ll
total 44K
drwxr-xr-x 2 pi pi 4.0K Aug 19 15:55 pycache
-rwxr-xr-x 1 pi pi 4.2K Aug 19 14:31 automatic.py
...

from fanshim-python.

Gadgetoid avatar Gadgetoid commented on September 6, 2024

The fan defaults to "on", so it should only turn off when pin 18 is actively driven low. My example above probably needed to look more like:

import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
GPIO.output(18, 0)  # Should turn fan off
time.sleep(5)       # Wait 5 seconds
GPIO.output(18, 1)  # Should turn fan on
time.sleep(5)       # Wait 5 seconds

So that you actually had time to see the fan stop, rather than the pin just toggling really fast and doing ... nothing much.

from fanshim-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.