Using M4 with BLDCs - Short How to

Info and discussion about the autonomous Micro FC, suitable for nanos, micros and mini multirotors

Re: Using M4 with BLDCs - Short How to

Postby aBUGSworstnightmare » Tue Dec 23, 2014 3:00 pm

DUKE40 wrote:Adn this can be done with a 2S Lipo as well? I want to be sure, as I do not want to get my M4 barbecued :oops:


This connector (pads) are for measuring the flight battery voltage only, NOT for supplying the M4. They are good for 8S (ADC reference voltage = 3.3V).
aBUGSworstnightmare
 
Posts: 1460
Joined: Fri Jun 22, 2012 5:24 pm

Re: Using M4 with BLDCs - Short How to

Postby aBUGSworstnightmare » Tue Dec 23, 2014 7:47 pm

Added r440 firmware for use with external BLDC to first post.
QUATOS and PID version for BETA and V2 production boards.
aBUGSworstnightmare
 
Posts: 1460
Joined: Fri Jun 22, 2012 5:24 pm

ADC connector (LiPo voltage detector input) on V2 boards (M4

Postby aBUGSworstnightmare » Thu Dec 25, 2014 9:10 am

aBUGSworstnightmare wrote:
DUKE40 wrote:Adn this can be done with a 2S Lipo as well? I want to be sure, as I do not want to get my M4 barbecued :oops:


This connector (pads) are for measuring the flight battery voltage only, NOT for supplying the M4. They are good for 8S (ADC reference voltage = 3.3V).


Since people were asking how to deal with the ADC input connector (used for LiPo voltage detection) on V2 production boards let me show you how I did it.
SANY0040.JPG
Cable soldered to the PDB.
Yellow = LiPo + (goes to ADC terminal)
Black = LiPo - (goes to GND terminal)

SANY0041.JPG
Mating connector on the other side

SANY0042.JPG
LiPo connected to V2 board (ADC terminal) for voltage detection - needed for fail safe.


If you're using a V2 production board you don't need to make the firmware modifications shown in the fist post. These apply for BETA boards users only!
You can download the latest firmware by using the FIRMWARE DOWNLOAD WIZARD: http://autoquad.org/software-downloads/ ... ad-wizard/
YOU NEED TO DOWNLOAD A FIRMWARE WITH 'EXTERNAL ESC OPTION'!

BETA board users don't need the additional wire. They need to make the firmware changes and close JP1 jumper.
SANY0043.JPG
ONLY CLOSED JP1 JUMPER WHEN USED WITH BETA BOARDS! LEAVE OPEN WHEN USED WITH V2 PRODUCTION BOARDS!

I will add new modified firmware versions to the first post of the thread.
Last edited by aBUGSworstnightmare on Thu Dec 25, 2014 10:10 am, edited 1 time in total.
aBUGSworstnightmare
 
Posts: 1460
Joined: Fri Jun 22, 2012 5:24 pm

Re: Using M4 with BLDCs - Short How to

Postby Max » Thu Dec 25, 2014 9:51 am

If you bear with us a few days, we should have an option in the firmware to enable using the external voltage sensor/divider via a parameter. As of right now you'd still need some way to use ext. V as the main Vin (fw hack).

-Max
Max
 
Posts: 2814
Joined: Mon Aug 13, 2012 9:45 pm
Location: Near Ithaca, NY, USA

Re: Using M4 with BLDCs - Short How to

Postby aBUGSworstnightmare » Fri Dec 26, 2014 1:40 pm

Max wrote:If you bear with us a few days, we should have an option in the firmware to enable using the external voltage sensor/divider via a parameter. As of right now you'd still need some way to use ext. V as the main Vin (fw hack).

-Max


If somebody want's Do give it a try:
aqv7.0.r440.b1844-hwv8.6-ext_esc.bin.zip
M4r6 external ESC with mod for LiPo reading
(149.89 KiB) Downloaded 95 times


PID Version for use with external BLDC ESC. Please check if you get correct readings for LiPo voltage.
Also refer to the wiki for infohttp://autoquad.org/wiki/wiki/m4-mi ... onitoring/
Joerg
aBUGSworstnightmare
 
Posts: 1460
Joined: Fri Jun 22, 2012 5:24 pm

Re: Using M4 with BLDCs - Short How to

Postby Max » Sat Jan 03, 2015 9:01 am

Hi Joerg,

I put together this board file for use with your expander (and possibly others), using PA6 as v-sense input. Could you check this out and see if it makes sense?

It could be included in a custom build simply using -DBOARD_HEADER_FILE=\"board_m4_vsense-pa6.h\" compiler option. No need to edit any code.

This would tie into the latest fw version where you can select internal or external voltage sensor input.

Also I was wondering, if you disable CYRF and SPI-1 on M4 v2, is it OK to use PA6 for voltage sensing? Or will this do bad things to the CYRF chip? Do you know? :)

