Riz

  • *
  • 17
How can I add sensors on CC3D board?
« on: February 02, 2016, 01:47:14 pm »
Hello I have plan to add some sensors (GPS, temperature, distance measurement etc.) in my CC3D board. I looked through the websites and found that the only way to connect sensors with the board is through serial communication. The serial cable is currently unavailable here so I am planning to order it online. But how I can go through the sensor setup (in the software)? Also, how can I get the readings of the sensor? On my transmitter or it will be shown up on the software itself? By the way, I can definitely not attach the miniUSB all time with my laptop to get the output from sensors! Any help would be appreciated.

Mateusz

  • *
  • 808
Re: How can I add sensors on CC3D board?
« Reply #1 on: February 02, 2016, 05:04:46 pm »
Hello I have plan to add some sensors (GPS, temperature, distance measurement etc.) in my CC3D board. I looked through the websites and found that the only way to connect sensors with the board is through serial communication. The serial cable is currently unavailable here so I am planning to order it online. But how I can go through the sensor setup (in the software)? Also, how can I get the readings of the sensor? On my transmitter or it will be shown up on the software itself? By the way, I can definitely not attach the miniUSB all time with my laptop to get the output from sensors! Any help would be appreciated.

CC3D won't be able to use full-navigation, because of memory and cpu cycles limitations of the F3 micro-controller. I assume here that your intention is to  use those peripherials to get coordinates in case of losing an aircraft and just general information about conditions, that is fine.

It won't be shown on the transmiter, as it speaks probably different protocol than CC3D. One can connect OPlink modem to cc3d, and use another oplink modem connected to laptop while flying, to get telemetry data in GCS on laptop. Just a pair of OPlink modems will do the job.
However, Revolution board has build-in OPlink module, F4 microcontroller and can do navigation if calibrated properly (lots of fun to get it right) ;)


Riz

  • *
  • 17
Re: How can I add sensors on CC3D board?
« Reply #2 on: February 03, 2016, 06:49:42 am »
Thanks a lot for your kind response. Is there any way I can program the F3 microcontroller inside CC3D board? For example, using cleanflight? Let me know please, thanks.

Mateusz

  • *
  • 808
Re: How can I add sensors on CC3D board?
« Reply #3 on: February 03, 2016, 08:33:51 am »
Thanks a lot for your kind response. Is there any way I can program the F3 microcontroller inside CC3D board? For example, using cleanflight? Let me know please, thanks.

As far as I know official cleanflight does not support nagivation, what it does is only stabilization. It is targeted for boards with less memory such as CC3D.
Of course there are some forks that attempt to implement nagivation anyway, but it's difficult without approximations and to do it properly on such a limited memory device.
Don't get me wrong, it works great as a stabilization for racers, but hardware is just not meant for nagivation or autonomous flight. Usually what people do is they buy Revo if they want full-navigation or buy CC3D if they want just stabilization in a racer type aircraft. Although I am flying my CC3D on big 450mm frame :)

You can flash CC3D with other firmware, but you would need to solder SBL pads and use serial-usb adapter. I tried cleanflight only for a short time, so I can't help with that, I am not using it anymore and I don't have experience with that.

Riz

  • *
  • 17
Re: How can I add sensors on CC3D board?
« Reply #4 on: February 03, 2016, 08:57:45 am »
Alright! Thanks a lot sir for your explanation. Still a lot of things to learn as a beginner. Actually my purpose is more related to data analysis, telemetry, sensors etc. I don't think so CC3D is a good choice for me. Yeah I learnt how to fly a quadcopter using this board but that's all. If I want to develop something, I think it's time to buy Revolution or something else!

Mateusz

  • *
  • 808
Re: How can I add sensors on CC3D board?
« Reply #5 on: February 03, 2016, 10:55:51 am »
Alright! Thanks a lot sir for your explanation. Still a lot of things to learn as a beginner. Actually my purpose is more related to data analysis, telemetry, sensors etc. I don't think so CC3D is a good choice for me. Yeah I learnt how to fly a quadcopter using this board but that's all. If I want to develop something, I think it's time to buy Revolution or something else!

I am also learning and I see it like this
  • Micro-controller - Has low latency input/output critical for controlling motors, reading fast sensors without delay, processing that data and sending it back to perform very fast stabilization. Also micro-controller is real-time and reboots very quickly, so if something crashes it will reboot in flight and nothing bad happens.
  • Processor - Has higher latency, so more delay when communicating with external devices, isn't running real-time, but more horse-power and memory to perform heavy calculations for complex algorithms, such as those for avoiding obstacles, flying through objects, environmental mapping etc... Processor also takes forever to reboot so if something would went wrong in flight it could be dangerous.

