Pages

Tuesday, January 15, 2019

T19 Build Guide - Part 10 - Flywheel Motor Controllers


This post is a lot of discussion and info and then we get into work at the end. It will cover the standard option: Atmel ATmega8-based hobbytrollers/RC ESCs, running the modified SimonK variant that I maintain for this specific application. (See the part 10a detour post if you wish)

Here's what to look for in a prospective SimonK Hy-Con (or other flywheel drive) controller:
  • Has an ATmega8 chip... obviously. (Not Silabs C8051F3xx or EFM8BBxxxx, which is the other white meat of 8 bit hobby controllers)
  • Has a large enough inverter: Generally, a suitable board is rated for AT LEAST 20A. Most I would call suitable have a 30A rating on the nameplate.
    • Look at the datasheets for the MOSFETs - they should be rated for at least 30Adc and 120-600+ A transient (depending on the manufacturer's transient rating convention). The Afro RaceSpecMini 20A is an example of a board that has a "20A" rating and yet has SON package devices that are perhaps not up to this app.
  • Is reasonably reputable. Be careful buying unrefined Chinesium, such as "eBay special red SimonK ESCs". You never know what you actually get with those.
  • Is a reasonably modern design so you get modern robust MOSFETs. Atmel-based hobbytrollers go back YEARS and there are some real dinos out there. If you encounter an inverter with P-channel switches in it, that's why. Those would probably do OK, but yeesh, P-channels.
  • Is supported by SimonK
  • Is capable of being clocked at (standard) 16MHz on SimonK, not 8MHz - look up your board type.
  • Is a good hardware design. Some types of boards have layout or parasitics problems with the BEMF sense circuits and are known as frequent sensorless misbehavers/bad starter-uppers. Don't use those here. Google your ESC model.
Two examples of suitable T19 motor controllers. Left: ZTW Spider 30. Right: Afro "20A fullsize".

Some common examples:
  • Afro - 30A full size, 20A full size (which I commonly use), 20A Slim, 30A RSM, and 20A HV versions all have good robust inverters with Fairchild FDMS8018 or Toshiba TPCA8087 devices.
    • The 20 RSM, 12A/12 Ultralite, are not suitable for 'cons and other larger/higher power drives
    • Availability problems. Many of these boards are out of production and stock depleted.
    • Some runs of these have defective ATmega8 chips with bad comparators causing misbehaviors. I run into several 20A fullsizes that act wonky, especially by failing rolling restarts from low speed, and can't to date be compensated for in software.
    • These are afro_nfet and afro_hv (20A HV with dedicated gate drivers) board targets.
  • ZTW Spider - the 30A version is probably most applicable. I have a number of these. Some may not have a one-wire flash bootloader stock like Afroes, and thus need to be unwrapped and ISP-ed with an arduino or USBasp or the like the first time you flash them.
    • These are generally bs_nfet board targets ("Turnigy BlueSeries"), but some differ. Google yours.
    • Watch out for "Spider PRO". These are Slimelabs-powered, BLHeli-running imitators that look similar!
  • DYS SN30 - and SN30A, also SN20/SN20A (use the 30 versions on Hy-Cons), and clones thereof - these are a small, slim, "BLHeli-Era style" board layout. They can be flaky physical quality.
These are just the highest profile ones. Many, MANY hobby ESCs past and present have ATmega8 chips, are SimonK-supported, and are suitable. As the trendy drone market has decided Atmel AVR = uncool lately, it may be necessary to NOT expect to use drone-market controllers that come/came stock with SimonK.

In any case: When dealing with any brand of hobbytrollers, always buy more than the two you expect to use. Same goes for hobby-market motors, really - there are lemons. Waiting for a replacement of the offending drive component when you have a build 99% finished and then find you have a dud part, sucks. You will wind up using the extra later on or else keep as spare if you don't need it.

Tools/Parts/Materials:
  • Computer, with necessary Atmel AVR flashing toolchain. This, at minimum, is avrdude and the device driver/kernel module for whatever sort of serial interface/ISP device/USB dongle you use to connect to the microcontroller or board, but a convenient GUI utility for flashing AVR powered ESCs is KKMulticopter Flash Tool.
  • AVR flashing hardware. If your ESCs have a one-wire bootloader like the SimonK one already installed (which allows flashing over the throttle cable), this can be something like the Afro or Turnigy USB Linker. If not, you need an AVR ISP device and to connect to the 6 ISP pads on the board.
  • If you need to change wiring (The boards should have ~4" DC bus leads with 3.5mm male bullets, a ~10" throttle cable with a 3 pin female 0.1" connector, and ~2" phase leads with matching bullet connectors for your motors):
    • Soldering iron
    • Flux
    • Leadfree solder
    • Wire cutting/stripping tools
    • Heatshrink
    • Connectors
  • The boards, of course.
Here is a 20FS Afro from earlier wired with 2mm bullets to match my motors' phase connectors. I leave these stock bullets on the motors. You can substitute a single-piece three-phase connector, direct solder the phase wires onto the board drone-racer style, or use the existing 3.5mm bullets on these Afroes and change the motor wiring instead - Doesn't matter, just make it hook up and work.


Obtaining the firmware:

I put up tested binary builds as well as the source on on the DZI Google Drive here: https://drive.google.com/drive/folders/1frGGqdCYReqgqNWM6G-BrLLElJN7hRM7?usp=sharing

The current flavor of the fixed-speed wheel drive firmware has all earlier optimizations posted on this blog, plus uses 10kHz PWM frequency with a modification to do 5kHz in startup mode, and is my most robust and tolerant build yet.

If you are using a board I don't publish a binary for or need/want to change governed speed (currently only Afro and 25.5kRPM), or need to fix tuning issues:
  • DIY: Install AVRA (AVR Assembler), and build SimonK from source using my tgy.asm version dropped into SimonK 2015-09-30 - for example, "make bs_nfet.hex" in the directory containing the SimonK source tree. Check the corresponding include file such as bs_nfet.inc first to be sure important settings like timing aren't clobbered by its stock state.
  • In over your head, dislike it, want a life jacket? Message me on Reddit (/u/torukmakto4) or send me an email at torukmakto4@gmail.com with something about SimonK, brushless, Hy-Con, etc. in the subject. Don't use Facebrick PMs or blog comments if urgent (I might NOT receive them quickly), provide as MUCH INFO as possible on your board type, desired governor setting, etc. and I will configure and build a firmware for your application and drop the binary in the Drive.
Here's flashing these Afroes with KKMulticopter Flash Tool:


To properly enter the SimonK bootloader for flashing with a throttle-wire toolstick like this:
  • Connect the programmer to the ESC
  • Then power up the programmer and/or connect it to the computer
  • Then apply DC bus power to the ESC. (If you power it up without the programmer signal, it will boot normally, which is not desired)


Select your programmer type: here an Afro USB linker.

Select the device filename for the programmer. KKMFT should try to autoselect the right device. Doesn't seem to show up? Make sure the driver is installed and works, for instance the Afro USB linker is a Silabs USB serial interface IC and has a driver from its vendor Silabs.

Select "atmega 8-based brushless ESC (8kB flash)"

Select the File tab and click the floppy disk button to pop up the file picker. Find the firmware binary and select it. Note I am using the latest tune of the stock T19 wheel drive firmware (afro_nfet_reschedule_10khz.hex)  for this example. Be EXTREMELY SURE one last time that you have the correct board target built for your ESC!! The wrong build for the board can immediately blow shit up.

Click the green button and have a tense moment while flashing.

When you get "Flashing of firmware was successful", you are out of the woods - at least until you unplug the programmer and it boots for the first time. No smoke? Now REALLY out of the woods.

If you have a test throttle generator, hook up the controller along with a 4S battery and give your still-unproven ESC a test spin with one flywheel of the cage. The drive should spin up smoothly from 0 rpm without any "misfires" and snap hard up to full speed. Restarts from running should be flawless. Restarts from very low but nonzero speed should also immediately start accelerating again. If you do not have one, these tests can be performed later on during commissioning with your actual blaster controller by firing the blaster.

If you have a startup or rolling-start anomaly with this firmware, you probably definitively have a lemon board - try another. Get it squared away. An occasional desyncy, laggy spinup due to a bad chip/board is a failure for this app and needs addressing.

No comments:

Post a Comment