You are here

VESC Stand-by and/or Shut-off.

14 posts / 0 new
Last post
ThierryGTLTS
Offline
Last seen: 6 years 3 months ago
Joined: 2017-09-06 14:18
Posts: 116
VESC Stand-by and/or Shut-off.

Because I've just implemented the potentiometer to control VESC HW4.12  via the ADC input, I've never noticed that even with the potentiometer at zero, there are still current consumption.

Is there any way to shut-off or put the VESC in stand-by mode with a simple switch (not a power switch of course)?!

Here it is Duty Cycle controlled, but I will surely use Current Control as soon as I will have finished my mechanical assembly.

It seems to be smooth when I've done some simple experiments, loading the motor by hand.

Have a Nice Day.

Thierry

ThierryGTLTS
Offline
Last seen: 6 years 3 months ago
Joined: 2017-09-06 14:18
Posts: 116

I've discovered that the Stop Button in VESC Tool do exactly what we need.

So is it possible to use an input ADC2 or UART TX for example to shut-off the VESC?!

Because I've just seen that several persons ask that feature before, I give the link to the request feature in the old forum http://vedder.se/forums/viewtopic.php?t=224

Of course, if it is already implemented, it would be kind to tell us why to use it.

Have a Nice Day.

Thierry

Eric
Offline
Last seen: 1 year 12 months ago
Joined: 2017-08-28 10:27
Posts: 16

Setting the current to 0 turns of the PWM switching but its not a standby since the MCU still runs the control loop on the ADC values.
mc_interface_set_current(0.0);

You can do this in a custom app or change some code in the ADC app.

Eric

 

ThierryGTLTS
Offline
Last seen: 6 years 3 months ago
Joined: 2017-09-06 14:18
Posts: 116

Yes I think I will do that, or use a Switch in UART TX like Benjamin did in it's application example, old website.

Have a Nice Day.

Thierry

benjamin
Offline
Last seen: 1 week 6 days ago
VESC FreeVESC OriginalVESC Platinum
Joined: 2016-12-26 15:20
Posts: 490

The sleep mode from the vedder forums is different, it is about shutting everything down in software and hardware to get a low enough standby current to leave it connected to batteries for a long time when not in use.

The duty cycle mode is open loop voltage control, and if 0 duty cycle and this 0 voltage is requested this will short the phases and is the intended behavior. Current control will switch off the output completely. What is your application? In duty cycle mode when the phases are shorted by the FETs the current draw should not be much higher than the standby current.

ThierryGTLTS
Offline
Last seen: 6 years 3 months ago
Joined: 2017-09-06 14:18
Posts: 116

Thank you for your answer Benjamin.

I will use current mode because I wanna have a torque control of the motor.

But my question was here to simply have an "On the fly" On/Off switch on the bike handlebar.

I wanna have a very low consumption e-bike to make 200km tours with a single 360Wh batttery.

Have a Nice Day.

Thierry

Roger Wolff
Offline
Last seen: 2 years 6 months ago
VESC Original
Joined: 2017-05-24 12:27
Posts: 202

So that is about 10 hours of biking, on 1300kJ. The controller consumes very little power. I think you can leave it on without any trouble. I never turn mine off when I park for say an hour at home. I bike 70km on 1600kJ. 

Roger Wolff
Offline
Last seen: 2 years 6 months ago
VESC Original
Joined: 2017-05-24 12:27
Posts: 202

I just measured the current draw on my vesc-based design on my bike. About 20mA. So during 10 hours, you'd spend about 200mAh on "keeping the thing on". Or about 2% of the 10Ah capacity of your battery. IMHO, not worth worrying . about. 

 

Keep in mind that this 2% "saving" is "completely best-case". So this assumes you reduce the current draw by 100% when turning the vesc into standby during 100% of the time.... So realistically if you turn the VESC into a 10mA standby mode, during half the time you'd be able to save 0.5% of your battery capacity. I'd rather spend my time/money on say a 20% larger battery.  (12S :-) ) 

 

