Go to advanced search

by joan
Fri Feb 23, 2018 9:32 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Reading Values from 12-bit ADC with Python with I2C
Replies: 4
Views: 130

Re: Reading Values from 12-bit ADC with Python with I2C

It may be helpful to see the read word before you have extracted the value. The byte order may be reversed.
by joan
Fri Feb 23, 2018 1:23 pm
Forum: Troubleshooting
Topic: That "oops" moment of GPIO dyslexia
Replies: 4
Views: 94

Re: That "oops" moment of GPIO dyslexia

You should be able to SSH in to the Pi once you have removed the problem wiring. I doubt enough current would flow to trigger the polyfuse.
by joan
Thu Feb 22, 2018 4:44 pm
Forum: Python
Topic: Pigpio HX711.py will hang
Replies: 7
Views: 159

Re: Pigpio HX711.py will hang

I haven't forgotten but I can't find my HX711. I'm using the opportunity to try to get all my components into some sort of order. Hopefully I'll find the HX711 during that process.
by joan
Thu Feb 22, 2018 8:31 am
Forum: C/C++
Topic: c++ GPIO interrupt approach
Replies: 20
Views: 407

Re: c++ GPIO interrupt approach

Try running this module at the same time to see if the results compare.

http://abyz.me.uk/rpi/pigpio/examples.h ... ead_PWM_py
by joan
Wed Feb 21, 2018 10:53 pm
Forum: C/C++
Topic: c++ GPIO interrupt approach
Replies: 20
Views: 407

Re: c++ GPIO interrupt approach

... The only aspect of this method which I'm not particularly confident with are the DMA components. Could I replace tick with gettimeofday(), and levels with a simple read of the /gpioX/value file? I've traced back systReg and gpioReg through the source but I can't quite see how I'd make that work...
by joan
Wed Feb 21, 2018 9:27 pm
Forum: C/C++
Topic: c++ GPIO interrupt approach
Replies: 20
Views: 407

Re: c++ GPIO interrupt approach

That all sounds great joan, thank you very much. To clarify, will I (a newcomer to c/c++) be able to piece together your gpioSetAlertFunc in my application without using pigpio itself? As mentioned in my original post, I'm looking to build a solution which is device agnostic (as much as possible), ...
by joan
Wed Feb 21, 2018 12:10 pm
Forum: C/C++
Topic: c++ GPIO interrupt approach
Replies: 20
Views: 407

Re: c++ GPIO interrupt approach

Thanks joan. That all sounds most excellent! So by default that is about 24000 samples in the DMA buffer then? The default sampling rate is 200 thousand per second (5µs) so 0.12 * 200000, so yes, 24000. The user process only goes through the new samples so typically 200 samples per check. Again typ...
by joan
Wed Feb 21, 2018 11:05 am
Forum: C/C++
Topic: c++ GPIO interrupt approach
Replies: 20
Views: 407

Re: c++ GPIO interrupt approach

Latency between interrupt and user space code running is one thing. Having your process sleeping because the kernel has scheduled another task else is something else. What happens when your process is not running for 5, 10 or more milliseconds and half a dozen state changes happen on the pin during...
by joan
Wed Feb 21, 2018 8:18 am
Forum: C/C++
Topic: c++ GPIO interrupt approach
Replies: 20
Views: 407

Re: c++ GPIO interrupt approach

For accuracy you would be better off with http://abyz.me.uk/rpi/pigpio/cif.html#gpioSetAlertFunc You sacrifice half a millisecond of latency for several orders of magnitude more accuracy. Remember the alerts are timestamped when the GPIO level changes, not when they are first seen by your user proce...
by joan
Tue Feb 20, 2018 12:01 pm
Forum: General discussion
Topic: i2c commands are not working without sudo over ssh
Replies: 2
Views: 101

Re: i2c commands are not working without sudo over ssh

Presumably i2cdetect is not in the root path.

Why not add the Pi user to the i2c group? You then don't need to use sudo.

sudo adduser pi i2c
by joan
Tue Feb 20, 2018 11:07 am
Forum: Beginners
Topic: What’s the main differences between Gpiozero and RPIO Modules
Replies: 2
Views: 113

Re: What’s the main differences between Gpiozero and RPIO Modules

The first GPIO Python module was RPi.GPIO. A second Python module called RPIO.GPIO was then created which added some extensions to RPi.GPIO. A third Python module called wiringPi utilised the wiringPi C library. A fourth Python module called pigpio utilised the pigpio C library. gpiozero was created...
by joan
Tue Feb 20, 2018 8:43 am
Forum: Automation, sensing and robotics
Topic: HC-SR04 integrated with MCP23017 could not detect echo
Replies: 4
Views: 171

Re: HC-SR04 integrated with MCP23017 could not detect echo

Is the MCP23017 still visible on bus 1 at address 0x20?

