Go to advanced search

by joan
Fri Jun 14, 2019 10:53 am
Forum: Python
Topic: A problem with execution frequency
Replies: 4
Views: 116

Re: A problem with execution frequency

An example using any spare GPIO. This uses a command line utility called pigs. You can do the same with pigpio Python calls. sudo pigpiod # start the pigpio daemon pigs pfs 4 1000 # set GPIO 4 to use a frequency of 1000 pigs p 4 128 # set GPIO 4 to use a dutycycle of 128 (out of 255). http://abyz.me...
by joan
Fri Jun 14, 2019 7:55 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: WiringPi interfacing with Infineon pressure sensor dps310 not working
Replies: 11
Views: 240

Re: WiringPi interfacing with Infineon pressure sensor dps310 not working

It is simpler than that. Most SPI devices reset their state machine when their chip select changes level. The SPI hardware asserts/deasserts chip select for each SPI transfer.
by joan
Thu Jun 13, 2019 7:45 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: WiringPi interfacing with Infineon pressure sensor dps310 not working
Replies: 11
Views: 240

Re: WiringPi interfacing with Infineon pressure sensor dps310 not working

Instead of

Code: Select all

wiringPiSPIDataRW(CHANN, &buffer[0], 1);
wiringPiSPIDataRW(CHANN, &buffer[1], 1) ;
try

Code: Select all

wiringPiSPIDataRW(CHANN, &buffer, 2);
by joan
Thu Jun 13, 2019 4:55 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: WiringPi interfacing with Infineon pressure sensor dps310 not working
Replies: 11
Views: 240

Re: WiringPi interfacing with Infineon pressure sensor dps310 not working

In your code you have buffer[0]. The expected parameter is an address so that should be &buffer[0] or buffer.
by joan
Thu Jun 13, 2019 10:55 am
Forum: Python
Topic: A problem with execution frequency
Replies: 4
Views: 116

Re: A problem with execution frequency

How accurate does the frequency need to be? You need to adjust the sleep time to account for all the delays in the code (including the sleep itself). Change it until you get an average of a kHz. If that is not good enough you will need to use a hardware PWM pin or something like (my) pigpio which ca...
by joan
Wed Jun 12, 2019 8:23 am
Forum: Automation, sensing and robotics
Topic: Send number of pulses with Pigpio
Replies: 15
Views: 304

Re: Send number of pulses with Pigpio

That seems okay, but it should have worked if you set it before and after the call to wave_chain. It wouldn't work if you set it while the wave_chain is running. Note that wave_chain returns control to Python as soon as it is started. The wave_chain can take a long time to complete (e.g. 60000 secon...
by joan
Tue Jun 11, 2019 9:46 pm
Forum: Automation, sensing and robotics
Topic: Send number of pulses with Pigpio
Replies: 15
Views: 304

Re: Send number of pulses with Pigpio

You don't need an additional delay in the wave chain (the 255 2 command) as the wave already has a delay (the off period).

Say you want to loop REPEAT times (I assume 1 <= REPEAT <= 65535).

Then set x = (REPEAT&255) and y = ((REPEAT>>8)&255) then

255 1 x y will loop REPEAT times.
by joan
Tue Jun 11, 2019 1:35 pm
Forum: Automation, sensing and robotics
Topic: Send number of pulses with Pigpio
Replies: 15
Views: 304

Re: Send number of pulses with Pigpio

You really need to use a wave chain. It can handle pulse loops. The way you are doing it is fine but you do hit a resource limit (each pulse uses up some limited memory).
by joan
Tue Jun 11, 2019 12:27 pm
Forum: General discussion
Topic: Magnetic Encoder Rotary Incremental and Raspberry Pi
Replies: 1
Views: 83

Re: Magnetic Encoder Rotary Incremental and Raspberry Pi

If you google rotary encoder and raspberry pi you should find hundreds of examples.
by joan
Mon Jun 10, 2019 5:17 pm
Forum: Automation, sensing and robotics
Topic: Send number of pulses with Pigpio
Replies: 15
Views: 304

Re: Send number of pulses with Pigpio

That was a command line example using the pigs utility. You enter those commands in a terminal window.

