• Test ESC stuff

    12/30/2019 at 12:05 0 comments

    I'm building a BLDC ESC based on

    • EFM8BB2 running BLHeli_S
    • NCP81253 Gate Driver
    • SIZ322DT NFET pair
    • and a DMN2990UDJ fual NFET for level shifting between 3V3 (MCU) and the 5 V gate driver logic

    As long as the MCU isn't programmed, it should be possible to inject the level shifter input from an external source.

    Schematic of one half bridge driver:

    The level shifter is to the left (Q5, R12, R13), gate driver in the middle (U4, C7, C8) and motor driver FETs to the right with some feedback resistors (labeled "easy access" because I'm not sure about the values).

    VBat can be between 2.5 V and 12.6 V (maybe 16.8 V) and I'm currently using a 2S LiPo charged to 7.5 V.

    Gate Driver:

    The gate driver will switch on the high side FET if PWM is high. It will switch on the low side FET when PWM is low, and it will disable both if PWM is somewhere in the middle.

    Level shifter logic:

        Cc Cp PWM PFET NFET
    1)  0  1  2V5 off  off
    2)  1  1  0V  off  on
    3)  0  0  5V  on   off
    4)  1  0  0V  off  on

     This makes the whole driver stage look like some sort of an imaginary PFET-NFET pair (line 4 in above table is an exception to that).

    The problem

    When I apply 0 V to Cc and 0 V to Cp, the high side FET isn't on. I can only measure some 3.8 V, but it should be VBat. It was pointed out in the hack chat that the gate driver might require PWM with a duty cycle less than 95% to work correctly, so I also tried with 24 kHz PWM and 90% duty cycle. Since Cc logic is inverted, I actually injected 10% duty cycle on Cc.

    The above was measured with a multimeter.

    Things look different with a scope

    Input to level shifter and its output to the gate driver; Ch1: PWM to gate driver (5V logic), Ch2: input to level shifter (3V3 logic, signal Cp):

    That the PWM signal (Ch1) is going to 2V5 instead of 0V is caused by the voltage divider (R12 and R13). The gate driver handles a 2V5 input by disabling both output FETs. Input Cc was low all the time.

    The output of the gate driver can't really be accessed so I took a look at the output (testpad to the right in the schematic). Ch2 is still the 3V3 input, Ch1 is the testpad output:

    Indeed the output goes to VBat so the high side FET is switching on. It doesn't go down to 0V when off because the low side FET is never on.

    Next steps:

    • Connect Cc to Cp to have complementary output with the low side FET
    • Add a light load to the output. Since I only have 1/4 W resistors, a couple of 680 ... 1K Ohm resistors in parallel should be fine.

    Again thanks to Bharbour for helping.

    That helped!

    Driving both FETs and adding a load of 6 x 1 kOhm (lack of power resistors...) helped. The following screenshot was made with a 3S battery at 11.4 V, and that's what I'm seeing at the output. Ch1 is the input to both Cp and Cc, and Ch2 is the output at the motor pad:

    Time to figure out how to program the on-board MCU.

  • Light box

    01/06/2018 at 21:43 0 comments

    Created a foldable light box out of

    • cardboard
    • painter's tape
    • some white cloth
    • double sided tape
    • white paper
    • four round 10x2 magnets
    • four M5 nuts

    Tools:

    • Scissors
    • knife
    • hot glue gun
    • pen

    The first two picture show the general layout. The flaps you see in the first picture to the left are just painter's tape with magnets to hold the thing together when it's put together for use. You can also see - in the third rectangle from the left - the two nuts that the magnets hold on to.

    Plugged together:

    First light:

  • Sonoff basic flash mode

    12/15/2017 at 21:51 0 comments

    Today I was trying to download custom firmware to a sonoff basic. For those who don't know what that is: It's an ESP8266 with a flash chip, power supply, and a relay that you can use to switch a 230 V load. Really simple, and since it's based on an ESP, also very hackable. There's even some holes for a header with 3V3, RX, TX and GND that yells at you to plug in your own code. So I wanted to do just that.

    Basically, flashing is as simple as for any other generic ESP board, especially with arduino which uses esptool under the hood. Many tutorials describe the basic workflow:

    • unplug the device from mains, if it was connected before
    • really do that previous step!
    • wait until everything has discharged and is safe to touch
    • wait some more
    • solder in a 4- or 5-pin header (the fifth pin is not necessary)
    • connect a USB to serial converter
    • supply the chip with an external 3V3 power supply (capable of supplying 300 mA or so)
    • use esptool to flash your own firmware.

    I won't repeat the numerous pictures here, just google for "sonoff basic flash" or something similar.

    However, I ran into a problem: After esptool reported that it had flashed the new firmware successfully, my ESP just wouldn't run. I finally found this issue on github:

    https://github.com/letscontrolit/ESPEasy/issues/474

    It boils down to this: when flashing, you have to do so in DOUT mode. You can select this in the arduino tools menu or on the command line for esptool.