Have you told the script to use the same bus/address?
by joan
Mon Feb 19, 2018 9:58 pm
Forum: Automation, sensing and robotics
Topic: HC-SR04 integrated with MCP23017 could not detect echo
Replies: 4
Views: 171

Re: HC-SR04 integrated with MCP23017 could not detect echo

Have you done some timings to check that you can send those I2C commands fast enough to catch the echo?

Here is some code which worked for me http://abyz.me.uk/rpi/pigpio/examples.h ... c_sonar_py

You might be able to adapt it to your needs.
by joan
Mon Feb 19, 2018 6:52 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: i2c devices not recognized when using breadboard
Replies: 4
Views: 219

Re: i2c devices not recognized when using breadboard

How long is the ribbon cable? Is it back to front? A photo would help.
by joan
Mon Feb 19, 2018 6:29 pm
Forum: Python
Topic: Pigpio HX711.py will hang
Replies: 7
Views: 159

Re: Pigpio HX711.py will hang

I can't see anything obvious.

I'll need to find my HX711 and hook it up. Not sure how long this will take.
by joan
Mon Feb 19, 2018 5:46 pm
Forum: Python
Topic: Pigpio HX711.py will hang
Replies: 7
Views: 159

Re: Pigpio HX711.py will hang

As I say, if you post the complete code that you are using I will have a look. I am not going to speculate though.
by joan
Mon Feb 19, 2018 4:12 pm
Forum: Python
Topic: Pigpio HX711.py will hang
Replies: 7
Views: 159

Re: Pigpio HX711.py will hang

Could you post the complete amended code which hangs. If I get some time I'll give it a go and see if I can replicate the issue.

Which version of pigpio are you using? (pigs pigpv).
by joan
Mon Feb 19, 2018 10:59 am
Forum: Beginners
Topic: Signal counter measuring
Replies: 2
Views: 97

Re: Signal counter measuring

May I ask why you just don't use a purely analog circuit? It seems redundant to digitize an analog signal and then convert the digital signal to analog.
by joan
Mon Feb 19, 2018 8:28 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Servoblaster compatibility with latest May Jessie
Replies: 32
Views: 3813

Re: Servoblaster compatibility with latest May Jessie

pigpio is an alternative to servoblaster for driving servos. Use one or the other. Using both will confuse both unless you start them up with the proper options. Post a photo or a link to a photo of your Pi <-> servo connections. The most likely problem is you are using the wrong GPIO (there are sev...
by joan
Sun Feb 18, 2018 10:37 pm
Forum: Troubleshooting
Topic: I2C Write repeated Read
Replies: 4
Views: 122

Re: I2C Write repeated Read

In what way is the returned data invalid? The read I2C block data command should issue the sequence you want.
by joan
Sun Feb 18, 2018 10:12 pm
Forum: Troubleshooting
Topic: I2C Write repeated Read
Replies: 4
Views: 122

Re: I2C Write repeated Read

So you want

start condition

address+write bit
write byte

start condition

address+read bit
read byte
read byte
read byte

stop condition

I don't think that is possible with SMBus. The closest is probably the unofficial SMBus read I2C block data command. I'd try that.
by joan
Sun Feb 18, 2018 11:57 am
Forum: C/C++
Topic: Sampling Loop coded in C is inaccurate
Replies: 26
Views: 749

Re: Sampling Loop coded in C is inaccurate

I don't get. Assuming pigpio can capture and time stamp samples, from SPI or whatever, at 5ms intervals and alert my process, surely I still have the problem that my process may not be scheduled to run for far longer than that quite often? At which point my iteration loop misses its deadline. If I ...
by joan
Sun Feb 18, 2018 10:58 am
Forum: C/C++
Topic: Sampling Loop coded in C is inaccurate
Replies: 26
Views: 749

Re: Sampling Loop coded in C is inaccurate

The devil is in the detail. Strangely enough pigpio will read accurately timed SPI samples by using a bit bang technique. Needs some programming experience.

viewtopic.php?f=44&t=71089
by joan
Sun Feb 18, 2018 9:49 am
Forum: C/C++
Topic: Sampling Loop coded in C is inaccurate
Replies: 26
Views: 749

Re: Sampling Loop coded in C is inaccurate

No, I have misinterpreted what you are trying to do.

pigpio will not help you run a processing loop at regular intervals. It will sample the GPIO at regular intervals.
by joan
Sun Feb 18, 2018 9:01 am
Forum: C/C++
Topic: Sampling Loop coded in C is inaccurate
Replies: 26
Views: 749

Re: Sampling Loop coded in C is inaccurate

The underlying library is written in C. http://abyz.me.uk/rpi/pigpio/cif.html If you want accurate times you must use alerts (http://abyz.me.uk/rpi/pigpio/cif.html#gpioSetAlertFunc) rather than interrupts (http://abyz.me.uk/rpi/pigpio/cif.html#gpioSetISRFunc). Alerts will be accurate to about 10 mic...

Go to advanced search