Setting up new quad build...few questions

tlocus

Member
Hello, Building a quad and had a few questions.
Here is the quad: (and specs are in signature)
DroneFull.jpg

The Flight Controller says plug into SB port of RC Receiver. I have an SB and SB2 port. I believe the SB2 port communicates both ways...can I plug into the SB2 port?
Also, I have a small digital servo to control the small front camera to face directly ahead FPV or 90 degrees down. Do I connect the digital servo directly to the RC Receiver or into flight controller?
Futaba R3006SB Receiver.jpg

The instructions aren't that great, It shows where to connect a gps module but wondering if (and if so where) I can connect a compass, barometer, ping sensor modules?
iFlight SucceX F7 TwinG Bluetooth Flight Controller.jpg
 
Okay so this is a doozie:


^^ check out pg 38 there it has the info about setting the mode on the receiver itself and says essentially (long story short) if you put it in "Mode B" then the Ch6/S.BUS one, not the S.BUS2 will be the one you want to hook up to one of the RX pins on the flight controller.

The flight controller takes data in through RX pins and writes data out through TX pins in general. On older STM32 chips the pin/resource mappings were somewhat limited, because only certain pins support certain timer associations which limits what kinds of protocols they can be used for, from what I've heard on the street the new ones can have pins remapped more freely so there should be less limits on what inputs/outputs are actually used for but it could take some pretty serious hacking around.

Recommend check out Joshua Bardwell's vids or Oscar Liangs blog on resource remapping if looking to do this with Betaflight..... oh that brings up a question are you using this for Betaflight or iNav? Ultimately F7 should still be flexible but may help guide some answers knowing which firmware you are going for (iNav better for waypoint flight and automated control in general, betaflight more for manual control or angle mode flight with a few GPS enabled features like emergency return to home).


^^ regarding hooking up the compass and GPS to FC; TLDR there is need a I2C bus or SDA and SCL lines broke out for data and clock shared between chips for communicating the compass data, the GPS typically uses a UART or a pair of RX/TX pins to do bi-directional serial communication. For GPS you basically need to pick some RX/TX number say 4 and then hook up the TX from GPS to RX4 on FC and RX from GPS to TX4 of FC and then in the FC config you would tell it there is a GPS accessory hooked up to UART/Serial4

For iFlight support stuff they basically put it all into a google drive and just link that on their support page:
 
Is it possible to change motor direction in the software/betaflight or other? ..or do I need to swap motor wires?

t
 
Yah can change it with blheli suite it will use the FC to jump into escs and can reflash or change the esc settings from there. Look for BlSuite32 the blheli configurator is no longer working I think due to chrome limiting usb access for apps but anyhow look for the regular desktop app not the chrome app.
 
Last edited:
For motor direction usually wire swap is easier honestly but if want to update the esc firmware or mess with config details it's an option.
 
Awesome got it to work with BlHeli32 :D many thanks for the help.
Got most everything working in betaflight, my futaba transmitter shows input in the 'Receiver' tab in betaflight (When I move transmitter throttle stick it shows movement thresholds in betaflight Receiver tab).
I can run motors in betaflight but when i use my transmitters throttle stick nothing happens.

t
 
