Hot answers tagged

19 votes

pigpio Can't lock /var/run/pigpio.pid

You need to stop the pigpio daemon if you run a program directly linked with the pigpio C library. In effect your program becomes the pigpio daemon and only one may be running at a time. So sudo ...
user avatar
  • 66.5k
15 votes

Raspberry as an I2C SLAVE

Since this topic is very poorly covered and Sebastião's snippet and helped me to solve this problem I want add a complete solution on how to setup a RaspberryPi right here (tested on a RPi 3 and Zero ...
user avatar
  • 151
9 votes
Accepted

How to use pigpio to control a servo motor with a keyboard?

I'm not sure if anyone will write the code for you. It's too broad a question. You need to acquire a basic understanding of Python programming first, otherwise you'll be forever asking questions. ...
user avatar
  • 66.5k
7 votes
Accepted

pigpio - set_PWM_dutycycle vs hardware_PWM

hardware_PWM >>> set_PWM_dutycycle >>> software PWM where >>> is orders of magnitude better pulse stability. hardware_PWM rock solid pulses large choice and range of frequencies large number of ...
user avatar
  • 66.5k
7 votes
Accepted

Raspberry as an I2C SLAVE

This is almost identical to your previous question. You probably should have edited that rather than asking a new question. You need the bscXfer to be within the while loop. That is how the xfer ...
user avatar
  • 66.5k
6 votes
Accepted

gpiotest problem and gpio 30

That is a fault in pigpio/gpiotest and/or the hardware revision returned by the Pi Zero W. gpiotest relies on pigpio to tell it which GPIO are safe to write. pigpio relies on the hardware revision ...
user avatar
  • 66.5k
6 votes
Accepted

Is there a way to read the pullup status of a GPIO pin in python with, or if not, without pigpio?

It is not possible. Page 100 of BCM2835 ARM Peripherals GPIO Pull-up/down Register (GPPUD) SYNOPSIS The GPIO Pull-up/down Register controls the actuation of the internal pull-up/down ...
user avatar
  • 66.5k
6 votes
Accepted

Is there a GPIO current limit function available, and where is the documentation?