You need to translate those commands into the appropriate Python (i.e. wave_add_generic, wave_create, wave_chain etc.).
by joan
Mon Jun 10, 2019 4:31 pm
Forum: Automation, sensing and robotics
Topic: Send number of pulses with Pigpio
Replies: 15
Views: 304

Re: Send number of pulses with Pigpio

Have a look at

Code: Select all

G=18

pigs m $G w # set GPIO in mode OUTPUT

pigs wvag $((1<<G)) 0 10 0 $((1<<G)) 615 # 10 us on / 615 us off

pigs wvcre # create wave (first will have id 0)

pigs wvcha 255 0 0 255 1 200 0 0 # send wave id 0 200 times
by joan
Mon Jun 10, 2019 4:13 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: WiringPi interfacing with Infineon pressure sensor dps310 not working
Replies: 11
Views: 240

Re: WiringPi interfacing with Infineon pressure sensor dps310 not working

Have you rebooted? Otherwise the GPIO will be in the wrong mode.

If it still doesn't work your wiring is likely to be wrong.
by joan
Mon Jun 10, 2019 3:54 pm
Forum: Automation, sensing and robotics
Topic: Send number of pulses with Pigpio
Replies: 15
Views: 304

Re: Send number of pulses with Pigpio

If you want to send a specific number of precisely timed pulses you need to use a wave chain. Basically you create a wave with a single pulse (e.g. 5µs on 20µs off) and send that 200 times with a wave chain. The maximum pulse rate is 500kps (1µs on, 1µs off). What pulse do you want, which GPIO, and ...
by joan
Mon Jun 10, 2019 3:42 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: WiringPi interfacing with Infineon pressure sensor dps310 not working
Replies: 11
Views: 240

Re: WiringPi interfacing with Infineon pressure sensor dps310 not working

You are mucking about with the SPI GPIO modes. Why?

You have taken them out of SPI mode and made them ordinary GPIO in input and output mode. You need to leave them in the mode set by the kernel SPI driver.
by joan
Sat Jun 08, 2019 9:44 pm
Forum: Troubleshooting
Topic: L298n frying my pi
Replies: 18
Views: 386

Re: L298n frying my pi

It is not clear how the GPIO are connected to the motor driver board. What are the connected pins labelled as at the motor driver board? What is connected to the enable pins?
by joan
Fri Jun 07, 2019 6:49 am
Forum: Automation, sensing and robotics
Topic: Issue with ultrasonic sensor
Replies: 5
Views: 140

Re: Issue with ultrasonic sensor

Power from 5V. You need to use a voltage divider on the echo line to drop 5V to 3V3.

A clear photo and description of the connections between Pi and sensor will be useful.

I also suggest piscope so you can check the trigger/echo lines.

http://abyz.me.uk/rpi/pigpio/piscope.html
by joan
Mon Jun 03, 2019 1:31 pm
Forum: Graphics, sound and multimedia
Topic: GPCLK0, trouble setting some frequencies
Replies: 10
Views: 465

Re: GPCLK0, trouble setting some frequencies

While you are at it you might as well try fixed mash of 2 and 3. They may move the harmonics.
by joan
Sun Jun 02, 2019 6:39 am
Forum: Python
Topic: controlling number of times loop is executed?
Replies: 12
Views: 593

Re: controlling number of times loop is executed?

What error?
by joan
Sat Jun 01, 2019 1:31 pm
Forum: Python
Topic: Trying to make a speedometer using hall effect sensor and a neodym magnet
Replies: 7
Views: 176

Re: Trying to make a speedometer using hall effect sensor and a neodym magnet

5cm sounds quite a distance. I only have experience with the OH3144E (10 for a couple of GBP). I have used them with Neodymium N35 grade and they were fine.

See viewtopic.php?f=37&t=90243 for an idea of the separation I used between magnet and sensor.
by joan
Sat Jun 01, 2019 7:39 am
Forum: Python
Topic: How to get a very accurate delay from 1 milli second in python
Replies: 3
Views: 631

Re: How to get a very accurate delay from 1 milli second in python

Python on raspberry pi is never precise to do perfectly timed stuff in any manner, For that use any microcontroller like arduino if you have high level stuff, do it on raspberry pi That is not true (in the literal sense no machine can do perfectly timed stuff). The situation is more nuanced as poin...

Go to advanced search