Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Hot answers tagged

9 votes
Accepted

How to use pigpio to control a servo motor with a keyboard?

I'm not sure if anyone will write the code for you. It's too broad a question. You need to acquire a basic understanding of Python programming first, otherwise you'll be forever asking questions. ...
user avatar
  • 66.3k
7 votes

How to make the motion of a servo motor smoother?

The most likely reason is be because you are using software timed servo pulses. Any variation in timing accuracy leads to jitter (servo trembling). I suggest you use hardware timed pulses to drive ...
user avatar
  • 66.3k
6 votes
Accepted

Controlling Servos with a Raspberry Pi

Servos can draw a lot of power so don't expect to be able to reliably power anything but a tiny 9g type servo from the Pi. A servo has three wires, power (+ve), ground (-ve) and control. You can ...
user avatar
  • 66.3k
6 votes
Accepted

Use a servo right from the GPIO without a breakout board

The Pi is the "command and control centre" and it happens to run at 3.3v logic. That is pretty standard for like MCU's like Arduino. You also get 5v versions. Neither is correct or incorrect. You ...
user avatar
  • 17.1k
6 votes
Accepted

Programming servo - What to use?

You can drive as many servos from the Pi as you can find spare gpios. You have to use hardware timed PWM rather than software timed PWM. People who report jitter have been using software timed PWM. ...
user avatar
  • 66.3k
5 votes
Accepted

PWM Control on Raspberry PI

I doubt you'll need to use the PWM capability of gpio 18. There are many ways to provide hardware timed PWM on the Pi on all the user gpios. They are all variations on a theme and use DMA transfers ...
user avatar
  • 66.3k
5 votes

Enable i2c on Ubuntu Mate Raspberry Pi 3

Add the following line to /boot/config.txt dtparam=i2c_arm=on Add the following line to /etc/modules i2c-dev Reboot
user avatar
  • 66.3k
4 votes

Raspberry pi servo motor angle calculation

For the Raspberry Pi Python RPi.GPIO module (which seems to use dutycycle values between 0 and 100). dutycycle = ((angle/180.0) + 1.0) * 5.0 so angle=0 gives 1.0 * 5 (5%), angle=90 gives 1.5 * 5 (7....
user avatar
  • 66.3k
4 votes

Max number of RC motors controlled by Raspberry PI

Simple. The maximum number is 0 (zero). You will need at least a transistor or a relay to drive the DC motor, as the GPIO pins on the rPi do not provide enough power to drive the motor. You will also ...
user avatar
  • 4,993
4 votes
Accepted

How can I get a clock in C accurate enough to control a servo?

Use gettimeofday(), it returns seconds and microseconds. You are unlikely to get satisfactory results for servos using Linux sleeps. There will be glitches. Unless you have a particularly poor ...
user avatar
  • 66.3k
4 votes
Accepted

WiringPi + softPwm calculation to determine duty cycle

I don't use those functions so this is gleaned from the documentation. The basic pulse unit is 100 micros long. The final paramater in softPwmCreate says how long each cycle is in basic pulse units. ...
user avatar
  • 66.3k
4 votes
Accepted

Connect two devices to the same GPIO pin

I don't see why not. Why not try and see? You only connect the control wire to a GPIO. The current is negligible. Personally I always connect the control wire direct to a GPIO for a servo. If you ...
user avatar
  • 66.3k
4 votes

Controlling servo with Raspberry Pi but it doesn't stand still

You are using the wrong tool for the job. Servos require accurately timed pulses. The RPi.GPIO module uses software timing which leads to all sorts of timing jitter, which leads to a twitching servo,...
user avatar
  • 66.3k
4 votes

Raspberry pi PWM stability

You need to use hardware timed pulses for servos. Software timed pulses will lead to jitter and a shorter servo lifetime. Try pigpio, servoblaster, RPIO.GPIO, or similar which use hardware timed ...
user avatar
  • 66.3k
4 votes
Accepted

Stepper Motor Hat v0.1 - pre-soldered version

I didn't get any answers, so I tried the random things method. It seems to work now and I have the addresses needed for the servos from ic2detect. Solution: you MUST boot up the Pi with the HAT ...
user avatar
4 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 ...
user avatar
  • 1,003
3 votes

Controlling a continuous servo with raspberry pi

To answer your general rather than specific question. My pigpio library will allow you to control servos. Download and installation instructions wget abyz.me.uk/rpi/pigpio/pigpio.zip unzip pigpio....
user avatar
  • 66.3k
3 votes

How to run 2 servos with wiringpi2 on Raspberry pi 2

Lucky to see this question, I just spent weeks on controlling two servo (SG90) using WiringPi and programming in C, there're three things that I recommend. 1.Using BCM GPIO instead of WiringPi Pin ...
user avatar
  • 31
3 votes
Accepted

RPI B+ with connected servo is twitching

Servos require accurate and regular pulses. More accurate than software timing will provide. If you want your servo to stop twitching you have several choices. use some add-on hardware to generate ...
user avatar
  • 66.3k
3 votes
Accepted

Controlling a servo and playing sounds

RPIO, like pigpio, servoblaster, piblaster, and possibly others, use DMA to time the servo pulses. In effect the pulses are hardware timed. In contrast to software PWM they suffer little if any ...
user avatar
  • 66.3k
3 votes

trigger cron job from web application

Is it just me or does the thought of allowing a web application to edit cron jobs give you the willies. Here is how I would go about it: Setup a cron job to always run at the frequency you desire. ...
user avatar
3 votes

How can I control an RC servo?

Knowledge of how to do things on the Pi has improved quite a lot in the years since this question was asked. There are at least four ways of generating hardware timed PWM/Servo pulses on the Pi's ...
user avatar
  • 66.3k
3 votes

trigger cron job from web application

Have you looked into GO based groundcontrol daemon at https://github.com/jondot/groundcontrol? It is very light on CPU resource and has a very simple control UI with various buttons for executing ...
user avatar
  • 131
3 votes

Advanced servo control

Servos do not require a motor driver board (the servo itself incorporates a driver board). You just need to supply power via the power and ground wires and a control signal via the control wire. The ...
user avatar
  • 66.3k
3 votes

Connect two devices to the same GPIO pin

Please do not try to drive a servo (or multiple servos) directly from a GPIO pin. You will need to put a transistor in between, and provide a separate power source for the servo, as the RPi might not ...
user avatar
  • 4,993
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 ...
user avatar
  • 66.3k
3 votes
Accepted

Can the GND pin handle 5V?

Ground in a DC circuit refers to either an actual earth ground (i.e., 0 volts vs. anything) or a common ground for different components that may be working at pretty much any voltage relative to it. ...
user avatar
  • 55.6k
3 votes

Servos on Arduino run fine connected to Mac, poorly connected to Raspberry Pi 3

Your GeekDuino is based on ATMega328 which AFAIK doesn't provide any UART flow control. So, if you send too many bytes at once, you will lose some of the bytes and thus risk to get erratic behavior ...
user avatar
3 votes
Accepted

GPIO reset needed for Servo?

If you don't set the mode, it will not work. No, it is not hazardous. No, you do not need to clean up GPIO after the script runs. Indeed, if you do so, the servo will not work properly.
user avatar
  • 66.3k
3 votes

Can a servo motor rotate to a specific angle?

Servo motors are controlled by pulse width modulation (PWM). Specifically, the angular position of the servo is determined by a specific pulse width. The angular position will be approximate and may ...
user avatar
  • 1,109

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