Measure battery voltage

Firmware/software/electronics/mechanics
almaz_1c
Member
Posts: 43
Joined: Tue Dec 09, 2014 12:58 pm

Re: Measure battery voltage

Post by almaz_1c »

Ok, thanks.
almaz_1c
Member
Posts: 43
Joined: Tue Dec 09, 2014 12:58 pm

Re: Measure battery voltage

Post by almaz_1c »

Hello! In addition I want to measure total charging/discharging battery current. For this I think use max471 or operational amplifier. May be there is was some already implemented solution in schematics of quadrotor to do that. ( Without using nfr51 (
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Measure battery voltage

Post by tobias »

It might be better to use a hall effect current sensor instead. One of Allegro ones should work fine. There can be peek currents of above 5A so make sure the current sensor can handle that. The sensor outputs a voltage which could be measured with the STM32 ADC.
almaz_1c
Member
Posts: 43
Joined: Tue Dec 09, 2014 12:58 pm

Re: Measure battery voltage

Post by almaz_1c »

thanks for advice, tobias.
almaz_1c
Member
Posts: 43
Joined: Tue Dec 09, 2014 12:58 pm

Re: Measure battery voltage

Post by almaz_1c »

tobias wrote:Currently the battery voltage is sent 100 times per second to the stm32 and you can get it using the pmGetBatteryVoltage function. If you want faster sampling then you would have to connect the VCOM expansion board pin to a stm32 ADC pin through a voltage divider. The battery voltage can currently also be logged from the cfclient "pm->vbat".
Hello! Please advise how to implement this service in my own firmware? What packet should I send to nfr81522 via UART to get the current battery voltage.
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Measure battery voltage

Post by tobias »

Please advise how to implement this service in my own firmware? What packet should I send to nfr81522 via UART to get the current battery voltage.
This is already setup and you can already get the battery voltage with the pmGetBatteryVoltage function so you don't have to implement anything. ;)
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Measure battery voltage

Post by arnaud »

The NRF51 automatically send this packet 100 times per seconds on the UART: http://wiki.bitcraze.se/doc:crazyflie:s ... tery_state, as said Tobias if you are just modifying the official firmware the work is already done, but if you are making you own from scratch the syslink wiki page will help.
richiekwc
Beginner
Posts: 5
Joined: Thu Oct 22, 2015 3:50 am

Re: Measure battery voltage

Post by richiekwc »

May I know if NRF51822 Pin 6 is connected R25 100K in the crazyflie2.0 schematic? I have mark it in the attached jpg.
crazyflie2.0.jpg
Thank you very much
Post Reply