Yes. The definitive source for RPi hardware documentation is the Raspberry Pi Foundation. The Foundation updated their published documentation to include programmable GPIO current limits recently (Jan,...
user avatar
  • 17.8k
5 votes

How to read Wiegand card ID?

You can reliably read Wiegand devices with my pigpio library. There is C, C++, and Python example code at http://abyz.me.uk/rpi/pigpio/examples.html
user avatar
  • 66.5k
5 votes

How to use piscope from my pigpio library on python

If you are running piscope on a Pi enter the following commands. sudo pigpiod # Start the daemon if not already running. piscope & # Run piscope in the background. The main piscope display will ...
user avatar
  • 66.5k
5 votes
Accepted

How does pigpio's wave_chain() method happen in hardware?

The Raspberry Pi has 16 hardware DMA (Direct Memory Access) channels. Using DMA you can copy the contents of memory from one memory address to another memory address without software involvement. ...
user avatar
  • 66.5k
4 votes
Accepted

How to make a remote pigpiod socket call?

pigpio daemon C I/F to pigpio daemon Socket commands and responses Examples of usage (in the download): from Python is pigpio.py from C is pigs.c from C is pigpiod_if.c using C I/F to daemon is ...
user avatar
  • 66.5k
4 votes
Accepted

pigpio PWM and ALSA

By default pigpio uses the PCM peripheral to time the DMA leaving the PWM peripheral free for standard audio. Perhaps your ALSA device is using high quality audio. If that's the case you need to use ...
user avatar
  • 66.5k
4 votes
Accepted

Does pigpiod feature a verbose / debug mode?

Errors are reported to /dev/pigerr on the Pi running the daemon. So cat /dev/pigerr may provide useful information. You can enable tracing of the API by using the pigs csi command. Numbers 1 to 7 ...
user avatar
  • 66.5k
4 votes

Is there a way to slow down servo movement speed?

This may work as an example, give it a start and end position, and the time(seconds) you want it to take to move there. It will break the movement up into 100 incremental moves this will slow down ...
user avatar
  • 1,013
3 votes

python library to generate pulse frequency of "n" hz

Actually the pigpio Python module can do this quite easily for a single stepper. You would use the wave functions in combination with wave chains. Say you want a ramp of 20ms, 10ms, 5ms, 2ms, 1ms. ...
user avatar
  • 66.5k
3 votes
Accepted

12v+ on Raspberry Pi Ground Pin

It sounds like you were lucky in that the Pi appears to still work. To test the GPIO use either my gpio test (requires pigpio) or wiringPi's pintest utility. These test the basic GPIO functions.
user avatar
  • 66.5k
3 votes
Accepted

pigpio = DHT22 humidity sensor + TMP36 readings PROBLEM

Okay, you are using GPIO 8 to power the DHT22. GPIO 8 is actually the chip select for channel 0 of the main SPI device. So choose another GPIO, or power the DHT22 from 3V3 and set the power ...
user avatar
  • 66.5k
3 votes

Counting Pulse Length Using PiGPIO

I'm not going to delve too deeply into the code. I had a look at the datasheet and it seems to encode the reading in the low time over some sort of interval. It seems a little light on details. A ...
user avatar
  • 66.5k
3 votes
Accepted

PIGPIO stream pwm data over websockets with nodejs. GPIO

The commands you can send via the pipe interface are shown at http://abyz.me.uk/rpi/pigpio/pigs.html For the pipe interface each command should be terminated in a new line character ("\n") and you ...
user avatar
  • 66.5k
3 votes

pigpio servo control

The only problem I can see with the code is that it terminates straight away. When the program ends the pigpio library will shut down so servo pulses will stop. I suggest you add a time_sleep(10) or ...
user avatar
  • 66.5k
3 votes
Accepted

Measure rpm using hall sensor and pigpio

Q1 I don't remember but the code may well use a rolling average to calculate the RPM. This helps smooth the data. Q2/3 The code as given is instantiated with p = read_RPM.reader(pi, RPM_GPIO) ...
user avatar
  • 66.5k
3 votes

2 pigpio programs at the same time

Only one program linked against the C library (pigpio) can be running at any one time. This program in effect becomes the pigpio daemon. Many programs can talk to the pigpio daemon at the same time ...
user avatar
  • 66.5k
3 votes
Accepted

High speed bit bang GPIO reading

I do not remember why the limit is 250k rather than say 500k or 1000k. I expect there was a reason. It may simply have been there was too much jitter at the higher bit rates to reliably clock the ...
user avatar
  • 66.5k
3 votes
Accepted

pigpio spiXfer in C++

Using a char type to hold bytes is fairly common in C. char is one of the basic C types and holds one byte. Here is some C code to read channel 0 of the MCP3008. The example should make clear how ...
user avatar
  • 66.5k
3 votes

Two data parsing frames for SPI reads of MCP3008 ADC, any advantages or disadvantages of either one?

The difference is whether you put the padding on the left or the right side of the data. The Adafruit implementation seems to start sending data immediately, which leaves the last 7 bits as padding, ...
user avatar
  • 109
3 votes

Any way to add more GPIOs to the AIY Voice Kit?

You can use a break-out board like the Black HAT Hacker or Pico HAT Hacker. Alternatively, connect another Pi Zero as a USB gadget and use the GPIO expander.
user avatar
  • 2,341
3 votes
Accepted

pigpiod callback is exiting my code

As the code is written in your question, it is creating an unlimited number of callbacks. Eventually the system will fall over because of a lack of resources. Also a pigpio callback receives a set ...
user avatar
  • 66.5k
3 votes

Segmentation faults on every GPIO STR

You get the error because you didn't map the IOBASE address range to your process' address space. Accessing an unallocated address is exactly what a SEGFAULT is. Check the source code of any GPIO ...
user avatar
3 votes
Accepted

Full duplex SPI communication with an ADC using the pigpio library

If you want to send 8 NOP bits send a byte containing 0xFF. count, rx_data = spi_xfer(handle, [0xff]) If you want to send 16 NOP bits send two bytes containing 0xFF. count, rx_data = spi_xfer(handle, [...
user avatar
  • 66.5k

Only top scored, non community-wiki answers of a minimum length are eligible