ThierryGTLTS
Offline
Last seen: 6 years 3 months ago
Joined: 2017-09-06 14:18
Posts: 116

Yes you are right about 10 hours of biking.

I wanna use the motor only for uphill help, limited to about 100W of assistance.

And yes I've thought to let the VESC "On", and it's possible without too much loss.

I measure about 25mA, so close to your 20mA.

But here at university we always wanna have maximum efficiency and lowest possible losses :-)

The 20% will be a 79W 36V battery in my backpack in case of failure of the main battery.

Have a Nice Day.

Thierry

UncleJoe
Offline
Last seen: 1 year 2 months ago
Joined: 2018-06-02 05:42
Posts: 6

I definitely need sleep / standby for my application of driving a blower motor in a car https://www.youtube.com/watch?v=6tcKN11p0Pc . I have the Flipsky mini VESC 4.20 (using firmware 5.1) and the idle current draw is 255 mA @ 12V !  That will make the make the car unstartable in 5 days. I searched through these forums and the esk8 ones and the most common answer is to use an external switch which is inefficient. I need an electrical switch that doesn't add any resistance.

Someone suggested using the en_buck pin to switch everything. But I couldn't locate that pin in any of the HW 4.8 schematics on Benjamin's github. I am very familiar with STM32 and tried forcing the nRst pin low. This dropped the power draw to 44 mA. The power use under reset is still quite high according to this @ ~9.5mA. Stop mode only uses ~0.5 mA. But before I try to those lower power states, I'd like to understand where the other 44 mA - 9.5mA (3.3V / 12V) = 41.4 mA are going?

1. LEDs ? There is 1 blue and 1 green, so maybe 20mA @ 3.3V or 5.5 mA @ 12V.  Can these be turned off without custom firmware?

2. DRV8302 ? According to the datasheet, EN_GATE has an internal pull down resistor, so that means when the STM32 is under reset, the STM32 pins are in a high impedance state so the DRV8302 will have EN_GATE pulled low, meaning negligible power.

So I have 35.9 mA @ 12V unaccounted for.

 

pf26
Offline
Last seen: 1 week 3 days ago
VESC FreeVESC Silver
Joined: 2018-12-04 08:44
Posts: 53

255 mA @ 12V seems too high when motor is idle. You must have 3Watts released somewhere, so you should feel the temperature rise of some components, unless some power goes to the motor.

Did you try to configure to "no App" ?   A nice way to cut idle power is to remove pcb track (by drilling some vias) between DRV high voltage pins and battery+.  Then use a switch to provide this high voltage to the DRV.  The capacitors and Fets are always powered but require only a few a microamps at most.  This mod was relatively easy on the original 4.12 vesc pcb, but not so easy on flipsky miniVesc and FESC4.12 unfortunately.

frank
Offline
Last seen: 1 month 1 week ago
VESC BronzeVESC FreeVESC GoldVESC OriginalVESC PlatinumVESC Silver
Joined: 2016-12-27 20:19
Posts: 847

16 micro Amps standby should do the trick for you. The VESC 6 MKIV has exactly the feature you are looking for. If can also be set to fall asleep after a time X.

https://trampaboards.com/vesc-6-mkiv-in-cnc-t6-silicone-sealed-aluminium...

UncleJoe
Offline
Last seen: 1 year 2 months ago
Joined: 2018-06-02 05:42
Posts: 6

No ! the idle current was not that terrible 255mA I claimed. It was a measurement error because I used the 10A range on my multimeter, which is inaccurate (-255 mA actually) due to some kind of burn in? When I measure on the mA scale, the idle power is only 44.9 mA @ 12V.

I did some experiments to break down the power budget:

everything on 44.9
enter STOP mode (practically turns off everything, except SRAM and peripherals that can wake it back up) 6.2
WFI (wait for interrupt) loop   12.2
120 MHz clock 37.3
120 MHz clock, no green LED 37.2
96 Mhz clock,  no green LED 36.0
120 MHz clock, no green LED, changed after burn in? 34