Assuming the right thing moves in receiver tab for a given stick then should be good there (also when throttle at 0 it should read 1000 and with throttle at max it should read 2000, exactly right doesn't matter but should be +/- like 50 from those values). Other thing to check is in the modes tab make sure the arm option is setup to use an aux that one of your switches effects and you know which one that is. To arm you'll need to power up the quad and the TX (tx first usually is a little safer) and then keep throttle at 0 and otherwise sticks centered then flip arming switch and should arm. If hooked up to USB the arming by switch is disabled I'm pretty sure so you'll need to do the config change save see that it "works" in the modes tab (arm goes red when flipping switch to arm and yellow/gray when disarmed). If looks good in modes tab disconnect from computer (hit disconnect button in betaflight first to safe eject but honestly probably fine to pull so long as not actively saving config or flashing something)
 
thanks wafflejock,
0 throttle is 1110 and max is 1930
BetaflightReceiver.jpg

I'll check the arm option.. k, I set arm option to AUX 5 went to receiver to make sure it works. What range do I make it?
I tried some ranges to where I get a red square says 'Arm disabled' and switching goes to grey 'Arm'
t
 
Last edited:
It's hard to explain but basically you have a yellow tick mark you'll see move when you move the switch (assuming right aux channel is chosen for the given switch, or choose auto and move a switch to get it to automatically pick the aux channel for a given mode). Once you see where the yellow tick lands you put the switch in the position you want to be "arm" and then move the two handle slider thing so the yellow band covers the tick mark but not much more of the bar. Then flip the switch to "disarm" position and make sure the yellow tick now lies outside the yellow bar.

Essentially you are using the two handles in the modes view to setup a range of acceptable values to activate the mode anything not in the yellow band is not activated anything in the yellow band is activated. what value your radio/receiver will send for a given switch can vary so have to sort of just try it and check. For full setup guide suggest running these vids at least in the background while doing something else if not pick and choose ones most relevant to what you're trying to setup:

Code:
https://www.youtube.com/watch?v=bAqgPEW48Tc&list=PLwoDb7WF6c8kH_vLskPnY5xjuT284rhmj

Joshua Bardwell or "JB" has a ton of great content on betaflight strongly suggest checking it out as reference material in vid form.
 
Thanks again :)
Yup, I figured setting it around one of those yellow marks. Actually setting it around the other changes or reverses the arm of the switch(up to arm down to disable and vice versa).

Motors are still only controlled via betaflight software (still no go on transmitter throttle).
Anything I need to check in the UART settings in betaflight?

Also is there a setting to get that low (1000) and max (2000) range? in betaflight or in transmitter settings?

One more thing on hooking up a sonar/ping distance sensor to my flightC board. The ping sensor has GND/Vin/Signal.
GND and Vin are no problem but where do I hook up the signal wire?
iFlight SucceX F7 TwinG Bluetooth Flight Controller.jpg

Really appreciate the help wafflejock!

t
 
Hey no problem glad your making progress on it. If you have a vtx and fpv/goggles of some sort then can use the on screen display option to see any warnings or errors it's getting. If it thinks throttle is above 0 or things aren't staying level enough or a few other things can stop it from arming. Regarding the min/max values a couple ways to fix as well, look up rxrange setup with betaflight cli you can basically have it dump current values then write new values and save to tell it the new min/max for all the sticks. Having the rxrange (might be rx_range) set it should map the values from whatever min and max to 1000-2000 range so quad is getting the right value for how far each stick is deflected from center (1500).


JB has done a slew of these as well but having a hard time finding most recent :). If you have fpv option enable the osd in config tab and then in osd tab make sure the "warnings" option is toggled on and showing on screen this will show what particular error condition it has (throttle above min, or rx loss if receiver being flakey some other possible things)
 
Huh very weird... on the setup tab does the image of the quad look level when it is in fact sitting on a level(ish) surface? If not hit the calibrate accelerometer button on that setup tab and hit save after a few seconds (should show it is calibrating for a few seconds then numbers should 0 and the 3d view should look flat, tipping quad in real life should make the 3d model move the same way). Only reason I could see it giving really high motor output to one motor and not the rest is if it "thinks" that one motor is tipped way down compared to the other three. One other thing to check out would be ESC calibration but I think if using DShot600 or anything beyond PWM for the FC->ESC communication (in configuration tab I think) then the calibration shouldn't be an issue... if want to try procedure is props off battery disconnected go to motors tab, hit toggle for props off and bring throttle to 100%, now plug in battery power and wait a few seconds you should hear normal ESC/motor noises except the final two beeps, bring the master throttle slider down to 0 you should hear two confirmation beeps. Once that's done the ESCs should be "seeing" the low to high values correctly for what the FC is sending but as I said would check accelerometer/gyro on the setup tab first.
 
