Bench setup for stm32-sine development

arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Bench setup for stm32-sine development

Post by arber333 »

mjc506 wrote: Sun Dec 11, 2022 10:16 am Running the flywheel off a couple of pulleys would reduce vibration on the motor shaft (may need to deal with side load from the belt) and would allow you to 'gear up' the flywheel to get away with a smaller mass. I'm not sure if a small flyheel turning fast is better or worse than a large flywheel turning slowly though! A small flywheel would be easier to 'contain' inside a cage though.
Flywheel would only serve as acceleration/regen test prop. It wouldnt be good as a steady state load as it will want to absorb energy and will not release it easily. If you want to test your FOC/sine program you need steady state load as motor or a brake.
Using two motors you can electricaly connect a load you prefer. In your case you can even use 2kW dishwasher element. Its power requirement would be reduced by the lower voltage. Or you can connect series of H4 light bulbs etc...

I have HSG generator here and it is just perfect for belt load. You could even use AC compressor clutch to command the load on or off :).
Or you could use just normal washing machine motor usually it is rated from 300Vdc to 160Vdc.
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: Bench setup for stm32-sine development

Post by Pete9008 »

What might work well is an old flywheel based exercise bike. Replace the pedals with the motor and reuse the drive belt. The flywheel gives you regen and dynamic load and the exercise bike friction load/brake gives you a static load capability. It also removes virtually all the precision fabrication requirements and takes all the flywheel loads off the motor.

Edit - doubt most bikes are designed for more than a few 100W power so would have to be careful not to over speed/load it!

Edit2- thinking a little more the gearing on the existing belt would likely be wrong for the motor (geared up not down). I'd probably look at mounting a small rubber wheel on the motor shaft directly driving the perimeter of the flywheel which should provide a better ratio.
User avatar
johu
Site Admin
Posts: 5684
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Bench setup for stm32-sine development

Post by johu »

Sounds suspiciously like:


I've tried using brake disks as a static load, they overheat in no time and are quite smelly in the process
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
mjc506
Posts: 343
Joined: Wed Sep 09, 2020 9:36 pm
Location: Wales, United Kingdom
Has thanked: 30 times
Been thanked: 28 times

Re: Bench setup for stm32-sine development

Post by mjc506 »

Yeah, viscous fan or electrical load would be the best bet for running loads. A motor/generator could emulate a flywheel quite easily too, but does need another inverter.
User avatar
catphish
Posts: 954
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 93 times
Been thanked: 179 times

Re: Bench setup for stm32-sine development

Post by catphish »

Pete9008 wrote: Sun Dec 11, 2022 11:05 am What might work well is an old flywheel based exercise bike. Replace the pedals with the motor and reuse the drive belt. The flywheel gives you regen and dynamic load and the exercise bike friction load/brake gives you a static load capability. It also removes virtually all the precision fabrication requirements and takes all the flywheel loads off the motor.
I think a finned flywheel from an exercise bike or rowing machine is an excellent solution, it provides both a flywheel mass, and a load that increases with speed. I'll look into whether I can rig something like this up.
User avatar
catphish
Posts: 954
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 93 times
Been thanked: 179 times

Re: Bench setup for stm32-sine development

Post by catphish »

I decided not to worry about the flywheel for now. I've rigged up my encoder to the motor using 3D printed brackets and pulleys.

I've also now got the remaining connectors needed to hook up the Prius inverter control board, so hopefully I can get it up and running soon.

I'm rather unsure how to use the boost converter so I've made a separate thread to ask about that.
Attachments
PXL_20221221_171211107.jpg
PXL_20221221_171110404.jpg
PXL_20221221_171001564.jpg
User avatar
joromy
Posts: 371
Joined: Fri Jun 28, 2019 12:56 pm
Has thanked: 1 time
Been thanked: 3 times

Re: Bench setup for stm32-sine development

Post by joromy »

catphish wrote: Wed Dec 21, 2022 8:11 pm I decided not to worry about the flywheel for now. I've rigged up my encoder to the motor using 3D printed brackets and pulleys.

I've also now got the remaining connectors needed to hook up the Prius inverter control board, so hopefully I can get it up and running soon.

I'm rather unsure how to use the boost converter so I've made a separate thread to ask about that.
A little late in the process, but I have used a water pump in a similar setup.
Then you can choose the load by changing the hight of water outlet.
Works great, can run forever and never heats up.
Maybe a little difficult to calculate output power (efficiency) but should be possible if you know liter/min and hight.
IMG_20211018_184749_9.jpg
Thomas A. Edison “I have not failed. I've just found 10,000 ways that won't work"
User avatar
catphish
Posts: 954
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 93 times
Been thanked: 179 times

Re: Bench setup for stm32-sine development

Post by catphish »

I've got myself some switches and buttons to make up a dashboard (ON/OFF, START, FWD/REV), and am now getting to work on the wiring.

It's disappointing that there are no outputs on the VCU for CSDN and MSDN, and also that the output for CPWM is a low side switch, despite the the fact that this line is active high. Therefore, after a lot of thought about this, I think the most sensible approach will be the following:
  • Attach MSDN and CSDN to toggle switches to allow them to be switched on and off. In theory they can be on all the time, but it makes sense to have the option to shut them down manually.
  • Pull, CPWM low so that it is inactive by default, and add a PNP transistor between the VCU and CPWM so that its low side switch can pull CPWM high on demand.
Attachments
PXL_20230101_162907496.jpg
PXL_20230101_184108181.jpg
User avatar
catphish
Posts: 954
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 93 times
Been thanked: 179 times

Re: Bench setup for stm32-sine development

Post by catphish »

