Hot answers tagged

11

The glaring issue I see at the moment is that you are forcing polarity on the I and D terms. In general, you are using a lot of sign checks, sign assignments, and conditional programming. None of that belongs in a PID controller. The entire controller should look like: pError = Input - Output; iError = iError + pError*dt; dError = (pError - previousError)/dt;...


4

If you want to have a good balancing, PID loop timing is very important. Standard Raspberry OS, like Raspbian can't guarantee you any precise timing, so once your loop period may be 10ms, once it can be 1s, resulting in a robot to fall. You can try to run some real time operating system on RPi, like FreeRTOS, that would have preemptive capabilities (so a ...


4

analogWrite() does not support a higher range of duty cycle. However the timers on the AVR chip do support higher precision/resolution, so you can bang the registers directly, especially if you don't need to use the rest of the Arduino libraries. I recommend using avr-gcc with avr-libc and avrdude for programming, and let go of Arduino IDE/libraries ...


3

You won't ever get 'exactly' 2042.8878 RPM, so going with your measurement accuracy I will assume you mean 2042.8878 +/- 0.0005 RPM. This is approximately an error of 1 part in 4 million. So let's assume you can set up a timer which counts up to around 4 million and resets, and use that for the PWM. Assuming a two pole motor, 2042 RPM is 34 electrical ...


3

Yes, as this motor is rated for 100amps stall at 12V you should probably be using a motor controller capable of supplying that amount of current. Regarding how to drive the motor, the following may be of use: A voltage regulator cannot be used to drive a motor. What it does is convert a certain voltage to another voltage, for example 5v to 12v. It does ...


3

Digital servos accept the same pulse width and pulse repetition rate as regular analog servos. a b With many RC servos -- both digital and analog -- as long as the "frame rate" (how many times per second the pulse is sent over the control wires to the servo, aka the pulse repetition rate) is in a range of 40 Hz to 200 Hz, the exact value of the frame rate ...


3

Many (perhaps most) radio control transmitters multiplex all the "RC PWM" channels into a single physical wire, using a system called "RC PPM" (radio-control pulse position modulation). (a) (b) (c) (d) (e) (f) (g) Often this "PPM" signal is transferred from the a student's RC transmitter through the buddy box wire to the teacher's RC transmitter. The "...


2

For each motor the output should be: A value at which the power from the 4 motors roughly keeps the quadcopter airborne, for instance 1500ms. Plus or minus the influence of the throttle. For instance with your throttle is in the 0:1 range you could apply 600 * (throttle - 0.5), which will put the motors output in the 1200:1800ms range. Plus or minus the ...


2

Multiple channels are time sliced onto "one-wire". The real wire count is usually three. Typically there is a positive voltage wire (may not be there depending on whether both ends have their own power or not) and always a shared ground wire. Perhaps 40-100 times per second the transmitter broadcast the settings of all controls which map to servos on ...


2

In addition to the RPi, as TobiasK suggests, the Arduino boards have: PWM support; USB support is possible with the addition of an inexpensive USB shield, and; node.js is possible, see: Arduino Experimenter's Guide for NodeJS; A Practical Introduction to IoT using Arduino, Node.js and Plotly, and; Controlling a Motorbot Using Arduino and Node.js to ...


2

I use those RCtimer ESCs and they have always worked great for me, generally thease (and most) ESCs will be looking for 50Hz pwm with a period between 1-2ms, though generally you will not damage them by altering the pwm output. I would recommended cutting the 5v supply on each ESC as they can act funny and even damage themselves when they are all tied to ...


2

Your question kind of boils down to, what is real time ? In the end real time is what you want/specify for your system to work, whether it be hard real time or soft real time. In practice ROS is not hard real-time, but is sufficient enough for most robotics applications. It seems to be that you are trying to take into account the latency between your ...


2

If you want to test the motor, just apply a DC source to it directly rather than using the l298. A 12V car battery is a source you likely have access to that can supply enough current so you can test the torque and speed. Regarding the pwm control, you need to have sensor feedback. Then you will be able to use a control algorithm to, in effect, sense when ...


2