Best in my opinion is combining two independent (not in the same chip) processing units. They have to be independent, having their own memory and booting independently.
In this scenario Revolution running LibrePilot could be connected to micro Linux computer. This way you would get best of two worlds..

Riz

  • *
  • 17
Re: How can I add sensors on CC3D board?
« Reply #6 on: February 03, 2016, 11:14:18 am »
Great! I was thinking to add Arduino UNO with CC3D though, but I don't think it's quite possible to assembly the micro controller board with the CC3D flight controller. Also programming the STM32 is quite difficult (inside CC3D board). I can get the raw data only in the LibrePilot software but again, some sensors or some other functionalities might not work as per my requirement. I guess ArduPilot has more functionalities for drone developers, who really want to do something new.

Riz

  • *
  • 17
Re: How can I add sensors on CC3D board?
« Reply #7 on: February 03, 2016, 11:20:25 am »
In this scenario Revolution running LibrePilot could be connected to micro Linux computer. This way you would get best of two worlds..
You mean Revolution could be connected to Raspberry Pi then? Damn! It's gonna be awesome! But again it's quite difficult to program CC3D... I guess it's same for Revolution too :P

Mateusz

  • *
  • 808
Re: How can I add sensors on CC3D board?
« Reply #8 on: February 03, 2016, 11:39:56 am »
Great! I was thinking to add Arduino UNO with CC3D though, but I don't think it's quite possible to assembly the micro controller board with the CC3D flight controller. Also programming the STM32 is quite difficult (inside CC3D board). I can get the raw data only in the LibrePilot software but again, some sensors or some other functionalities might not work as per my requirement. I guess ArduPilot has more functionalities for drone developers, who really want to do something new.

Arduino UNO has retro AVR 8 bit micro-controller (Atmega 328) running at 20Mhz, CC3D has way more modern and powerful ARM 32bit processor (STM32F103CB) running at 72Mhz.
I never used ArduPilot, besides installing their GCS and removing it... so I don't know.

I don't think Arduino is meant to be used as flight-controller, it has a different purpose. Arduino is targeted for letting people play with electronics and learn it. It has some but not all features exposed in a user-friendly library so you can get a taste of programming micro-controller. But it is not always optimal or most efficient way of coding that you can see in professional products.

Programming any more professional flight-controller that is not based on Arduino will be more difficult, but not as difficult as you think. The code only looks scary at beginning, but if you learn the principles of programming micro-controllers then it's easy.

Mateusz

  • *
  • 808
Re: How can I add sensors on CC3D board?
« Reply #9 on: February 03, 2016, 11:59:50 am »
In this scenario Revolution running LibrePilot could be connected to micro Linux computer. This way you would get best of two worlds..
You mean Revolution could be connected to Raspberry Pi then? Damn! It's gonna be awesome! But again it's quite difficult to program CC3D... I guess it's same for Revolution too :P

Yes, they can be connected together in many ways. Easiest is by USB cable, since RPi acts as standalone computer and has USB host controller, so it will detect Revolution or CC3D board when you connect it. When you set telemetry on USB, Revolution will send/receive telemetry data over USB. You can also use other channels such as serial on flexi port to communicate.
I know someone wrote python code to parse telemetry data send by Revo, but I don't have a link at the moment.

I am not sure if GCS runs on RPi,  but its a GUI that just sends/receives UAV objects what is called telemetry. It's a both way communication, you can change Revo settings and even control it with that protocol. Someone wrote somewhere python code handling UAV objects send by Revo on Linux, but I dont have a link now... maybe you will need to parse it yourself.
Communication works though, it's just a matter of parsing it and handling it I think.

Riz

  • *
  • 17
Re: How can I add sensors on CC3D board?
« Reply #10 on: February 03, 2016, 12:10:28 pm »
In this scenario Revolution running LibrePilot could be connected to micro Linux computer. This way you would get best of two worlds..
You mean Revolution could be connected to Raspberry Pi then? Damn! It's gonna be awesome! But again it's quite difficult to program CC3D... I guess it's same for Revolution too :P

Yes, they can be connected together in many ways. Easiest is by USB cable, since RPi acts as standalone computer and has USB host controller, so it will detect Revolution or CC3D board when you connect it. When you set telemetry on USB, Revolution will send/receive telemetry data over USB. You can also use other channels such as serial on flexi port to communicate.
I know someone wrote python code to parse telemetry data send by Revo, but I don't have a link at the moment.

