-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class does not work with Pi2 due to RPi.GPIO not working (yet) #19
Comments
AH |
The folks from PiMoroni sent me to this branch of the library which does not need to use RPi.GPIO |
Thanks for keeping everyone updated Liam! |
hi pi@raspberrypi ~/PiGlow $ sudo python cpu.py im new to this so i don't know what it means or what to do about it. |
type this command
and add this line to the end of your /boot/config.txt file
|
Thanks |
Make sure you reboot after making this change to /boot/config.txt This is what made everything work for me...and I got the same error as you did. |
I had this excact same issue with my pi2 and the suggested fix to the config.txt and the new piglow installlaton and reboot resulted in the exact same i/o error. Wonder why this did not work for me? |
If you're uncomfortable with manually entering those commands, just do "sudo apt-get update" && sudo apt-get upgrade and then use raspi-config to enable I2C bus. It has been updated to use the new device trees. |
@DougRamsey - you have to also use the workaround piglow.py I referenced above. Have you done that or are you still using the one in this library? |
Thanks electronics guy and liamkennedy Not sure if the setup took care of installing the piglow file you mentioned above. I am new to pi and lynux so help is appreciated. |
I'm at a loss to know what else to suggest. If you changed config.txt and you are using the replacement piglow.py code I have no further ideas. Sorry |
@DougRamsey Did you do install the python smbus module? Do this and then try again: sudo apt-get install python-smbus |
Thanks electronicsguy liamkennedy and I have installed the smbus. Might just be the pi2 don't yet work with piglow. I have my project on the b+ board and all is well with it. Do either of you have piglow working on pi2? |
I can assure you the PiGlow works on the Pi2. I have it working just fine with my ISS-Above project and I have an image with my code that works just great. Perhaps my base image I used to support the Pi2 had some other code installed that made this work more easily. I don't know what that might be. |
did you do the actual install, (the last line): or did you simply download the files and try to run them? just making sure. |
Thanks you for your help electronics guy and liamkennedy. I did the upgrade and update, apt-get psutil and smbus they installed properly I still get that io error this is exactly the same error that connnormilner198 reported but never got back if he got it fixed Doug |
Ok, lets debug the i2c and smbus. What do you get when you do this?: i2cdetect -y 1 btw, try the official pimoroni github again. It should work. make sure you've done "sudo rpi-update" before. Type here exactly what error you get with that. |
Thanks electronics guy. I did the rpi-update successfully then redid the git hup and reran the setup successfully |
ok, check it on channel 0 as well: i2cdetect -y 0 If this also gives an error (or no output) like above, then your i2c bus has not been activated, which is the root cause of your problems. you need these lines in the respective files: /etc/modules: /etc/modprobe.d/raspi-blacklist.conf: then reboot, and check if i2cdetect works now. |
also install this library: |
Thankks aginb electronicsguy Doug |
Looks like you have 2 problems: sn3218 and i2c. lets take the first one. the sn3218 is the chip on the piglow. the module should have been installed. but if not try this: sudo apt-get install python-pip then reboot and run the example and see if it atleast eliminates the first error. But as its pointed out here: http://forums.pimoroni.com/t/display-o-tron-3000/29/23 the error should not be there if your i2c module hasn't been activated. So lets look at the i2c again. please print out the i2c relevant contents of the 3 files I had mentioned in the previous post. also do this: sudo modprobe i2c-dev, then reboot Unless you get i2cdetect working as pointed above, the piglow is not going to work. Someone in the URL I referenced above had similar errors to yours, and it seems he got a new raspbian image and did the standard steps and it worked for him. I cannot pinpoint your problem but from what I understand, the kernel is refusing the load the i2c module. If you have the patience, take a new SD card, flash a fresh raspbian install and do the standard steps outlined in the pimoroni github, after doing apt-get update/upgrade, rpi-update, and raspi-config to enable i2c and see if it works. oh, btw, what's your default python version? I don't think the piglow works with version 3+. you have to use 2.xx. do a 'python --version' and check. Mine is 2.7.3 |
Thanks electronics guy for hanging in there with me on this. Programs in the regular PiGlow director produce many errors that I wont concern my self with for now. Thanks for all your help |
I have several Pi 2's with PiGlow's and I too, can't get it working. Here is what I did:
if I do "ls /dev/i*", I just see "mice" and nothing else. When I run "i2cdetect -y 0" or "i2cdetect -y 1", I get "Error: Could not open file If I run any of the samples from anyone's site, I pretty consistently get "IOError: [Errno 2] No such file or directory" or "ImportError: No module named piglow" After scouring the web, I believe that's all of the advice everyone has given, at one point or another. Yet, I can't get this to work. Anyone have anything else for me to try? |
hmm tricky. one thing I want to checkL: you did do a reset after changes to the config files right? Are you able to do any GPIO? This can be checked by connecting a LED and a 10K resistor to any GPIO pin and some simple led flash code you find. If not there may be a problem with the python gpio lib. You said you installed python-smbus. did you get any errors? ALso, did you install libi2c-dev? that's required. |
@electronicsguy yes, libi2c-dev installed. Yes, reboots done after every major step and plenty in-between. Yes, GPIO works (plus I'm doing this in parallel on 4 pi's with 4 piglows and the behavior is on all 4 - so, it's not bad Pi or PiGlow hardware). With python-smbus, I uninstalled and re-installed and I think it's fine: |
I did all these things also and the only way it works for me is to simply run before running my python program which at some point electronics guy recommended and after that it works fine. No reboot or anything is required. Not sure why this was required but I will wait keep monitoring for the ultimate solution. |
@DougRamsey I run that, and there is no output - the prompt comes back. Should I see something! Running python after that I get the same result. |
My experience is before it run sudo modprobe i2c-dev from the raspberrypi directory, my piglow program does not work and returns the io error. After running sudo modprobe i2c-dev it returns to the raspberrypi directory and prompt and then I navigate to my program and voilla.....it works |
@DougRamsey thanks, here's what I get:
|
In order to get the ic2 detection I had to run it with sudo i2cdetect - y - 0 When I run "i2cdetect -y 0" or "i2cdetect -y 1", I get "Error: Could not open file /dev/i2c-0' or/dev/i2c/0': No such file or directory" |
I get:
|
I get the same for bus 0 but when I try bus 1 I get detection: pi@raspberrypi ~ $ sudo i2cdetect -y 1 Sorry I am not able to help |
No problem, I appreciate you trying!! |
Rob, there's nothing wrong with the instructions per se, they've been tested with many people. There's definitely something wrong with enabling the i2c bus in your setup, even though you seem to have done everything right. Maybe there's some hidden system conflict that we cannot see. |
@electronicsguy Ugg. I want to get this going, so I figured I'd start from scratch. I have a Pi 2. Here's what I did:
Before, I did the same thing but I did have "RabbitMQ" installed and configured. So, there may have been some problem with that. Now that I have this working, I'll try to re-install RabbitMQ and see if/when it breaks... OH - one more thing, the examples that use |
cool. Install the "libi2c-dev" module too, in case you haven't. that may make the i2cdetect work for you. Well you have to install the "piglow" python module to use it. Did you only download the relevant python project? You either have to put the relevant modules in the python packages directory (/usr/lib/python2.7/dist-packages/) or add the path to your pythonpath environment variable. Its explained here: https://github.com/benleb/PyGlow. Actually you could also put them in the local python directory (/usr/local/lib/python2.7/dist-packages). My local python packages directory looks like this: I used the python "pip" utility to install the piglow package so I didn't have to copy these manually. You can google for python "pip". |
That already worked; here's what I get now:
|
I did install pip (I didn't know what that was before):
and I still get that "No module named piglow". So, I assume it's a path issue now? I don't know much about Python. Any ideas? |
I did everything from https://github.com/benleb/PyGlow and I just can't get this to work. I continue to get "ImportError: No module named PiGlow" (and then verified with PyGlow, as there are samples with both spellings! Even though that module does seem nice, I've spent a couple hours on this and at this point it's not worth it to pursue anymore. OK, hopefully this saves some future, poor soul! Here's what I did to get the PiGlow working on a Raspberry Pi 2:
FYI |
Hey Rob, I had to move my programs from the examples directory up into the PyGlow directory and then run them from there to get them to work. I like that ben leeb pulsing functionality. |
@DougRamsey I did, stubbornly, play with this for longer. I ended up pulling down the latest "PiGlow" library too (see: http://forums.pimoroni.com/t/raspberry-pi-2-what-works-and-what-doesnt/352/14) - that seems the closest to working, but I get several The bottom line is that PiGlow/PyGlow module simply isn't ready for primetime. I've probably got 6+ hours into fiddling with this using every combination of every approach I can find. I'm dead in the water with that "PyGlow/PiGlow" approach - it simply doesn't work or requires significant development on the consumer's part. Which, i my opinion, is not acceptable. So, I'm done with that approach! |
I know this is hard for you to accept.. But you are doing something wrong. I've got this working in hundreds of my shipped devices (issabove) using the piglow (but using the modified version of the code I pointed to at the beginning of this thread). I've had none of the issues you have been experiencing. The piglow is a pretty standard little add on for the raspberry Pi. Have you thought about contacting pimoroni direct?
|
@liamkennedy haha! That's not difficult for me to accept at all! Just please send me the link of what I should be doing and I'll be on my way! As for support, everyone seems to point to GitHub to give details since this apperently is the module that isn't working, not a problem with the hardware. I have 4 Pi2's and 4 PiGlows an the behavior is the same on all. So please, correct me! Give me a list of things to do to make it work! There are countless examples on the web and I get errors with lots of them! To be clear, what does NOT work now is the PyGlow or PiGlow modules, the raw examples DO work. |
Sorry but I'm just not willing to spend more time on this thread. I think everything you need to know is here already. And above I point to a different github repository for an updated piglow module that I'm using. Do reach out to pimoroni though. Good luck. Sent from my iPad
|
wrt: PyGlow or PiGlow: what does your local python packages directory look like: post the output of 'ls' here. |
@electronicsguy I don't know where that packages folder is - what is the path? Meanwhile, I did accidentally get "PyGlow" module working - but I have no idea how. I am planning to re-format the SD and try again to see if I can trace the steps to get it working. Out of principle at this point, I'll likely do a blog post with all of the gory details, and I'll post back here once I've untangled the big mess!! I know now, it's possible to get Pi2 + PiGlow working, but as far as what needs to be installed or configured in what order, that is the big mystery I hope to unravel. Thanks for your help. |
Just FYI, I never could get the "PiGlow" module working, but I DID get the "PyGlow" module working. I wrote down detailed step-by-step instructions on how to get that working, here: Getting a PiGlow to work with a Raspberry Pi 2 which covers most all of the concepts and techniques discussed in this thread. Thanks, all for your help in trying to troubleshoot and I hope that helps. |
Just a heads up (which you probably already know).. this class does not work in a Pi2 due to the RPi.GPIO library not supporting the Pi2 currently. I have heard there is a Dev version of RPi.GPIO available. I have not yet tried that.
Thanks!
-Liam
The text was updated successfully, but these errors were encountered: