Hello,
I have been trying for two weeks to get sonar to work and have gotten basically nowhere. I am using a HK MultiWii Pro board, and have tried both HC-SR40 and SRF08 sensors. I have tried probably 30 different versions of firmware, and searched high and low for an answer. With the HC-SR40, I could not get it to turn on at all. With the SRF08, I get a single red light on startup and nothing. I have checked voltage across each of the SRF08 pins. The +5V is at roughly 4.9, while the scl and sda are at about 3.3. I am losing my mind, and would appreciate any and all help.
Someone please help me with sonar
Re: Someone please help me with sonar
Have you enabled the sonar in the file config.h?
Code: Select all
/* Sonar */// for visualization purpose currently - no control code behind
//#define SRF02 // use the Devantech SRF i2c sensors
#define SRF08
//#define SRF10
//#define SRF23
-
- Posts: 3
- Joined: Thu Feb 26, 2015 4:09 am
Re: Someone please help me with sonar
Yes, I have. When I do that, the SRF08 blinks once on startup and that's it. How do I tell if it's working? How do I encorporate it into altitude hold?
Re: Someone please help me with sonar
ajmoore0351 wrote:How do I encorporate it into altitude hold?
Based on the comment at the top of that code block, you can't. Sonar poses a lot of challenges, not the least of which is scattering when flown over grass. I'm not surprised it hasn't been incorporated in the control loop yet.
Re: Someone please help me with sonar
This is true for the simple sonar devices. But, we are talking about the SRF08, which is an i2c device. The only challenge is to send one i2c command and retrieve the result back.TheBum wrote:Sonar poses a lot of challenges,
It has been incorporated since at least MW 2.2!TheBum wrote:I'm not surprised it hasn't been incorporated in the control loop yet.
I am sure, it is working you can test it by looking after the following lines in the file multiwii.cpp:ajmoore0351 wrote:How do I tell if it's working?
Code: Select all
#if SONAR
Sonar_update();
#endif
and change it by adding one additional line:
Code: Select all
#if SONAR
Sonar_update();
debug[0] = sonarAlt;
#endif
This makes multiwii to write the result of the sonar into the debug field at the lower left hand corner of multiwiiconf.
Since the sonar device works only for heights less than 2 meters, it is not included into the control loop. It is used only in the file alarm.cpp for the landing lights. So, if you are close enough to the ground landing lights are switched on. That's it!ajmoore0351 wrote:How do I encorporate it into altitude hold?
-
- Posts: 3
- Joined: Thu Feb 26, 2015 4:09 am
Re: Someone please help me with sonar
I have put the extra line of code in for debugging, but nothing shows up in multiwii conf. I toggled each of the debug fields on and off, but I get nothing.
Re: Someone please help me with sonar
Have you got a clean multiwii distribution?
Have you got a 3,3V-board? They could cause issues when running 5V sensors like the SRF08. Maybe you need a level converter.
What about the default address of the device? SRF08_SENSOR_FIRST is 0xF0 - that should be the address of your device, as well. There are devices with 0xE0. Just try that.
The LED should flash when measuring. So, there is really no operation ongoing.
Have you got a 3,3V-board? They could cause issues when running 5V sensors like the SRF08. Maybe you need a level converter.
What about the default address of the device? SRF08_SENSOR_FIRST is 0xF0 - that should be the address of your device, as well. There are devices with 0xE0. Just try that.
The LED should flash when measuring. So, there is really no operation ongoing.