Locating the analog pins for voltage monitoring

This forum is dedicated to all issues and questions related to your individual setups and configurations
Post Reply
JacobGH111
Posts: 14
Joined: Mon Nov 10, 2014 2:30 am

Locating the analog pins for voltage monitoring

Post by JacobGH111 »

I've got a Multiwii Pro (from HobbyKing) (this one http://www.hobbyking.com/hobbyking/store/__26588__MultiWii_PRO_Flight_Controller_w_MTK_GPS_Module.html?gclid=Cj0KEQiA-aujBRDqj772vpGfgooBEiQAzWAZUmH9pCfXPZUDnQ22FklOVVp2Q7lBbiRzJMLcoiEPTmkaAo3u8P8HAQ) and I want to set up voltage monitoring. I feel kinda stupid for having this issue - I can't figure out where to attach the two resistors. I know that they have to plug into a specific pin on the Multiwii, but I can't, for the life of me, figure out which pin.

In the multiwii code I found this line:

Code: Select all

//#define OVERRIDE_V_BATPIN                   A0 // instead of A3    // Analog PIN 3

Indicating that (unless I uncomment this line) I should attach them to pin Analog Pin A3. But where is Analog Pin A3 (or A0 for that matter)? This image has been helpful in connecting the motors and ESC's, http://static.rcgroups.net/forums/attachments/3/1/6/3/0/5/a5344019-114-HK-Mega-v1-connections.jpg, but it doesn't indicate the analog pins. Is there another document that I'm missing that tells me this? If someone could tell me which pins I would be very grateful.

brewski
Posts: 483
Joined: Tue Apr 29, 2014 12:04 am
Location: Cleveland Qld Australia

Re: Locating the analog pins for voltage monitoring

Post by brewski »

Voltage Monitoring
Multiwii 3S
I used a lot of time searching the web to find the answer to this simple question. This
guide is made to make it easy to set up voltage monitoring on Multiwii. Guide made
by Christian W on multiwii forums based on info in NikTheGreek's forum post.
Needed: 33k and 52k resistor (It's possible to use different resistors, use the equation
later in the guide.)
Setup:
Software:
-In Config.h under “battery voltage monitoring” you need to uncomment:
//#define VBAT to #define VBAT
-Then you need to set the right parameters for the voltage monitoring to be correct.
The #define VBATSCALE 131 has to be set.
-Enter http://panoramaic.se/configurator/2.2/ and scroll down to V BAT monitoring here
is a calculator to find the VBATSCALE. Write in:
1. Number of cells: 3
2. Measured battery voltage: 12.6 (for example)
3. Volt difference: 4.89
(The volt difference can be calculated with:
Volt from battery*(first resistor/ first resistor+second resistor)
Example: 12.6*(33/52+33)=4.89
With this you can use other resistors than recommended and still get the right VBATSCALE, however
go as close to recommended resistors as possible and volt difference over 5v can damage your
board.)
Write the value you get from the V BAT calculator in:
#define VBATSCALE 126 (If you use the exact same setup as in this guide)
Upload.
You can also calibrate using MWConfig just changing VBatscale until reading matches that measured by accurate multimeter set to DC volts. Don't forget to save changes.

It appears that HK AIOP does not bring A0-A7 out to a port as Crius AIOP V1 & V2 does. You may have to Google 2560 pinouts & solder to pins on chip. You may be lucky & the A0-A7 may be terminated on pads somewhere on board.
I use a 5V zener diode from A3 to ground to protect input port from overvoltage. You should also install a 4.7K resistor inline with voltage from divider to limit current in overvoltage situation.

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Locating the analog pins for voltage monitoring

Post by Hamburger »

This board lacks some analog pins.
Easiest option is to free the a14 a15 pins . Only 6 or 7 channels from rx then or use ppm or sbus.
Then use the override.vbat.pin feature. Setup as described in wiki.

izeman
Posts: 57
Joined: Tue Sep 16, 2014 10:49 am

Re: Locating the analog pins for voltage monitoring

