Hot answers tagged

11

This tutorial I gave at the Embedded Linux Conference tries to answer the questions, providing links to more detailed description of the topics addressed and using the practical example of driving a 4WD drone, where an Arduino Mini Pro acts as slave and controls the 4 independent wheels. The original document can be found here. Note: This answer is ...


3

An ESC is an Electronic Speed Controller. It's purpose is to control the speed and direction of a Brushless DC Motor. A Bushless DC Motor ("BLDM") is not like other motors. You can't just provide it power and it will spin. Instead it is made up of three (or multiples of three) electromagnets along with a permanent magnet on the rotor. Energising these ...


2

No, you need to use PWM in order to control the ESCs which, in turn, control the motors. If you need more PWMs you might add daugtherboard based on other ICs which might provide additional PWM outputs via I2C or serial interface. In some non critical conditions (ESCs are critical for a quadcopter) you can simulate PWM by switching a plain digital pin HIGH ...


2

Each unique variable you want control over should have a single pid loop, and each loop should only ever stretch across one "order" of time. For example, to control the craft's roll rate, you should have one PID loop that takes the target roll rate and outputs the controlled roll torque value, which gets transformed somehow into motor accelerations. The ...


2

Probably a bit late but your code has some important parts commented out such as (in order): delay(1000); ESC1.write(angle); arm(); Once you add those to the next lines the program should work and the esc shouldn't just beep and actually get the motor to spin


2

Like the previous answer stated, you should be using a 20-25c battery (can discharge up to 25A). I don't know exactly how much a 9V draws, but it definitely can't supply more than an AMP. Your motor pulls much more than 1 amp. Get yourself a nice LiPo from hobbyking.com, maybe an 8.4v or 11.1v The ESC beeping could be telling you it can't draw enough Amps ...


2

There are pre-built binaries for many flight controllers. http://firmware.ardupilot.org/ lists out the different ardupilot builds (arducopter, arduplane, etc.) and by clicking on them , you can see the different versions, then the different builds per version. This document goes into more detail on the file structure they use for pre-built binaries.


2

There is always a chance of picking up the net for a split second, but most likely, you will never accurately detect the net with this type of sensor. There is too little to detect.


2

Yes you could but you will have to use a motor driver or else the motors will not be able to get enough power and try using arduino micro or an esp32 if you want to use it with Bluetooth which will also help you to keep the weight down.


1

There is no need for a SPDT switch. A SPST works just as well. If you have a SPDT switch with 3 positions (pole 1 closed, open, pole 2 closed) you can use it to activate one pin or the other, or neither. Let's pretend your switch is an SPST. Ignore one of the poles (pole 2, say.) Connect a digital pin to pole 1. connect the common (center) pin to ground. Set ...


1

Inspecting your code, it does not appear you are compensating the raw magnetometer values for soft and hard iron effects. These terms roughly refer to adjusting the range and magnitude of each of the individual magnetometers (X, Y and Z). Some magnetometer manufactures allow writing these compensation values into the chip. Even then the developer and user ...


1

That was happening with me too. Check if the weight distribution of the drone is perfect. Lets say if the battery is placed a little more to one side of the frame than the other side, your drone will try to hover from the other side. The center of gravity should be taken care of when the drone is not balancing properly.


1

For stability and tuning you need to make the adjustment cycle time compatible with the physical system. How fast does this adjustment code get called relative to how fast the physical system oscillates? Without that under control, tuning the gains will be difficult, particularly for krI and krD. For instance, if you are updating every millisecond, and it ...


1

You should be using digitalRead(8) instead of digitalWrite(8, HIGH). Your sketch is also missing some curly brackets. void setup(){ pinMode(4, OUTPUT); pinMode(12, OUTPUT); pinMode(11, OUTPUT); pinMode(10, OUTPUT); pinMode(9, OUTPUT); pinMode(8, INPUT); } void loop(){ if(digitalRead(8) == HIGH){ digitalWrite(12, HIGH); digitalWrite(11,...


1

This line of code is the source of your problem. void loop() { if (digitalWrite(8, HIGH)); If expressions expect a boolean (true/false), but if you check the documentation for digitalWrite(), you’ll see it returns “Nothing” (i.e. void). You need to use digitalRead() to check the current state of the pin.


1

The beeping is actually from the ESC. I believe that this model needs to be properly configured (which you can do using the Arduino - refer to the user manual or here) before it can be used. Some kits come with it preconfigured but since you seem to have possibly purchased it individually you need to configure it yourself. Also it doesn't appear to be that ...


1

EDIT this answer explains how you can put a Arduino between a (1 ppm pin per channel) RC receiver and a RC receptor. This allows for smart features (like autonomous control with RC overrule, or sensor based corrections,..) It seems it is not the question of op. What you want is easy but there are some pitfalls. I can make a long story short by these links ...


1

I can offer general advice without reference to specific implementations. By driving the Arduino pins when it is powered off you are potentially exceeding it's maximum rated specifications for voltage on any ping, and possibly for current into a pin, and you risk damaging it. When the Arduino is powered down its Vdd pin and power supply rail will be at ...


1

Here are just some clarifications for you: Signal pins don't have to be connected to PWM pins. AFAIK, any digital pins should work. All grounds togheter! Glad you got that right! Connect VCC of ESCs directly to the power supply. Connect power supply to VIn of Arduino (not 5V because you are going to grill it!) Uptdate Yes, you can probably solder all the ...


1

You need resistors where that article puts them, otherwise you could brownout the whole thing. You may be able to get away without a PCB, at the cost of reduced stability. Find or borrow the three resistors needed for the project, and then I recommend that you order both a large pack of 1% resistors as well as a variety of PCBs when you are able to.


1

I will give a generic C-answer to it: 1) figure out what parameters / variables involved in a PID control loop; 2) structure those parameters / variables into a struct; 3) pass that struct to a common set of PID algorithm. 4) done. with this approach, the algorithm is only implemented once and the can be used / reused as many times as you want.


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