Comments (10)
It's as if the daemon isn't running. That is the most likely explanation. I've just tried the same with Python 3.4 and have opened a socket manually and via the pigpio Python module.
N.B. I'm using a new version of the Python module which instantiates a class for each Pi (so more than one Pi can be controlled from one Python script).
joan@soft /ram $ sudo pigpiod
joan@soft /ram $ pigs t
740687050
joan@soft /ram $ pigs t
743243930
joan@soft /ram $ python3.4
Python 3.4.1rc1 (default, May 5 2014, 20:18:18)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
import pigpio
local = pigpio.pi()
local.get_current_tick()
796894514
local.get_current_tick()
798635451
local.get_hardware_revision()
2
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 8888))
s
<socket.socket fd=5, family=AddressFamily.AF_INET, type=SocketType.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 37841), raddr=('127.0.0.1', 8888)>joan@soft /ram $ pigs t
914567397
joan@soft /ram $
I suggest you use pigs to confirm the daemon is running.
from pigpio.
Here is my system setup: Ubuntu 12.04, Python 3.2, latest pigpio from github installed
I checked the process via ps
ps aux
[...]
root 9565 18.3 1.2 13552 5764 ? SLsl 12:21 0:00 pigpiod
[...]
Result using pigs (after a long waiting time)
$ pigs t
connect failed
Using your code snippet
>>> import pigpio
>>> p = pigpio.pi()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Can't connect to pigpio on localhost(8888)
Did you start the pigpio daemon? E.g. sudo pigpiod
Did you specify the correct Pi host/port in the environment
variables PIGPIO_ADDR/PIGPIO_PORT?
E.g. export PIGPIO_ADDR=soft, export PIGPIO_PORT=8888
Did you specify the correct Pi host/port in the
pigpio.pi() function? E.g. pigpio.pi('soft', 8888))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>> import socket
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> s.connect(('localhost', 8888))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
socket.error: [Errno 110] Connection timed out
It looks like the daemon is running but not responding whatsoever...strange
from pigpio.
Ubuntu?
So you are running the pigpio Python module on a PC and connecting to the pigpio daemon running on a Pi?
You need to specify the name or IP address of the Pi running the daemon. Either as an argument to pigpio.start() (or pigpio.pi() if using the latest, 16, version of the library) or by setting the PIGPIO_ADDR environment variable.
export PIGPIO_ADDR=soft
from pigpio.
Sorry for the mistake and confusion: the pigpiod daemon and the python program are both executed on the RPi (running Raspbian). I am working within an ssh session from an Ubuntu 12.04 machine.
from pigpio.
Is the current situation that pigpiod is running but is not responsive?
Does pigs work? It uses the same socket interface as the Python module.
pigs t # show current tick
pigs pigpv # show library version
pigs hwver # show Pi's hardware revision
Does
cat /dev/pigerr&
spit out any error messages?
Use
sudo killall -USR2 pigpiod
sudo killall -USR2 pigpiod
sudo killall -USR2 pigpiod
sudo killall -USR2 pigpiod
sudo killall -USR2 pigpiod
to bump the internal debug level.
sudo killall -USR1 pigpiod
sudo killall -USR1 pigpiod
sudo killall -USR1 pigpiod
sudo killall -USR1 pigpiod
sudo killall -USR1 pigpiod
sudo killall -USR1 pigpiod
to reverse the process.
Do
./x_pigs
./x_pipe
work?
from pigpio.
Hi Joan,
sorry for my late response: I had to set up and configure my RPi from scratch after a gpio-unrelated system crash. The good news: after re-installing everything, I did clone the current repo, did a make, make install, started the pigpiod daemon and voila: the daemon is running and responding. Unfortunately I have no idea why it didn't work before I had to re-install everything.
Thanks a lot for your support and immediate responses. I am looking forward to finally implement my little servo project. If I somehow find out why this all happened, I let you know.
Cheers,
Jonas
from pigpio.
Hi Jonas,
In that case I'll close this as an issue. If the problem reappears we can start a new issue.
Regards,
from pigpio.
Hi, so I know this issue is closed, but I wanted to comment incase other encounter it.
I was struggling with this quite a bit and only solved it after working with another program and realizing I couldn't ping localhost. It turns out when I had followed a guide to setting up an automatic wlan network (this is the culprit: http://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/), I had turned off the loopback network. So pigpiod would still run and listen on a port just fine, but the scripts could never open a socket and reach it. I believe this is why Jonas's issue was resolved by a reinstall.
In any case, to others who encounter this: make sure that there's a "LOOPBACK" network appearing when you type "ifconfig." If not, check that there's a line "auto lo" in your /etc/network/interfaces file. Here's an article that helped me: https://scottlinux.com/2012/06/09/cant-ping-localhost-in-linux/
from pigpio.
Thanks for that information. It's something I wasn't aware of and I'll try to bear it in mind if I come across the same problem again.
from pigpio.
@lucentbeam Thanks for your post, I followed the same wifi tutorial and had the same problem. Your post saved me from having to settle on RPi.GPIO pwm, thanks!
from pigpio.
Related Issues (20)
- Pigpio BB Serial Read CPU Resource vs. RPI version HOT 4
- Is there a way to flush an open gpioSerialRead buffer? HOT 9
- event_callback with 0 bytes
- Issue with pigpio Initialization on Raspberry Pi 5 Model B HOT 1
- Understanding pigpiod command implementation HOT 9
- Glitch filter active while doing bbSerialRead? HOT 3
- SPI Slave - BSCX not consistently working RPi4B HOT 6
- i2c_open() returns the same handle for two devices on the same bus HOT 37
- Scheduling repetitive SPI writes HOT 3
- Isr doesn't work on raspberry os 12.5 HOT 3
- Continuous Wave Program Concept HOT 6
- SPI6 mode 3 HOT 1
- Leave CS low HOT 1
- Pigpio stuck on activating HOT 4
- Adding new functions to the library HOT 2
- Missed packets using RaspberryPi and nRF24L01. HOT 8
- Python 3.11.2 is installed but still getting "Depends: python:any (>= 2.7~) but it is not installable" HOT 2
- gpioSetISRFunc error -123 HOT 1
- setup.py does not work with python 3.12
- libpigpio1 and libpigpio-dev version issue with pigpio
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pigpio.