Post by izeman »

i also have issues finding the correct pins. i have this board as well, but now use a crius aio which has those pins available.
if you can't find the corresponding pin it won't hurt to connect the voltage sense wire to any of the A ports and see if your voltage is shown correctly in mwc. just take care that the voltage is below 5v!!
if you don't use a camera gimbal you can route voltage sense pin to A14 or A15
edit: sorry for my post. i didn't realize that this already was answered ;)

JacobGH111
Posts: 14
Joined: Mon Nov 10, 2014 2:30 am

Re: Locating the analog pins for voltage monitoring

Post by JacobGH111 »

Ok! This is all very useful information. Thanks a ton! I am planning on attaching a camera with a gimbal in the future, so I want to keep that in mind as I plan this.

So if I understand correctly: Let's say I decide that I just want to control the camera pitch from the Transmitter, and the panning I'll do by just yawing the entire drone (so I only need one channel), then I could use A15 for voltage instead of "Camera Roll". Is that right?

But @Hamburger, you said "or use ppm or sbus." What does that mean? Where are the ppm & sbus pins and would I connect to them in the same way?
Last edited by JacobGH111 on Wed Nov 19, 2014 4:17 pm, edited 1 time in total.

izeman
Posts: 57
Joined: Tue Sep 16, 2014 10:49 am

Re: Locating the analog pins for voltage monitoring

Post by izeman »

JacobGH111 wrote:...Where are the ppm & sbus pins and would I connect to them in the same way?

afaik (and i'm a noob too) normally (as i do) you use one channel of your receiver for each function. if you use ppm you can use a sum signal to reduce the needed wires (and free the input/output channels). but please google that yourself or wait for some pro to confirm my assumption :)

waltr
Posts: 733
Joined: Wed Jan 22, 2014 3:21 pm
Location: Near Philadelphia, Pennsyvania, USA

Re: Locating the analog pins for voltage monitoring

Post by waltr »

Also look up the Arduino pinouts for the Atmega processors. This gives the translation from the Atmega pins numbers to the pin names used by Arduino code.

handsomejackuk
Posts: 97
Joined: Mon Sep 08, 2014 12:25 am

Re: Locating the analog pins for voltage monitoring

Post by handsomejackuk »

bump for reference

izeman
Posts: 57
Joined: Tue Sep 16, 2014 10:49 am

Re: Locating the analog pins for voltage monitoring

Post by izeman »

izeman wrote:
JacobGH111 wrote:...Where are the ppm & sbus pins and would I connect to them in the same way?

afaik (and i'm a noob too) normally (as i do) you use one channel of your receiver for each function. if you use ppm you can use a sum signal to reduce the needed wires (and free the input/output channels). but please google that yourself or wait for some pro to confirm my assumption :)

i now quote my own post, just to tell you that i just flashed my d8r-iiplus receiver with the XP firmware and can use ppm now. it's really nice. only one 3pin wire from receiver to fc and i can use all 8 channels now. less wires, more functions. what else could you ask for :)

JacobGH111
Posts: 14
Joined: Mon Nov 10, 2014 2:30 am

Re: Locating the analog pins for voltage monitoring

Post by JacobGH111 »

Thanks, Brewski for that wonderful guide. I got it hooked up to the last PWM channel (A15) and it seems to be reding voltage. Except it's way off. Here's the thing: When I plug the USB into my computer to read from the MW GUI, it reads 7.2 volts even without the battery attached. Once I plug in the battery (with the USB still plugged in) then it reads 12.8. The real voltage (from a voltmeter) is about 11.3. So I'm going to start adjusting the VBAT scale to get it right, but now I wonder if I can even do that over USB since USB seems to affect the voltage readout. What should I do?

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Locating the analog pins for voltage monitoring

Post by Hamburger »

do not tune analog readings while powered over usb.
If you have no other choice of monitoring values, then open a usb cable and cutting the +5V line may help. Then run board from lipo/ESC/BEC and tune.

Post Reply