i want to control exactly how mush my servo rotate through DMA like pigpio with raspberry pi so i need to create exact number of pulses for servo . is there anyway to create exact number of pulses with DMA like pigpio or servoblaser ? by the way i am using a Delta Servo motor with its driver
closed as too broad by techraf, Aurora0001, Steve Robillard, Jacobm001♦ Feb 26 '18 at 2:56
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
You can use pigpio wave chains to send pulses a precise number of times.
However this is of no use for servos (unless yours has a special interface).
Hobby servos work in one of two ways.
- pulses are sent at 50Hz. The length of each pulse in microseconds (generally in the range 1000-2000) determine the servo horns target angle.
- pulses are sent at 50Hz. The length of each pulse in microseconds (generally in the range 1000-2000) determine the servo horns rotational speed.
The number of pulses sent in total is not relevant.
The following script shows how to use wave chains with Python.
#!/usr/bin/env python import time import pigpio def tx_pulses(pi, GPIO, hertz, num, pulse_len=1): assert hertz < 500000 length_us = int(1000000/hertz) assert int(pulse_len) < length_us assert num < 65536 num_low = num % 256 num_high = num // 256 wf =  wf.append(pigpio.pulse(1<<GPIO, 0, pulse_len)) wf.append(pigpio.pulse(0, 1<<GPIO, length_us - pulse_len)) pi.wave_add_generic(wf) wid = pi.wave_create() if wid >= 0: pi.wave_chain([255, 0, wid, 255, 1, num_low, num_high]) while pi.wave_tx_busy(): time.sleep(0.01) pi.wave_delete(wid) pi = pigpio.pi() if not pi.connected: exit() GPIO=19 pi.set_mode(GPIO, pigpio.OUTPUT) tx_pulses(pi, GPIO, 100, 25) # 25 pulses @ 100 Hz tx_pulses(pi, GPIO, 1000, 250) # 250 pulses @ 1000 Hz tx_pulses(pi, GPIO, 5000, 2391, pulse_len=50) # 2391 pulses @ 5000 Hz pi.stop()