For a similar problem (TT motors can't start the bot rolling on a carpet) I have been toying with the idea of setting up PID control for the angular velocity. If it stays stuck, the integral term will start upping the power. Once it suddenly breaks loose, the differential term will throttle it back. That's the idea, anyway -- someday I'll actually try it. ...


1

After a bit more reading and thinking, I think I’ll answer my own question. I’d like feedback on my logic if you have it. My logic is this: the PWM signal from the MCU is clean (evidenced by the trace when the servo is unpowered) the noise is back EMF from the servo no other device other than the servo needs to receive or read the signal if the signal was ...


1

A PID controller takes an error as input (the encoder ticks) and yields an output whose unit of measurement $O$ (the PWM percentage, usually) is uncorrelated with the unit of measurement $I$ of the input. To this end, the PID gains $K_P$, $K_I$, and $K_D$ do have units of measurement: $[K_P] = \frac{O}{I}$ $[K_I] = \frac{O}{I \cdot s}$ $[K_D] = \frac{O \...


1

Vary the voltage to the servo. If your servo operates full power at 5V at 2.5V it will operate at half speed. If your FPGA can output an analogue signal you could use that to drive the motor speed, otherwise you'll need to put in a DAC to get the analogue signal.


1

Ok I think I'm getting somewhere. Two issues found: When the Micro:bit runs off two AA batteries the 3v output can drop significantly as the batteries run down. The CC3D wasn't liking the even lower voltage. I've now cut a USB cable up and wired it to the ESCs' BEC output at 5v. Much better signal now. When the throttle is raised above the neutral detent, ...


1

It seems that all the code you wrote is in Matlab, and at each cycle it should communicate via the USB port with arduino to turn the pin on or off. This take a lot of time. The fastest solution would be to write the whole algorithm as an Arduino sketch, and only get the current desired frequency via the Serial (USB) connection from Matlab. Matlab would set ...


1

You could also consider the ESP8266. It can be programmed directly with the Arduino Developers Kit (see ESP8266 Arduino). In that sense the developer community overlaps heavily with that of the Arduino family. The way it integrates into the Arduino SDK basically makes it just another flavor of Arduino, although the pinouts aren't physically compatible. The ...


1

You will find only two boards with a larger developer community and one of them is supporting node.js, PWMs and USB-interfaces. It is the raspberry Pi.


1

The PWM signal should not be the limiting factor in achieving the accuracy you seek. For some applications, PWM signals are chopped > 100 kHz, so, given the correct DSP or microcontroller output to create the PWM, you will have as much control over the power going into the motor as you need. Most of the motion control system I've built have had PWM ...


1

An ESC needs to have the throttle limits adjusted before you can use it. While there are many options you can set from a programming menu (see page 4 of this PDF for reference), the throttle adjustment is pretty straightforward: Disconnect the battery from the ESC Send and hold a full throttle signal to the ESC Connect the battery to the ESC Wait 2 seconds ...


1

It doesn't seem like those motors are well matched to your battery. They recommend a 2or3 cell LiPo (7.2V or 11.1V) while you are using a 1 cell LiPo (3.6V). I think you'll find most motors will recommend 2 or 3 cells. With only 1 cell you won't likely get enough lift for a multirotor. Also as a side note, your ESCs should be set to have no cut-off when ...


1

FYI, iRobot has released the spec for the motor interface here: http://www.irobot.com/~/media/MainSite/PDFs/About/STEM/Create/Create_2_Wheel_Hack.pdf


1

The motors get a PWM'd battery voltage which is around 18V. I assume it is safe to run at that voltage at 100% duty cycle. I imagine you could run a higher voltage but you run the risk of burning out your brushes. Lower voltages work fine if your bot is small. I have successfully run a small Roomba wheel module robot off of 8 AA batteries (about 12V).


1

Multiple PWM channels generally aren't shoved into a single wire (Or I've never heard of it). If you need to send multiple data channels over the same wire then using a higher level protocol (such as UART or SPI) would be the way to go. While PWM is technically digital, it isn't like other digital protocols where data can be shoved in and expected to come ...


1

I think people are getting their mS and uS mixed up! Generally it was always between 1mS and 2mS but to get the full range or extended range its said to be 0.8mS and 2.2mS (or 800uS to 2200uS) not 800 to 2200mS (I'm sure it was just a typo but to save confusion). Obviously there needs to be a gap between the pulses so at 300Hz you would have a pulse of 2.2mS ...


1

Specifically about control of motors by PWM, you should learn about the PID controller. The sky's the limit for what you want to learn about. Find a robotics simulator to start playing around with algorithms -- otherwise you will find that you will spend all year building the robot instead. For a mobile robot, motion planning or mapping algorithms would ...


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