Hot answers tagged

19

Specifics Looking at the PID Basic Example I think that you just need to instantiate two copies of PID controller, one for each wheel, encoder and pwm: PID leftPID(&InputLeft, &OutputLeft, &SetpointLeft,2,5,1, DIRECT); PID rightPID(&InputRight, &OutputRight, &SetpointRight,2,5,1, DIRECT); Then, in your loop() equivalent, you just ...


13

There's more than one way to do it (TMTOWTDI). There are a several ways to connect 8 analog inputs to an Arduino. Add an analog multiplexer, as georgebrindeiro suggested. Such as: (a), (b), (c), (d), etc. Replace the Arduino with one that has enough analog inputs already built-in. Such as the Arduino Mini with 8 analog inputs, the Arduino Due with 12 ...


10

How Servos Work Based on these details of your question: I just got a kit [...] continuous servos [...] plugged it into the microcontroller Combined with your "Arduino" tag, I'm betting that you are working with hobby (RC) servos modified for continuous rotation. Standard servos work by receiving a pulsed signal with a 20ms period (50Hz). Regular ...


8

When using a PID loop to steer using line following, then your set point will always be the same. You will always want the line to be in the same position with respect to the robot, for instance in the centre of your sensor. So if your line sensor outputs a value from -1 to 1 with 0 being the centre of the sensor, then you will want your set point to be ...


8

Raspberry Pi has only one hardware PWM channel and Linux distribution it runs is not a real time system, so software PWM may be very unstable. You are not guaranteed, that your program will be executed at exact frequency you want, so you will have trouble getting precise timing required to drive servos. If you already have Arduino Mega and SSC-32, I would ...


8

The first thing to realise is that this is not a control problem, this is a planning problem. If you conflate the two, you are making life much more complex than it needs to be. Solution - Motion planning The traditional way to achieve what you want is to have two loops. The outer planning/supervisory loop generates way-points for specific points in time, ...


7

Even very small errors can bother the balancing. Small errors such as: Weight of the quadcopter is unbalanced. One motor is rotating faster/slower than others due to manufacturing or your power-source. Air resistance and wind. Unbalanced propellers due to manufacturing. Strong magnetic forces. You simple can not send the same motor speed to all motors ...


6

It's possible that this isn't working because you have blown your transistor. There are a couple of things which could have blown it: No resistor to limit the base current No diode to protect against back EMF from the motor So you should add a base resistor, and a flyback diode. I always like to add an LED to the Arduino's output too, so that I can see ...


6

Your hardware configuration sounds wrong... your trying to provide all the drive current from the arduino Given your description, your using a bipolar (NPN or PNP) transistor, I'd wire up as: Base: To arduino Collector: Motor -ve (motor +ve to Vcc) Emmitter: Ground Alternatively: Base: To arduino Collector: Vcc Emmitter: Motor +ve (motor -ve to Ground) ...


6

Milk is readily available in plastic bags inside cardboard boxes, as illustrated in the picture below of part of a cafeteria-style milk dispenser. Flow of milk is controlled by pinching off the white plastic tube that comes out of the bottom front edge of the box. To resupply the machine, you get a new box of milk from a larger refrigerator, rip open a tab ...


6

The short answer is yes, but the long answer is that you're approaching the code the wrong way and will need to rewrite things a bit. It looks like you're attempting to read a button and have it flash some LEDs while at the same time having your stepper move back and forth. The problem is your delay(5); commands, which pause the execution of your code. ...


6

It looks like your proportional gain is too high. You seem to be constantly increasing RPM on one motor while locking in the other one to make the system rotate. This isn't a good control strategy as eventually those are going to both saturate and you will lose control. Also as time increases your ability to command the system decreases. So you need a ...


6

Stereo vision and SLAM are pretty heavy algorithms, both in terms of the processing power and RAM required. You can forget about running this on a little microcontroller like an Arduino. These run at tens of MHz, and have only a few KB RAM. At the very least you'll need something running at hundreds of MHz with hundreds of MBs of RAM. You didn't say exactly ...


6

Assuming a constant update of 5Hz, your sample time is (1/5) = 0.2s. Get one position of the target, p1. Get a second position of the target, p2. Target speed is the difference in position divided by difference in time: $$ v = (p_2 - p_1)/dT \\ v = (p_2 - p_1)/0.2 $$ Now predict where they will be in the future, where future is $x$ seconds from now: $$...


5

