rlambo

  • *
  • 3
Arduino to cc3d
« on: February 01, 2017, 03:55:25 am »
I'd like to be able to connect an Arduino to my cc3d and control its basic flight. My idea being so that I can flip a switch on the controller and the quad goes into "automatic mode" where it uses ultrasonic and ir sensors to position itself in a room. I'm pretty familiar with the arduino ide and code, and think that the best way to do this would be to send pwm signals to the arduino, however could someone send me to some guides and tutorials which could further my understanding of pwm and how I can achieve this?

Tl;Dr how can i "controller/sensors -> Arduino -> cc3d -> move quad"

Mateusz

  • *
  • 808
Re: Arduino to cc3d
« Reply #1 on: February 01, 2017, 07:41:20 am »
What you want is not possible technically. First CC3D samples gyro over SPI bus which is orders of magnitude faster then telemetry uavtalk send to Arduino. Second, flight stabilization code is already implemented very well on CC3D and that sounds like reinventing the wheel and writing your own flight controller. Finally, Arduino and CC3D is pretty much limited in RAM and CPU speed so sonar and navigation features are implemented only for higher end F4 micro controllers (Revo/Sparky2). Sounds like you want to implement already existing feature but using Arduino with least resources... I doubt that's possible or a very good plan ;)

Re: Arduino to cc3d
« Reply #2 on: February 01, 2017, 06:45:36 pm »
Seems technically possible to me, :)  but there are difficult issues.  :(

The Arduino simply uses these sensors (say 5 sensors) to know how far away the floor and walls are.  If it is too close to the left wall, it gives a little right roll.  The amount of right roll would need to be tuned.  Probably a PID.

The real difficulty comes say in a hall when the quad is diagonal and does not get a good distance reading to the walls (so maybe you need more like 9 sensors, 8 for the walls).  Also, having that many sensors running at once, they will interfere with each other.

You could have the quad rotate, and use less sensors.  I recall there is actually a toy copter that does this with one horizontal sensor and one or two vertical sensors.  It spins rapidly and won't hit a wall.

I think this is a good task for vision, but that needs a really big processor, like quad core 2ghz; and lots of scientific code.

Re: Arduino to cc3d
« Reply #3 on: February 01, 2017, 07:01:52 pm »
Here is a promo for that toy.  Watch where the kid gets it to move around by holding his hand up next to it so that it moves away.

What would be really neat is to develop a cheap rotating sensor like this and attach it to a regular quad.  :)


gon

  • *
  • 30
Re: Arduino to cc3d
« Reply #4 on: March 19, 2017, 01:35:48 pm »
Hi, I also would like to control my cc3d board with an arduino. It's not reinventing the wheel, I'm not reimplementing anything. I just want to do one of these two options:

  • Using an already built-in protocol in the librepilot software to send basic commands through a serial port. So my arduino, following this serial protocol, would send basic commands like "set throttle to 1300", "roll 30 degrees", etc. Is there something like this? I've found this: https://librepilot.atlassian.net/wiki/display/LPDOC/UavTalk but with it I only can get the telemetry data, not send commands, right?
  • My second option would be to "replace" the RC receiver with the arduino. So my arduino would write to each channel like it were the RC receiver, being able to control the cc3d board through my arduino. Is it possible?

Thanks!

f5soh

  • *****
  • 4527
    • LibrePilot
Re: Arduino to cc3d
« Reply #5 on: March 19, 2017, 07:28:17 pm »

gon

  • *
  • 30
Re: Arduino to cc3d
« Reply #6 on: March 19, 2017, 07:43:30 pm »