Bench setup is now complete and running. So far I've only done very low power testing using my bench power supply but everything is working as it should. The boost converter in the Prius inverter seems very capable so I'm hopeful that a single 60V battery module will b sufficient. Photos attached of full setup.
Attachments
PXL_20230106_184350632.jpg
PXL_20230106_115140443.jpg
PXL_20230106_131018887.jpg
User avatar
catphish
Posts: 954
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 93 times
Been thanked: 179 times

Re: Bench setup for stm32-sine development

Post by catphish »

I've now got underway testing some code changes. I will discuss those in separate threads. After using the setup for a while this evening, it's clear that I need to make two additions:
  • SWD programmer, the ESP8266 serial update process is too unreliable to continual updates and testing.
  • CAN interface, because the ESP8266 graphing process isn't nearly as nice as Savvycan.
The lack of load on the motor shaft is a little disappointing, but not critical. Ultimately I can always test that code is safe on the bench setup, and then test more thoroughly in my car.
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Bench setup for stm32-sine development

Post by arber333 »

catphish wrote: Sat Jan 07, 2023 12:24 am I've now got underway testing some code changes. I will discuss those in separate threads. After using the setup for a while this evening, it's clear that I need to make two additions:
  • SWD programmer, the ESP8266 serial update process is too unreliable to continual updates and testing.
  • CAN interface, because the ESP8266 graphing process isn't nearly as nice as Savvycan.
The lack of load on the motor shaft is a little disappointing, but not critical. Ultimately I can always test that code is safe on the bench setup, and then test more thoroughly in my car.
If you dont mind... i suggest you take the fan off the rear of the motor and put encoder there.
Then you can think of connecting any load you want since you wont be hampered by the pulley from a sensor in front.

Or you could just 3d print a wheel and use 1ch optical encoder :) works great for ACIM. https://mazdamx3ev.wordpress.com/2015/0 ... er-senzor/
johnspark
Posts: 264
Joined: Fri Apr 12, 2019 10:42 pm
Location: Adelaide, South Australia
Has thanked: 59 times
Been thanked: 48 times

Re: Bench setup for stm32-sine development

Post by johnspark »

I don't like flywheels. The motor flywheel combination will have at least 1 resonant frequency, this is when things vibrate to bits. Maybe an old exercise bike, keep the magnets that put drag onto the flywheel. For regeneration, remove the magnets and get a little bit of regen from the spinning exercise disk? What about a pulley that has a rope on it to lift a bucket. For regen, as the bucket falls, regen occurs. Not that silly, some companies are actually looking at lifting or lowering large pieces of concrete for energy storage instead of using batteries...
User avatar
catphish
Posts: 954
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 93 times
Been thanked: 179 times

Re: Bench setup for stm32-sine development

Post by catphish »

So, now that my test setup is up and running, I've been able to experiment with a few code changes. These are a combination of minor bug fixes, and things I'd like to test in my car but wanted to test on the bench first for obvious safety reasons. Unfortunately, due to British weather, I'm not really able to test these changes in my car for now, but here are the first of the patches:

Patch 1: This is a safety improvement. It prevents regen-runaway by ensuring that reverse regen torque can never be applied if the vehicle is already going backwards. https://github.com/catphish/stm32-sine/ ... 2796794b9d

Patch 2: This patch probably doesn't do anything because the functionality works by accident anyway, but I think it's better to fix it anyway. slipIncr stores negative numbers, so lets make it signed. https://github.com/catphish/stm32-sine/ ... ca7cc6b8ed

Patch 3: This patch causes rotor speed to be measured as a signed value. The only impact this has at the moment is that when the vehicle is rolling backwards, but the direction is set to forwards, it allows the sine wave voltage to be calculated correctly. This might help with smooth acceleration when rolling backwards. https://github.com/catphish/stm32-sine/ ... de21d4701c

Patch 4: This one allows the user to choose an alternative throttle map which scales voltage and slip simultaneously rather then sequentially. The main reason I added this was to allow me to set fslipmax=fslipmin=3 and allow the full range of throttle to be used, but while still allowing it to scale up to a higher fslipconstmax=5 at higher speeds. This is very much experimental and testing in real vehicles will be the test of whether is't useful. https://github.com/catphish/stm32-sine/ ... c2abdce194

Patch 5: Make sine output filter configurable. The hardcoded default appears to slow throttle response by filtering it over 160ms. This is a noticeable lag while driving. This patch adds an option sinefilter that allows the user to change the strength of the filtering. https://github.com/catphish/stm32-sine/ ... 2beade0f18

In addition to these, I'd like to add a patch that scales "off throttle regen travel" with vehicle speed, but that is proving a little more complicated.

Any comments and suggestions are very welcome!
User avatar
catphish
Posts: 954
Joined: Fri Oct 08, 2021 11:02 pm
Location: Dorset, UK
Has thanked: 93 times
Been thanked: 179 times

Re: Bench setup for stm32-sine development

Post by catphish »

Today there was a break in the weather and I got to test these patches in my car. The results are rather unexciting.

Patch 1: Assumed to be good, but not actively tested. :mrgreen:

Patch 2: Assumed to be good, didn't seem to change anything. :mrgreen:

Patch 3: Assumed to be good but didn't solve the problem it aimed to solve, so in that way it was disastrously pointless. :?:

Patch 4: Failed. Serious bug. :x
Replacement Patch 4: https://github.com/catphish/stm32-sine/ ... 37d1db6ffe

Patch 5: This one works. One can sacrifice a little stability for throttle response. I reduced the filter from 4 to 3 and would suggest this was an improvement. :mrgreen:

I will need to continue to investigate why I am unable to achieve smooth braking at low speed. When pressing the throttle while rolling backwards, it should be possible to control the braking torque, but instead the vehicle always comes to a sharp stop.
Post Reply