baseflight + SONAR
baseflight + SONAR
hello,
Here it is a nazePro , but the code work the same for the naze with the hcsr04 sonar [1]
the sonar is for low altitude , you still need a baro for anything 3 meters above the ground.
https://github.com/multiwii/baseflight/ ... ors.c#L449
for now the configuration is hardcoded to use the rc pin 7 and 8 , only 3.3v ( add a 1K Ohms resistor ) :
trigger_pin =rc pin 7
echo_pin = rc pin 8
You can also connect the hcsr04 sonar using the motor pin 4 and 5 ( 5v tolerant )
trigger_pin = motor 5
echo_pin = motor 6
please see : https://github.com/multiwii/baseflight/ ... v_hcsr04.c
Here it is a nazePro , but the code work the same for the naze with the hcsr04 sonar [1]
the sonar is for low altitude , you still need a baro for anything 3 meters above the ground.
https://github.com/multiwii/baseflight/ ... ors.c#L449
for now the configuration is hardcoded to use the rc pin 7 and 8 , only 3.3v ( add a 1K Ohms resistor ) :
trigger_pin =rc pin 7
echo_pin = rc pin 8
You can also connect the hcsr04 sonar using the motor pin 4 and 5 ( 5v tolerant )
trigger_pin = motor 5
echo_pin = motor 6
please see : https://github.com/multiwii/baseflight/ ... v_hcsr04.c
Last edited by treym on Mon Jun 30, 2014 11:44 am, edited 3 times in total.
Re: baseflight + SONAR
Nice work treym. A quad yoyo
Re: baseflight + SONAR
he he , i have updated the previous video with oudoor footage that reflect the current sonar status
Re: baseflight + SONAR
Nice work
Which sonar module is this using?
Which sonar module is this using?
Re: baseflight + SONAR
test were conducted with the hcsr04 .
Re: baseflight + SONAR
I would like to put this in my miniH...can you tell me how you have this connected and mounted to Naze32...and if this is set up using baseflight configurator? Any precautions I need to know? A step by step setup would be greatly appreciated. Info is greatly limited and perhaps old regarding this.
Re: baseflight + SONAR
hi,
the code is not yet in the main firmware , so you need to build the code by yourself : https://github.com/multiwii/baseflight/pull/128
for connecting an hcsr04 sonar to the naze , please refers to the https://github.com/multiwii/baseflight/ ... sr04.c#L66
you also need to activate the feature sonar in the command line interface .
the code is not yet in the main firmware , so you need to build the code by yourself : https://github.com/multiwii/baseflight/pull/128
for connecting an hcsr04 sonar to the naze , please refers to the https://github.com/multiwii/baseflight/ ... sr04.c#L66
you also need to activate the feature sonar in the command line interface .
Re: baseflight + SONAR
yes, there is no obvious reason that could prevent using different pins for connecting this sonar
Re: baseflight + SONAR
Just looking at the branch on git hub. Has this been merged into main base flight?
Re: baseflight + SONAR
It has been about 2 hours ago,
Re: baseflight + SONAR
So. Where to connect sonar on rev5 board?
Re: baseflight + SONAR
rc pin 7 and 8
or
motor pin 5 and 6
I have added some information in the first post
or
motor pin 5 and 6
I have added some information in the first post
Re: baseflight + SONAR
Thank you very much for this! Good work!
- Crashpilot1000
- Posts: 631
- Joined: Tue Apr 03, 2012 7:38 pm
Re: baseflight + SONAR
Thanks for actually putting Sonar to work in BF! But I don't know why it is necessary to have a baro hight limit like arducopter for the sonar to work (magic 3m?). Sonar does distance measuring not absolute hight so it is very useful for roof inspections to keep a constant distance from it (aka not crashing into it).
Re: baseflight + SONAR
3m is the max range of the hc-sr04 sonar , nothing magic
this has to autodetected to accommodate other sensors , further improvement ....
as for roof inspection , thats might be a nice feat .. but would require a max alt limitation , just in case there is a opening in the roof
this has to autodetected to accommodate other sensors , further improvement ....
as for roof inspection , thats might be a nice feat .. but would require a max alt limitation , just in case there is a opening in the roof
Re: baseflight + SONAR
I've been trying sonar on a HEX6X I'm building. I set it up first with 1k ohm resistors, & then with some voltage dividers.
But with it connected on pins 7&8 (rev 5 full) the board won't start up when the battery is plugged in; it just sits on the blue led and won't respond.
Try again with the sonar disconnected then it starts right up as normal. If I power up the board by usb before then connecting the battery it all works.
I've got a BEC going to a D4FR2 connected via PPM to the Naze, 6 Afroslim 20's on M1-M6.
Features set are PPM TELEMETRY SONAR
Mixer HEX6X
Am I doing something daft?
Thanks
But with it connected on pins 7&8 (rev 5 full) the board won't start up when the battery is plugged in; it just sits on the blue led and won't respond.
Try again with the sonar disconnected then it starts right up as normal. If I power up the board by usb before then connecting the battery it all works.
I've got a BEC going to a D4FR2 connected via PPM to the Naze, 6 Afroslim 20's on M1-M6.
Features set are PPM TELEMETRY SONAR
Mixer HEX6X
Am I doing something daft?
Thanks
Re: baseflight + SONAR
maybe ? i dont know are you sure you sonar is wworking (without sone simple arduino code ?)
i have tested only with the sonar on motor pin 5&6 , ... code is supposed to work on rc pin
the configuration code for the sonar is currenlty a pending task , it was not merged so it need some update ..
i have tested only with the sonar on motor pin 5&6 , ... code is supposed to work on rc pin
the configuration code for the sonar is currenlty a pending task , it was not merged so it need some update ..
- goodnnuts
- Posts: 1
- Joined: Fri Jan 02, 2015 2:39 am
- Location: Port Alberni, British Columbia, Canada
Re: baseflight + SONAR
So, lets see... I am assuming Sonar still won't work with Baseflight yet? At least I can't get it to work in Baseflight but I can get it to work in Cleanflight.
Oh yeah, I'm using just the basic Naze32, not the pro version with the baro and other extras.
Oh yeah, I'm using just the basic Naze32, not the pro version with the baro and other extras.