I am not sure if GCS runs on RPi,  but its a GUI that just sends/receives UAV objects what is called telemetry. It's a both way communication, you can change Revo settings and even control it with that protocol. Someone wrote somewhere python code handling UAV objects send by Revo on Linux, but I dont have a link now... maybe you will need to parse it yourself.
Communication works though, it's just a matter of parsing it and handling it I think.
Alright I will look for it. Nice to know that RPi can be connected with CC3D or Revolution board. So I have got a few more questions:
1. Still I need to get the OpLink modem for it right? One is for RPi and another one is for the Drone? (To get the telemetry data)
I think serial communication is much better than USB? As the drone will fly, so definitely I cannot connect with an USB to a RPi all the time. So I need to attach the RPi with CC3D via serial communication. So here comes-
2. To read the telemetry data, I need a monitor that might be connected with the RPi via LAN (using PuTTY). So is there any way that I can use a wifi dongle in the CC3D board?

I think it has both pros and cons. Like, wifi might not be stable all the time. So if the drone exceeds the limit, I cannot get data anymore!
Please share your thoughts about it :)

Mateusz

  • *
  • 808
Re: How can I add sensors on CC3D board?
« Reply #11 on: February 03, 2016, 12:31:02 pm »
Alright I will look for it. Nice to know that RPi can be connected with CC3D or Revolution board. So I have got a few more questions:
1. Still I need to get the OpLink modem for it right? One is for RPi and another one is for the Drone? (To get the telemetry data)
I think serial communication is much better than USB? As the drone will fly, so definitely I cannot connect with an USB to a RPi all the time. So I need to attach the RPi with CC3D via serial communication. So here comes-
2. To read the telemetry data, I need a monitor that might be connected with the RPi via LAN (using PuTTY). So is there any way that I can use a wifi dongle in the CC3D board?

I think it has both pros and cons. Like, wifi might not be stable all the time. So if the drone exceeds the limit, I cannot get data anymore!
Please share your thoughts about it :)

You need oplink modem or bluetooth devices if you want wireless connection between flight controller and RPi. For connecting them see
https://librepilot.atlassian.net/wiki/display/LPDOC/Setup+a+bluetooth+for+telemetry
http://opwiki.readthedocs.org/en/latest/user_manual/oplink/cc.html#telemetry-only

You can't use WiFi dongle with CC3D, as WiFi dongle and CC3D are both "slave" USB devices, they need to be connected to USB which has host controller such as for example computer.
For the same reason you cannot connect keyboard to mouse, even though both are USB devices.
« Last Edit: February 03, 2016, 12:41:02 pm by Mateusz »

Riz

  • *
  • 17
Re: How can I add sensors on CC3D board?
« Reply #12 on: February 03, 2016, 01:19:28 pm »
Alright I will look for it. Nice to know that RPi can be connected with CC3D or Revolution board. So I have got a few more questions:
1. Still I need to get the OpLink modem for it right? One is for RPi and another one is for the Drone? (To get the telemetry data)
I think serial communication is much better than USB? As the drone will fly, so definitely I cannot connect with an USB to a RPi all the time. So I need to attach the RPi with CC3D via serial communication. So here comes-
2. To read the telemetry data, I need a monitor that might be connected with the RPi via LAN (using PuTTY). So is there any way that I can use a wifi dongle in the CC3D board?

I think it has both pros and cons. Like, wifi might not be stable all the time. So if the drone exceeds the limit, I cannot get data anymore!
Please share your thoughts about it :)

You need oplink modem or bluetooth devices if you want wireless connection between flight controller and RPi. For connecting them see
https://librepilot.atlassian.net/wiki/display/LPDOC/Setup+a+bluetooth+for+telemetry
http://opwiki.readthedocs.org/en/latest/user_manual/oplink/cc.html#telemetry-only

You can't use WiFi dongle with CC3D, as WiFi dongle and CC3D are both "slave" USB devices, they need to be connected to USB which has host controller such as for example computer.
For the same reason you cannot connect keyboard to mouse, even though both are USB devices.
Thanks sir and my apology for mistyping! I shouldwrite: using WiFi dongle with RPi, not with CC3D :P I have to connect the RPi with WiFi Dongle to read the data in my laptop. So in this case, the WiFi signal must not be stable all the time right?
Any other way to read the telemetry data from RPi? Thanks!   

jtrout19

  • ****
  • 334
Re: How can I add sensors on CC3D board?
« Reply #13 on: March 17, 2016, 05:04:34 am »
LibrePilot GCS is linux compatible is it not? If so just load Linux onto your Pi and load GCS on it. That would be neat to see what someone could do using both boards.