Hot answers tagged

21 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 ...
joan's user avatar
  • 70.4k
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 ...
LinusCDE's user avatar
  • 151
9 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 ...
joan's user avatar
  • 70.4k
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 ...
joan's user avatar
  • 70.4k
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 ...
joan's user avatar
  • 70.4k
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 ...
joan's user avatar
  • 70.4k
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,...
Seamus's user avatar
  • 20.7k
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
joan's user avatar
  • 70.4k
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 ...
joan's user avatar
  • 70.4k
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. ...
joan's user avatar
  • 70.4k
5 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 ...
Chad G's user avatar
  • 1,043
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 ...
joan's user avatar
  • 70.4k
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 ...
joan's user avatar
  • 70.4k
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. ...
joan's user avatar
  • 70.4k
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.
joan's user avatar
  • 70.4k
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 ...
joan's user avatar
  • 70.4k
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 ...
joan's user avatar
  • 70.4k
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 ...
joan's user avatar
  • 70.4k
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) ...
joan's user avatar
  • 70.4k
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 ...
joan's user avatar
  • 70.4k
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 ...
joan's user avatar
  • 70.4k
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 ...
joan's user avatar
  • 70.4k
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, ...
btharper's user avatar
  • 119
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.
ben_nuttall's user avatar
  • 2,431
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 ...
joan's user avatar
  • 70.4k
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 ...
Dmitry Grigoryev's user avatar
3 votes
Accepted

High Impedance state for GPIO

Tri-state output circuitry as used for most computer busses can be set Low, High or HiZ. In fact many circuits actually have 4 states as they can be set as Inputs. The state of a bus (consisting of a ...
Milliways's user avatar
  • 58.2k
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, [...
joan's user avatar
  • 70.4k
3 votes
Accepted

How fast are C & Python libraries

I wrote programs for a number of libraries, both c and python. These just toggle a GPIO pin as fast as possible. NOTE In case anyone misunderstands I am aware this is an artificial test with no real ...
Milliways's user avatar
  • 58.2k
3 votes
Accepted

How to correctly identify the pin addresses in the Pi4J 2.2.1 GPIO API?

There are 3 pin numbering conventions in use on the Pi; BCM, Physical (or Board) and WiringPi. BCM is the native numbering (and is the only convention understood by the SoC). Board numbers correspond ...
Milliways's user avatar
  • 58.2k

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