LibrePilot Forum

General Category => General Discussion => Topic started by: xfce on January 22, 2016, 03:43:19 am

Title: How to setup the battery's VoltageFactor use simple basic voltage divider
Post by: xfce on January 22, 2016, 03:43:19 am
Hi all
      I have a question, I use a simple basic voltage divider, two resistors 10K and 30K, 3S battery

from the code
Code: [Select]
flightBatteryData.Voltage = (PIOS_ADC_PinGetVolt(voltageADCPin) - batterySettings.SensorCalibrations.VoltageZero) * batterySettings.SensorCalibrations.VoltageFactor; // in Volts
So in the GCS
does it means the VoltageFactor=4 ? thanks
Title: Re: How to setup the battery's VoltageFactor use simple basic voltage divider
Post by: f5soh on January 22, 2016, 07:25:00 am
yes.

In my opinion your are very close to max input voltage, if you use 4S battery later...

https://librepilot.atlassian.net/wiki/display/LPDOC/Configure+a+Current-Voltage+sensor#ConfigureaCurrent-Voltagesensor-Basicvoltagesensor
Title: Re: How to setup the battery's VoltageFactor use simple basic voltage divider
Post by: TheOtherCliff on January 23, 2016, 05:02:35 am
It cuts voltage by a factor of 4, but only if the 10k is attached to ground and 30k to V+.
Title: Re: How to setup the battery's VoltageFactor use simple basic voltage divider
Post by: xfce on January 23, 2016, 09:07:35 am
It cuts voltage by a factor of 4, but only if the 10k is attached to ground and 30k to V+.
yes i connect this way. but the result is not right.
i use PWMOUT6 for ADC,  and in GCS set as bellow
Title: Re: How to setup the battery's VoltageFactor use simple basic voltage divider
Post by: f5soh on January 23, 2016, 10:54:45 am
When you say the value is not right... whats the reading ?

If you want to use the servo output6 as adc input you should set  "Battery Voltage" on adc6

adc1 is one FlexiIO pin
Title: Re: How to setup the battery's VoltageFactor use simple basic voltage divider
Post by: xfce on January 24, 2016, 06:23:23 am
When you say the value is not right... whats the reading ?

If you want to use the servo output6 as adc input you should set  "Battery Voltage" on adc6

adc1 is one FlexiIO pin

Thanks ,It's OK now.
I read from the nano codes' comment as bellow, so i consider output6 is adc1, could you please tell me all the right IO mapping,thanks.


 
Title: Re: How to setup the battery's VoltageFactor use simple basic voltage divider
Post by: f5soh on January 24, 2016, 09:26:15 am
Maybe this comments are a copy/paste from Revo...
Title: Re: How to setup the battery's VoltageFactor use simple basic voltage divider
Post by: xfce on January 24, 2016, 09:43:25 am
Thanks!
Does the software uart used for upgrade blheli ESC? And is there some user guide link
Title: Re: How to setup the battery's VoltageFactor use simple basic voltage divider
Post by: f5soh on January 24, 2016, 09:53:59 am
This feature is not implemented
Title: Re: How to setup the battery's VoltageFactor use simple basic voltage divider
Post by: Klingan on January 31, 2016, 03:20:59 pm
Hi

I have a Revo and am trying to setup my current sensor. The main port and the flexi is used for telemtry and gps so I want to use the sonar port.
My PWR/sonar port is disabled and grey on my configuration/hardware tab so I can't enable it. Inside the wiki it says (somewhere) that the port is disabled for future implemenatation of sonar support etc. But the wiki also says that I can use a attopilot current sensor and hook it up to the "sonar port"/pwr.

How do I enable it?
Title: Re: How to setup the battery's VoltageFactor use simple basic voltage divider
Post by: f5soh on January 31, 2016, 04:23:50 pm
Look at Howto page:

https://librepilot.atlassian.net/wiki/display/LPDOC/Configure+a+Current-Voltage+sensor#ConfigureaCurrent-Voltagesensor-Hardwaresettings
Title: Re: How to setup the battery's VoltageFactor use simple basic voltage divider
Post by: Klingan on January 31, 2016, 04:53:31 pm
I already read from that guide but midway I got confused since the hardware tab says that the port is disabled and grey.
But after finishing the guide it works (even though the port is "disabled"). Thank you : )
Title: Re: How to setup the battery's VoltageFactor use simple basic voltage divider
Post by: f5soh on January 31, 2016, 04:58:23 pm
The wiki page do not mention the hardware tab, why got confused ? :)
Title: Re: How to setup the battery's VoltageFactor use simple basic voltage divider
Post by: Klingan on January 31, 2016, 05:18:43 pm
Well I forgot to restart the board so it didn't work at first. And all other ports main/flexi etc need to be enabled and set to something to work so I just thought that was obvious. But like I said, now it works : )