The issue may not be what micro is the best choice. Note 25 to 50 IO can be expensive if implemented on the micro itself. A ATmega2560 with the most pins is significantly more in price then a 328 or Tiny. Same goes for other chips. All those additional pins may not have the function you need. You can use the micro's SPI (or I2C) port to shift out the IO. ...


5

Whenever you have more signals than appropriate inputs in a digital system, you likely need a multiplexer or simply mux. An M-to-N mux is a circuit that enables you to select which of M input signals you want to output to N mux outputs, usually using digital pins to make that selection. Googling quickly, I found this solution for the Arduino Uno: a Mux ...


5

A Vicon motion capture system system is used in the TED Talk that you referenced. It is similar to a Kinect in that gives the 3D coordinates of any object being tracked within its field of view. Like the Kinect it uses IR, but uses IR reflective balls attached to the quadrotor and the presenters pointer to identify and track objects. Not to mention it is a ...


5

Chris is right, the problem is that the mechanical contact of the switch is bouncing. However, I disagree with his statement that the most elegant solution is polling. Polling is very inefficient for the task of counting how many times a button was pressed, and so I decided to post my own answer for clarification: Interrupts are what you want. Polling is ...


5

The servo.write(angle) function is designed to accept angles from 0 to 180. (The value 180 is significantly larger than 100). Could you tell me where in the Servo documentation you read "100 (motor at full power)", so we can fix that typo? Please change the line int maxspeed=100; /* wrong */ to int maxspeed=180; Also, please run servo.refresh() ...


5

Firstly, this is a stupid nit-picky thing, but neither the Arduino nor RPi are micro controllers. Anyways, to answer your question: Neither of your concerns are really problems. Arduinos come in all kinds of sizes and ALL of them should have enough pins to do what you want. And the RPi can easily be run headless, and programs can be run at startup with ...


5

A Raspberry Pi should be sufficient for the control you intend to do with it. In designing a controller under a full multitasking operating system, like the Linux operating systems that are available for the Raspberry Pi, you have to be careful about the real-time requirements, and if the time share chunk of processor made available to your software will be ...


5

You can drill a hole to match the shaft into whatever it is and either fix it with a setscrew against the flat or glue it. Or you could glue a brass tube (hobby shop) to the shaft if you can find one that fits. The shaft is 5mm diameter, as venny says. Of course it's easier if you have access to a small lathe (such as Sherline or one of the small Chinese ...


5

There are 2 (or 3, depending on how the planned lifetime of the robot is) thing thats you have to consider. Static load: The motors stall (zero revolution) torques have to be able to hold the weight in the robots most unfavorable pose (usually the arm stretched out). You can determine this by static modelling, that involves only an equilibrium of forces for ...


5

Actually, the caster wheel has ideally no effect on the kinematics of the vehicle. In reality there will be some resistance from the caster wheel that does impact the vehicle motion, but we can still ignore it for the sake of designing a control law. Based on the extended discussion in the comments, your sensor can be used to measure the lateral error of ...


5

if you aren't moving, the accelerometer will give you the direction of gravity. if you are moving and hoping to use this orientation data for control you'll need to incorporate at least one more sensor. The extra sensor is needed because you have no method separating the acceleration of gravity and the acceleration of the sensor. The other drawback is that ...


5

For interfacing with a camera, I would recommend the Pi. The reason is that the AVR in the Arduino is an ordinary processor, whereas the Broadcom SoC in the Pi was originally designed for multimedia. Besides the ARM processor, it contains video encoding/decoding hardware that you won't find in the Arduino. Of course, you would need to learn how to use that ...


5

Nobody can tell how much magic smoke is still in the device. You need a magic smoke detector (rarely also referred to as a "voltmeter"), hook one of its contacts up to the pin that should have 5 volts of smoke come out of it and the other to ground. If the detector says there are still 5v, you are probably in luck.


5

The signals to the ESC's using PWM should be sent after the PID algo is done processing the errors. The output calculated from the PID is the PWM value to be sent to the ESC's to actuate the motors in such a way that they move to reduce the error thus obtaining the desired orientation So the right order is: Read RX signal Calculate desired pitch, roll, ...


5

A good choice for sensor fusion with the MPU6050 is a second order complementary filter, which I used for the orientation estimation in a project. The complementary filter is computational cheap and so a good choice for a microcontroller. A paper about the implementation you can find here: http://www.academia.edu/6261055/...


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