Yay,
Hey thanks wafflejock, I managed to set channels 1-4 to min: 1000 mid: 1500 and max: 2000. I believe this did the trick.
Futaba transmitters mid's are 1520... With options under 'Endpoints' and 'Sub-trim' able to get those mid values.
One thing though, My ESC is Dshot1200 and can't seem to find this in betaflight options...seem to recall in Joshua's video he had that option. Mine goes up to Dshot600 then proshot1000.
Also with throttle about 50% (without props on) i grabbed the quad and rotated it around. The gyros were kicking in.. but a bit hard. Anyway to smooth that out?
btw, channel 5 is set for gyros but there is option in futaba transmitter to set 3 channels ch5, ch6 & ch8 i believe for the 3 axis..
Thanks again!

t
 
Awesome! Yah not sure on the futaba radio config in general you put the transmitter into airplane mode to send the "right" things for each stick on receiver tab in betaflight if sticks appear to move the wrong thing can change the channel map in there usually it is TAER1234 or AETR1234

Regarding d-shot I think 600 is good enough I think 1200 has disappeared from the normal interface but not entirely sure why maybe some bugs to handle behind the scenes but 600 updates per second from FC to ESC should be plenty too the motor can only physically change speed so quickly.
 
Just an update..almost ready to do some short lift offs landings.

-I'm currently hooking up a GPS/Compass module, according to this I can hook up the SCL & SDA (module side) to R3 & T3. And GPS Tx & Rx to R5 & T5. Setting GPS to UART5.

-I'd also like to try and get a bit more uniform is while increasing throttle, having all motors uS very close. Would 'Air mode' or other settings help with this?

-I'm wanting to have a 'hover' switch where quad hovers at a set altitude. Searching the web betaflight dropped this a while back. Possible way to use Baro and or GPS for altitude. So when switch is flipped quad holds a set altitude/throttle?

-Last thing.. I have A PING sensor (has GND, +5V & SIG.) Can this be attatched to a free 'Rx' UART on my flight controller board. I would only need to receive the signals from the sounder in F/C? Here is the sensor and site:

thanks again,

t
 
Last edited:
Actually wouldn't worry about the motor speed at any given moment since it's always compensating using either the accelerometer (if in angle or horizon mode) or using the gyro (if in "acro" mode, really just no mode selected in BF modes, acro is default).

If it seems it's always compensating too much with one set of motors or another when in angle or horizon mode then the accelerometer probably needs calibrating. If it is drifting in acro mode that is somewhat expected, in either case you'll have to do some throttle management to keep it from flying up too high or down too low but eventually you can get the throttle fairly well "locked" by adjusting your rates to some degree making it easier to find the "correct" position to have a solid hover that said like you indicated using sensors is ultimately/ideally the best way to get the quad to really lock it's altitude.

All that said, as far as I know Betaflight only supports return to home type functionality with GPS/compass currently (and I think really relies on the GPS and might just ignore the compass). Basically the configuration for this will block you from taking off without GPS lock (by default can be overridden) and if you have GPS lock before arming/take off then if you enable Return to Home as a failsafe and/or make a switch/mode activate Return to Home (RTH) activate at which point the quad flies up to a preset height (or max height seen during flight) and returns to the home position and attempts to bring itself near the ground (lowers throttle to some set percentage).

Peering under the hood on BF firmware can see what sensors are "supported" or at least there is some code for:

Regarding features supported using those sensors though again I don't think there's a ton of that in betaflight itself.

What you want is broadly called "altitude hold" or "GPS hold" in the iNav world from the little I've dipped into that. Many modern FCs that support Betaflight I think can also support iNav so long as someone has taken the time to setup the "resource mapping" basically telling betaflight which pins on the MCU go to what things on the PCB (or pin holes). Long story short though you might have more luck using more advanced sensor features on a DIY thing if using iNav firmware.

Also I have played with a few of those ping sensors.


