Hi,
I have a MultiWii PRO board from HobbyKing (http://hobbyking.com/hobbyking/store/__ ... ouse_.html) but this board does not have a dedicated VBAT pin. I'd like to set up the firmware to use AUX4 (PIN A15) as analog input to measure the battery voltage.
Is there anybody who can help me?
Thanks
MultiWii PRO VBAT pin setup
-
- Posts: 100
- Joined: Thu Sep 10, 2015 11:29 am
Re: MultiWii PRO VBAT pin setup
Find "OVERRIDE_V_BATPIN" in config.h and set it to A15...
I hope that helps...
Ed
I hope that helps...
Ed
Re: MultiWii PRO VBAT pin setup
Thanks for your suggestion but seems like it is not enough to change it to A15.
I've tried to do that and the result is 2.3V based on the GUI and without connecting the battery to A15 pin. Isn't it an issue that A15 is used for AUX4 by default?
I've tried to do that and the result is 2.3V based on the GUI and without connecting the battery to A15 pin. Isn't it an issue that A15 is used for AUX4 by default?
-
- Posts: 100
- Joined: Thu Sep 10, 2015 11:29 am
Re: MultiWii PRO VBAT pin setup
I just found the reason for this in the code... since you have a MEGA based flight controller, this comes into play:
#if defined(MEGA)
DDRK = 0; // defined PORTK as a digital port ([A8-A15] are consired as digital PINs and not analogical)
#endif
So, A8-A15 are actually digital pins - it should work if you use one of A0-7 as your battery pin...
#if defined(MEGA)
DDRK = 0; // defined PORTK as a digital port ([A8-A15] are consired as digital PINs and not analogical)
#endif
So, A8-A15 are actually digital pins - it should work if you use one of A0-7 as your battery pin...
Re: MultiWii PRO VBAT pin setup
There are no jumpers for A0-7 pins. Will it help if I change DDRK from 0 to 128? Or is there anything else to change?
-
- Posts: 100
- Joined: Thu Sep 10, 2015 11:29 am
Re: MultiWii PRO VBAT pin setup
find:
and edit it to your liking, maybe something like this will work for you:
Hope that helps...
Ed
Code: Select all
void configureReceiver() {
/****************** Configure each rc pin for PCINT ***************************/
#if defined(STANDARD_RX)
#if defined(MEGA)
DDRK = 0; // defined PORTK as a digital port ([A8-A15] are consired as digital PINs and not analogical)
#endif
and edit it to your liking, maybe something like this will work for you:
Code: Select all
void configureReceiver() {
/****************** Configure each rc pin for PCINT ***************************/
#if defined(STANDARD_RX)
#if defined(MEGA)
DDRK = 0; // defined PORTK as a digital port ([A8-A15] are consired as digital PINs and not analogical)
// added by Ed in an effort to make V_BATPIN work when it is overridden with OVERRIDE_V_BATPIN to be one of A8-A15 on a mega
pinMode(V_BATPIN,INPUT); // just to ensure the pin is actually set up correctly...
digitalWrite(V_BATPIN,LOW);
uint16_t temp = analogRead(V_BATPIN);
#endif
Hope that helps...
Ed
Re: MultiWii PRO VBAT pin setup
I got the same result. GUI shows 2.3V (it is around 1V without the multiplication). I've tried to wire 5V to the A15 pin but nothing has changed.
Re: MultiWii PRO VBAT pin setup
Ed, thanks for your help. I missed to uncomment OVERRIDE_V_BATPIN. Now it is working as I have expected.