Thanks!
-Max

board_m4_vsense-pa6.h
Code: Select all
#if BOARD_REVISION == 3
    #include "board_m4_r3.h"
#elif BOARD_REVISION == 4
    #include "board_m4_r4.h"
#elif BOARD_REVISION == 5
    #include "board_m4_r5.h"
#elif BOARD_REVISION == 6
    //#include "board_m4_r6.h"
    #error "Can't be used with M4 r6"
#endif

// disable SPI I/O because we need PA6
#undef SPI_SPI1_CLOCK
// make sure CYRF doesn't try to init SPI1
#ifdef CYRF_SPI
#undef CYRF_SPI
#endif

// set up voltage divider (already set up in board_m4_r6)
// these values are known valid for:
//   - aBUGSworstnightmare BLDC expansion boards 0r1-3
#ifndef ANALOG_EXT_VOLT_RTOP
#define ANALOG_EXT_VOLT_RTOP   10.0f
#define ANALOG_EXT_VOLT_RBOT   1.2f
#endif

// set up input pin (PA6)
#undef ANALOG_CHANNEL_EXT_VOLT
#define   ANALOG_CHANNEL_EXT_VOLT       ADC_Channel_6
Attachments
board_m4_vsense-pa6.h
(804 Bytes) Downloaded 93 times
Max
 
Posts: 2814
Joined: Mon Aug 13, 2012 9:45 pm
Location: Near Ithaca, NY, USA

Re: Using M4 with BLDCs - Short How to

Postby aBUGSworstnightmare » Sat Jan 03, 2015 9:25 am

Hi Max,

SPI1 should be disabled since I don't know what PA6 is used for on the Cypress radio. In addition, voltage sensing only works on production boards when using external receivers. As soon as the Cypress is enabled (solder jumper on arm 2 on TOP closed) PA6 will be used for SPI! --> no more ADC readings! On V2 production boards the preference should be to use the ADC input.
Advanced users can get rid of the additional cable by using a custom board file (and knowing what they are doing).

Nevertheless, such a custom board file (with disabled SPI1 and PA6 enabled for ADC input) could be used for the BETA boards (M4r5).

Joerg
aBUGSworstnightmare
 
Posts: 1460
Joined: Fri Jun 22, 2012 5:24 pm

Re: Using M4 with BLDCs - Short How to

Postby Max » Sat Jan 03, 2015 9:49 am

Hi Joerg,

aBUGSworstnightmare wrote:SPI1 should be disabled since I don't know what PA6 is used for on the Cypress radio.

Done with #undef SPI_SPI1_CLOCK

In addition, voltage sensing only works on production boards when using external receivers. As soon as the Cypress is enabled (solder jumper on arm 2 on TOP closed) PA6 will be used for SPI! --> no more ADC readings!

You mean v-sensing using PA6? I was asking if it would work when CYRF chip is disabled anyway. Jumper just provides power to the radio chip, no?

On V2 production boards the preference should be to use the ADC input.

I don't like the extra cable, nor do I plan to use the built-in radio on any larger-than-micro builds.
Advanced users can get rid of the additional cable by using a custom board file (and knowing what they are doing).

Nevertheless, such a custom board file (with disabled SPI1 and PA6 enabled for ADC input) could be used for the BETA boards (M4r5).

So do you mean this board file I posted here, or some other theoretical board file? :)

Thanks!
-Max
Max
 
Posts: 2814
Joined: Mon Aug 13, 2012 9:45 pm
Location: Near Ithaca, NY, USA

Re: Using M4 with BLDCs - Short How to

Postby aBUGSworstnightmare » Sat Jan 03, 2015 9:59 am

Hi Max

Max wrote:So do you mean this board file I posted here, or some other theoretical board file?
-Max


this should work for both, beta and V2 production boards (as long as the Cypress is disabled (jumper open) on V2 boards).

You mean v-sensing using PA6? I was asking if it would work when CYRF chip is disabled anyway. Jumper just provides power to the radio chip, no?

Yes, the jumper only provides power to the Cypress radio.

Will test it in the afternoon (on Beta and V2 board) since I need to complete a new 300size quad in the morning to test with ;) (got a frame from Christof).

Joerg
aBUGSworstnightmare
 
Posts: 1460
Joined: Fri Jun 22, 2012 5:24 pm

Re: Using M4 with BLDCs - Short How to

Postby Max » Sat Jan 03, 2015 10:35 am

Excellent, thanks. I'm going to use it with an r4 for now, but it would be cool if it worked with v2 as well. Yes, it's time to build something (with hardware)! :)

-Max
Max
 
Posts: 2814
Joined: Mon Aug 13, 2012 9:45 pm
Location: Near Ithaca, NY, USA

PreviousNext

Return to AutoQuad M4 Micro Controller

Who is online

Users browsing this forum: No registered users and 5 guests

cron