Send values from a gyroscope to a drone

The cut in the trace must be deep enough to break the continuity, so yes, deeper the the copper.

Just look at it to be sure. Be sure there is no copper path across your cut.

Do not use your ohm meter beeper to test!

You only need to remove the green stuff on the side where you are attaching your wire.

Try to use the edge of the blade, not the pointy tip. Take your time. If you can get the blade flat against the trace and scrape gently, it may take a few passes.

a7

Ok, so i came back with the results. I took pictures during whole process






Unfortunately this did no noticeable difference to the movements. Why could that happen? Is it maybe because these values should not be filtered through the low pass filter? I really don't have any ideea anymore.

The low pass filtering is essential. If anything, such filtering as you are doing might be inadequate. What value of series resistor are you using between the output of the low pass filter and the point where you are introducing the voltage to the transmitter board?

Post your current code.

I assume you are using a common ground, have assumed that all along, so.

For each potentiometer:

Put your voltmeter on the PCB pad that is its wiper. That is the pin that you disconnected with your cut.

Run your program and check that you DO NOT see any change in voltage.

Move the joystick and check the you DO see the motion reflected in the voltage at the wiper, and that they are plausible.

This is the way to verify that you completely severed the trace - it is very hard to see from your photographs, and at least one looks like it has a bit of continuity.

Do that for both potentiometers.

If you are convinced that your "surgery" has gone well (looks OK mostly!), then post your current code.

Did you remember to map and constrain anything you feed to the microprocessor to be between 0 and the supply voltage for the transmitter board?

If you want to go ahead before I wake up again :wink: you can,

for each potentiometer:

attach a wire to the wiper pin on the potentiometer and
disconnect the wire from the Arduino then connect those together

I hope you see that this will restore the original wiring - even if it makes a little trip off then back onto the board.

This will allow you to test the original function of the joystick. So you can see if you've damaged something, either just now or somewhere along the way.

Adding up everything you have claimed, I am sorry to say I have nothing - your Arduino is making good values, you are feeding them to the correct points having removed what was originally being fed there and so forth.

a7

The value of the resistor in the filter is 220ohm

I did that, it works as intended, left - right and forward - backwarts so the joystick is working fine, and the "surgery" is good.

One thing i did , as far as i understand i know my mega 2560 outputs 5V through the pwm pins, so i basically instead of sending 255 through the pins, i tried sending 168(3,3v) and on another instance 153(3v) on those pwm pins. Don't know if this is the constrain you meant i should do. Other than that the problem is still the same, works on forward / backward (Oy) axis but no movement on left - right(Ox) axis.

I attached my code below.

sketch_may09a.ino (10.4 KB)

Not that resistor. One I advised you to place between the output of the low pass filter and the transmitter board, one for each of the two signals.

So to be clear, instead of just a wire (0 resistance), you include a resistor in series. I suggest trying 100K, and 10K and 4700 ohms, although I do not think this will fix anything.

Congratulations on the surgery! :wink: and being able to test it also.

Yes, if you use analogWrite, calculate a maximum value so you do not exceed 3.3 volts.

Using the map and constrain functions can make this more fool proof. Google for the documentation on their use.

a7

Surprise! I placed 4.700 ohms resistors on the 2 signals , i changed all the code not to exceed 3v and now when i tried the drone movement, left roll works perfectly(front and backwards movement too). When i activate the right roll movement i feel a little movement of the drone itself and also notice 2 of the rotors slowing down, but clearly it is not strong enough to make a right roll. Any ideas?

Why am I not surprised? :wink:

Post the current code. Measure the voltage that is going into the microprocessor (transmitter side of the series resistor) that isn’t working yet, and see if it is making the full range.

a7

CODE:
ardu.ino (10.8 KB)

That code is a horrible mess makes seeing what you are doing very difficult.

In this section

//leftLED
  if ((ypr[2] * 180 / M_PI) < -20)
  {
    digitalWrite(rightLED, LOW);
    digitalWrite(leftLED, HIGH);
//    roll = (ypr[2] * 180 / M_PI);
//    roll = 254;
    roll = 153;
    pitch = 153/2;
  }

  //rightLED
  if ((ypr[2] * 180 / M_PI) > 20)
  {
    digitalWrite(rightLED, HIGH);
    digitalWrite(leftLED, LOW);
//    roll = -(ypr[2] * 180 / M_PI);
//    roll = 0;
      roll = 0;
//      pitch = 153/2;
  }
  //middle 
  if (ypr[2] * 180 / M_PI >= -20 && ypr[2] * 180 / M_PI <= 20)
  {
    digitalWrite(rightLED, LOW);
    digitalWrite(leftLED, LOW);
//    roll = 254/2;
    roll = 153/2;
//    pitch = 153/2;
  }

There seems to be a stray reference to your pitch variable. This is when I stopped looking into it, my brain hurts and it's nap time. This is the kind of thing you should be looking for and finding and fixing.

I am not able to untangle left, right, up, down, neutral, pitch and roll. And right now, you are sending nothing but the 0, middle and maximum values…

All those comments, my goodness, I couldn't read or search within your code for where you were actually doing anything until I stripped them out with my editing tool!

I suggest you write a very smaller and simple program that simply seeks to answer the basic question: can you send analog values to the transmitter board and have them cause the same response as the joysticks.

Just a loop writing values slowly from 0 to 3 volts (169) and back down on one axis holding the other at 85. Over and over.

OBSERVE the voltage going to the microprocessor.

Then do the same thing for the other axis.

I think you will find that you now have a giant software headache. I am quite confident that you have successfully hacked into the transmitter board in terms of hardware, but it should be proven or proceeding will be wasteful of time.

And WTF is this

  teapotPacket[2] = fifoBuffer[0];

all about? You should clean up your code to get rid of all the junk you dragged in from where ever you borrowed it from.

a7

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.