Go to advanced search

by joan
Mon Jun 17, 2019 1:11 pm
Forum: Other projects
Topic: ADS1115 is not detected by i2c
Replies: 5
Views: 108

Re: ADS1115 is not detected by i2c

Two possibilities.

The device is broken.
The device is not connected to the I2C bus.

You need to provide more information if you want us to judge.
by joan
Sun Jun 16, 2019 9:14 pm
Forum: C/C++
Topic: WiringPi / Raw SPI speed issue
Replies: 4
Views: 84

Re: WiringPi / Raw SPI speed issue

The best you can probably do with the Linux SPI driver is pack as much data into each SPI transfer as possible.
by joan
Sun Jun 16, 2019 8:34 pm
Forum: C/C++
Topic: WiringPi / Raw SPI speed issue
Replies: 4
Views: 84

Re: WiringPi / Raw SPI speed issue

Why not just use the bcm2853 library?

The limit you are reaching is probably the number of SPI transfers per second you can do with the Linux SPI driver.
by joan
Sun Jun 16, 2019 11:41 am
Forum: Automation, sensing and robotics
Topic: Send number of pulses with Pigpio
Replies: 18
Views: 402

Re: Send number of pulses with Pigpio

You can only have one wave chain running at a time. You can't use a wave chain and the hardware_PWM function at the same time. You can control multiple GPIO in a single wave chain. It becomes trickier to control two steppers but is possible (software isn't always easy). Can you give any concrete exa...
by joan
Fri Jun 14, 2019 10:53 am
Forum: Python
Topic: A problem with execution frequency
Replies: 4
Views: 132

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: 269

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: 269

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: 269

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: 132

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: 18
Views: 402

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: 18
Views: 402

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: 18
Views: 402

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: 84

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: 18
Views: 402

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: 18
Views: 402

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: 269

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: 18
Views: 402

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: 269

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: 398

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: 162

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

Go to advanced search