They come in a few varieties the one you have there I think uses one "can" as an ultrasonic speaker and the other "can" as a receiver/mic. They would probably work pretty well for this application (not good under a foot but get pretty accurate readings from 1ft to about 10ft) although I'm not sure how much vibration dampening you'd need to do to avoid getting bad data from the sensors (in general filtering of junk data is just something you have to do but being on a flying vibrating thing makes it harder than usual). For the "PING" style sensors you have basically power to them then a bidirectional data line that is used for first telling the PING sensor to send out/measure a ping time then that data is sent down the same line back to the MCU that asked it to ping something (by raising the line high or low I forget)... some code/sample here is clearer than my explanation :D


There are other ones that are "simpler" you can see dangling on the left and right of my bot above. The "simpler" ones will just ping so long as they have power going to them and will output an analog signal which you can use an analog to digital converter (in Arduino world analogRead() function does this pretty sure) to "read" the distance and then translate that into some actual distance value (calibrate using a measuring stick or known distance and do some map() call in Arduino again).

All of the BF code is targeting STM32/ARM chips whereas Arduino is AVR architecture and much slower in general so not all of my knowledge of Arduino things is directly portable but it's all C code so I can at least understand BF unfortunately haven't gotten to the point of building my own custom firmwares yet though :| maybe one day :)
 
Last edited:
Also to more broadly address the different options they are all good IMO (so long as can find support or build it yourself).

Ultrasound good for shortish distances, but very accurate only tells you height though so Z but no X/Y really

Baro good for higher up not as accurate as ultrasound but really pretty dang accurate when looking at relative changes. Not as fast as ultrasound for getting updates. Still suffers from Z only can control altitude but not lock position no X/Y

GPS accuracy depends on number of satellite locks/view of the sky and is variable. Depending on quality of data being received the ability of GPS module to accurately determine position varies over time. Gives you X/Y/Z only thing missing is heading which compass fills in so then know everything about the quad in terms of placement in space on earth but is a rough approximation in all directions.
 
One other option you didn't mention but I've heard has worked well in the "commercial" or "hobby grade off the shelf" products is "optical flow" this is using a camera and essentially processing the frames/image data to determine which direction the quad is drifting if at all and to then compensate. From what I've heard from others who have used this it works pretty well but it depends on having a good video sensor, the optical flow software to determine the direction of the flow and then pass that into the control system for the FC (or have it processed in the same FC firmware). Again I don't think there is any support for this one in betaflight or iNav for that matter (iNav does generally have more sensor/waypoint flight support though), but just another idea to throw into the hat.

---

Just remembered another... LIDAR which is basically RADAR but with a laser beam is getting cheaper and smaller as time goes on, if anyone manages to really crack the solid state LIDAR nut and gets that into our hands then I'd say that's a good option... going to watch this hype video to see how close they are :D


 
Last edited:
One other option you didn't mention but I've heard has worked well in the "commercial" or "hobby grade off the shelf" products is "optical flow" this is using a camera and essentially processing the frames/image data to determine which direction the quad is drifting if at all and to then compensate. From what I've heard from others who have used this it works pretty well but it depends on having a good video sensor, the optical flow software to determine the direction of the flow and then pass that into the control system for the FC (or have it processed in the same FC firmware). Again I don't think there is any support for this one in betaflight or iNav for that matter (iNav does generally have more sensor/waypoint flight support though), but just another idea to throw into the hat.

---

Just remembered another... LIDAR which is basically RADAR but with a laser beam is getting cheaper and smaller as time goes on, if anyone manages to really crack the solid state LIDAR nut and gets that into our hands then I'd say that's a good option... going to watch this hype video to see how close they are :D

Wow thanks for all the good info :D
I probably won't use the ping sensors. I made a wheelchair robot a few years back and had the ping sensor on the front and constantly turning (180deg) side to side with a servo to detect any obstacles, but like you said good for objects 1' to 10'... good for a relatively slow moving wheel/track vehicle not good for the quad.
I remember reading about LIDAR...been awhile though.
I've seen those laser handheld distance measuring tools..wonder if it's hackable...not sure how far or accurate they are.
 
Back
Top