The 6.2 mA from putting the STM32 to sleep is about right. According to the DRV8302 datasheet, the idle power is ~5 mA

DRV8302_idle_current.png

The remaining is probably going to the 5V regulator. What doesn't make sense is calling DISABLE_GATE() to turn off the DRV8302 enable pin, didn't make a difference.

I'm pretty familiar with STM32, so I experimented with different clock speeds (original is 168 MHz, the fastest possible). The lowest I could go was 96 MHz, but that was triggering watchdog time outs, so I ended up using 120 MHz. I don't understand why it needs to be so fast. That's 4800 CPU cycles for each 25 KHz switching period. Many other ESCs use ~10 MHz 8bit microcontrollers.

So now, 34 mA idle is good enough for me. Ther earlier, cheapo ESC drew 58 mA.

Then use a switch to provide this high voltage to the DRV

According to my measurements, the DRV idle power is a lot less than the microcontroller, so you should switch the STM32, though it might not be possible, or impractical.

The VESC 6 MKIV has exactly the feature you are looking for

That won't fit in the blower motor enclosure unfortunately

Here're my changes to set the clock to 120 MHz

diff --git a/conf_general.h b/conf_general.h
index 7fba140..4e5d2e6 100644
--- a/conf_general.h
+++ b/conf_general.h
@@ -263,7 +263,7 @@
 /*
  * MCU
  */
-#define SYSTEM_CORE_CLOCK			168000000
+#define SYSTEM_CORE_CLOCK			120000000
 #define STM32_UUID					((uint32_t*)0x1FFF7A10)
 #define STM32_UUID_8				((uint8_t*)0x1FFF7A10)
 
diff --git a/encoder.c b/encoder.c
index 8540df4..2583af4 100644
--- a/encoder.c
+++ b/encoder.c
@@ -289,7 +289,7 @@ void encoder_init_as5047p_spi(void) {
 	// Time Base configuration
 	TIM_TimeBaseStructure.TIM_Prescaler = 0;
 	TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
-	TIM_TimeBaseStructure.TIM_Period = ((168000000 / 2 / AS5047_SAMPLE_RATE_HZ) - 1);
+	TIM_TimeBaseStructure.TIM_Period = ((SYSTEM_CORE_CLOCK / 2 / AS5047_SAMPLE_RATE_HZ) - 1);
 	TIM_TimeBaseStructure.TIM_ClockDivision = 0;
 	TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;
 	TIM_TimeBaseInit(HW_ENC_TIM, &TIM_TimeBaseStructure);
@@ -343,7 +343,7 @@ void encoder_init_ad2s1205_spi(void) {
 	// Time Base configuration
 	TIM_TimeBaseStructure.TIM_Prescaler = 0;
 	TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
-	TIM_TimeBaseStructure.TIM_Period = ((168000000 / 2 / AD2S1205_SAMPLE_RATE_HZ) - 1);
+	TIM_TimeBaseStructure.TIM_Period = ((SYSTEM_CORE_CLOCK / 2 / AD2S1205_SAMPLE_RATE_HZ) - 1);
 	TIM_TimeBaseStructure.TIM_ClockDivision = 0;
 	TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;
 	TIM_TimeBaseInit(HW_ENC_TIM, &TIM_TimeBaseStructure);
diff --git a/mcuconf.h b/mcuconf.h
index 86cb3f9..e177db8 100644
--- a/mcuconf.h
+++ b/mcuconf.h
@@ -70,25 +70,25 @@
 #else
 // 8M XTAL
 #define STM32_NO_INIT                       FALSE
-#define STM32_HSI_ENABLED                   TRUE
-#define STM32_LSI_ENABLED                   TRUE
+#define STM32_HSI_ENABLED                   FALSE
+#define STM32_LSI_ENABLED                   FALSE
 #define STM32_HSE_ENABLED                   TRUE
 #define STM32_LSE_ENABLED                   FALSE
 #define STM32_CLOCK48_REQUIRED              TRUE
 #define STM32_SW                            STM32_SW_PLL
 #define STM32_PLLSRC                        STM32_PLLSRC_HSE
 #define STM32_PLLM_VALUE                    8
-#define STM32_PLLN_VALUE                    336
+#define STM32_PLLN_VALUE                    240
 #define STM32_PLLP_VALUE                    2
-#define STM32_PLLQ_VALUE                    7
+#define STM32_PLLQ_VALUE                    5
 #define STM32_HPRE                          STM32_HPRE_DIV1
 #define STM32_PPRE1                         STM32_PPRE1_DIV4
 #define STM32_PPRE2                         STM32_PPRE2_DIV2
-#define STM32_RTCSEL                        STM32_RTCSEL_LSI
+#define STM32_RTCSEL                        STM32_RTCSEL_NOCLOCK
 #define STM32_RTCPRE_VALUE                  8
-#define STM32_MCO1SEL                       STM32_MCO1SEL_HSI
-#define STM32_MCO1PRE                       STM32_MCO1PRE_DIV1
-#define STM32_MCO2SEL                       STM32_MCO2SEL_SYSCLK
+#define STM32_MCO1SEL                       STM32_MCO1SEL_HSE
+#define STM32_MCO1PRE                       STM32_MCO1PRE_DIV5
+#define STM32_MCO2SEL                       STM32_MCO2SEL_HSE
 #define STM32_MCO2PRE                       STM32_MCO2PRE_DIV5
 #define STM32_I2SSRC                        STM32_I2SSRC_CKIN
 #define STM32_PLLI2SN_VALUE                 192
diff --git a/servo_simple.c b/servo_simple.c
index 35f9f6e..ca5b561 100644
--- a/servo_simple.c
+++ b/servo_simple.c
@@ -40,7 +40,7 @@ void servo_simple_init(void) {
 	HW_ICU_TIM_CLK_EN();
 
 	TIM_TimeBaseStructure.TIM_Period = (uint16_t)((uint32_t)TIM_CLOCK / (uint32_t)SERVO_OUT_RATE_HZ);
-	TIM_TimeBaseStructure.TIM_Prescaler = (uint16_t)((168000000 / 2) / TIM_CLOCK) - 1;
+	TIM_TimeBaseStructure.TIM_Prescaler = (uint16_t)((SYSTEM_CORE_CLOCK / 2) / TIM_CLOCK) - 1;
 	TIM_TimeBaseStructure.TIM_ClockDivision = 0;
 	TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
 
diff --git a/ws2811.c b/ws2811.c
index 22b17c2..8e6d0c4 100644
--- a/ws2811.c
+++ b/ws2811.c
@@ -24,7 +24,7 @@
 #include "hal.h"
 
 // Settings
-#define TIM_PERIOD			(((168000000 / 2 / WS2811_CLK_HZ) - 1))
+#define TIM_PERIOD			(((SYSTEM_CORE_CLOCK / 2 / WS2811_CLK_HZ) - 1))
 #define LED_BUFFER_LEN		(WS2811_LED_NUM + 1)
 #define BITBUFFER_PAD		50
 #define BITBUFFER_LEN		(24 * LED_BUFFER_LEN + BITBUFFER_PAD)

 

skyline1970
Offline
Last seen: 5 months 2 days ago
VESC Free
Joined: 2017-09-07 22:28
Posts: 232

It is logical to shut-off DRV83xx. This could be done via a switch from pin55 and GND. When pin55 is GND level, it is off. This will provide a few hundreds uAmpers current comsumption.

It is recomended to insert a series 1N4148 diod, anode is at pin55, and cathode is at the switch,

A 15nF cap. is inserted with GND and pin 56. This will provide soft start, it is better protection for the IC itself.