• Microcontroller results

    FoxHood11/04/2025 at 12:11 0 comments

    Had to take a break from electronics projects due to personal circumstances. Honestly the first version of the code been working for a while now, but never got around to adding a log...

    Anyway back to where i was. Code was put on the Github.

    FAN control (brief):

    On FAN control theory i am mostly relying on the engineering documentation publicized by Noctua. Which describes the standard PWM control scheme as:

    • PWM Signal with a working frequency of ~25Khz.
    • A Duty Cycle between 40-100%.
    • Tachometer is a Open-collector that generates a square wave signal at twice the frequency of the fan itself (RPS = ~RPM/30)

    Whenever possible the controller will stick to PWM control, but if all else fails it can try to control the fan by pulsing the 12V load switch.

    PWM Generation:

    The ATtiny414 used has by default a clock speed via internal oscillator of 20Mhz. Which is a nice significant improvement over older AVR chips that could only reach like 8Mhz.. But that doesn't matter here. It just needs to generate a PWM signal, blink leds and read an encoder.

    I figured that by dividing the main clock by 8 i would get 2.5Mhz. Which when run without prescaling through a Timer with a TOP limit of 100. Gives a very clean 25Khz signal of which the duty cycle is handled in 1% steps. Which is perfect for this application.

    Tachometer monitor:

    The tachometer serves two purposes. During power-up the controller will try to check if the FAN is PWM capable by monitoring the tachometer frequency and checking if it speeds up significantly when the PWM signal goes up. This sets whether it will be controlling the fan by PWM control signal or by PWM on the power. If no signal is present, the controller will cut power and lock itself.

    During operation the Tachometer monitors for any error. If the fan halts (jammed/disconnect) or speeds up abnormally . The controller will cut power and lock itself until the next power-cycle.

    Originally i wanted to hook the Tachometer up directly to a timer in frequency measurement mode via the AVR Event System, but I've been unable to get it working just yet (might need to check the errata). So for now i'm just sticking to a Timer implementation that counts pulse width duration via a variable and calculates the actual RPM whenever the state changes. It is effective enough.

    Encoder Input:

    Encoder input is handled by a simple input Interrupt on the A signal, with B then being tested to know if a value increment or decrement occurs and then adjusting the target speed. The new value is passed on to the PWM generator and LED output.

    Led Output:

    Handing the charlieplexing of the leds is done in the main while(1) loop. It is nothing fancy. Just constant blinking to keep persistence of vision up.

    RESULTS:

    Honestly am already quite happy. It isn't perfect, but it does the job admirably and for what is meant to be the most compact little controller i could create that could be powered from a old charger: That is good enough.

    Bugs:

    The monitoring is still a bit buggy. Adjusting the speed also moves the expected RPM and if you do something like very quickly changing speed or suddenly try to reduce speed while the fan is spinning up. It might trip and think something went wrong. Will need to improve logic or make the net wider. Honestly would probably need to get one of the smaller speed-demon fans to also test.

    TO-DO:

    • Fix the monitoring bug
    • Add a soft-reset so you don't have to unplug to get it out of error. Just a hold encoder button thingy.
    • Design a small plastic casing, 3D-Print and show photos of the board.
    • Test with other fans... specifically heavy duty industrial and tiny speed demons.

  • First Test (no Controller)

    FoxHood08/11/2024 at 23:45 0 comments

    I had ordered my boards last week and soldered them. Just In time for a 32 degree heatwave.

    I was also a fool and forgot to order the resistors. So i ended up approximating 12V by using a 13K R1 and two 220k stacked ontop of eachother for R2 to get a close enough result (11.8V). Going to have to recalculate it anyway for like 12.1V. You'd be surprised how much those few hundred millivolt matter for these fans.

    Right now the Controller is blank and i used the Jumper to skip the load switch. The board is essentially just the boost converter atm. Without a PWM signal any fan should just go full-speed.

    Multimeter shows a correct 11.8V so i connected a fan for testing along with an Picoscope. The fan is a standard 120mm Noctua Redux 1700 fan which should do well as indicator for an "Average" fan

    A look at the output shows a steady 11.85V for most of the time. The fan is an inductive load causing these sudden spikes. Though they aren't small the RMS is still stable enough for the fan to still go full speed. The power supply i connected indicates the circuit consumed just under 300mA. So it seems like it would work even on a old-fashioned 500mA USB port. I call that an early success!!

    Also quite impressed with the LMR62421. These modern high-frequency Switching regulators are really good, dirt-cheap and with such a tiny footprint too!! If the step-down sibling also proves to work i'll be looking at cutting out 7805 compatible regulator modules out of every project i have. Those are so expensive....

    Anyway. This means i can start work on getting the controller in order. Already tested out the theory on a different AVR chip, but i gotta migrate it over to this one. Will want to retest once the load switch is in-line with the load and maybe experiment with an extra capacitor to see if the spikes can be somewhat muffled with extra capacitance to take the hit.

  • Version One

    FoxHood08/11/2024 at 23:44 0 comments

    Version one is fairly simple. Circuit has 6 parts: Receptacle, Booster, Load-switch, Encoder, Output and Microcontroller.

    Receptacle:

    The receptacle is a common 6P Power-Only USB-C port (USB4125). With a set of 5.1K resistors to signal to a USB-C Supply that it is downstream device.

    Booster:

    The Booster is made with a Texas Instruments LMR62421 switching controller. This is a tiny, cheap little booster that can convert 5V to 12V. Being SOT-23-5 renders it easy to hand-solder.

    Since there are 5V Fans out there and i like my designs Flexible: A solder jumper is placed that can bypass the entire booster.

    Load-Switch

    Not all fans shut-down at 0% PWM, for these a way to shut the fan off is needed. Originally i thought about using the Boost Converter's EN pin, but that wouldn't really shut output down as much as just let the 5V pass through the Inductor and Diode. Powering the fan with ~4.5V.  So a full switch was needed.

    The Switch is a standard High-Side FET switch. The FET i used is a PMV50EPEAR that can switch about 4A. Though any SOT-23 Power Pfet with a GSD pin order should work here.

    A Solder Jumper is available to cut out the switch in its entirety. Be it due to lacking components or running without a controller as just a dumb 12V supply.

    Encoder

    A standard Bourns EC12R-S encoder will provide input. Components around it are chosen according to recommended design in datasheet.

    Rotating will manipulate the speed. Pressing it will toggle the controller on/off

    Output:

    Output is mostly just a pair of specific Molex 47053-1000 headers, commonly known as PWM Fan Headers (idk what it is with brands like Wurth and Molex insisting on these obtuse numbered names...). Although they allow for 2 fans to be connected. They both have the same PWM signal and only the top one has its Tachometer connected to the Controller. This effectively is the same as using a Splitter cable

    A reverse polarity shunt diode is placed just in case. These fans are inductive loads after all.

    Controller

    Actual Brains is going to be a Microchip ATTiny414. AVR chips may have gone out of style a little over the years as ARM and RISC-V have spread. But for small jobs like these you just can't beat the reliability.

    This is going to be my first time dealing with a newer "tinyAVR 1-Series" chip. Used to the old ATMega8 and the ATTiny2313. Supposedly these newer chips don't need external resonators anymore to get to 16Mhz and have far greater flexibility when it comes to IO interrupts. Going to be a fun experience in figuring these out and trying out the Serial UPDI feature of AVRdude to program them. Do like how these days just 3-pins are needed for programming.

    For indicating set speed i opted for a whole bunch of leds in a Charlie-Plexing setup. To get the most out of the IO-Pins. With a quick pair of regular connected diodes for Status (Turned off and Fan-Detected)


    The real challenge was cramming it all. I think i managed to do a decent job.

    Being one of my first KiCad designs it took a little to figure out symbols, footprint and IO, but once i got going it went really quick. KiCad feels way more expedient than Eagle. Especially with how many footprints it already knows. Some footprints like the USB4125 i quickly modified to have longer pads for hand-soldering. That KiCad lets me do that quickly in a design and only for that design is a godsend.

  • Initial concept

    FoxHood08/11/2024 at 21:16 0 comments

    The idea was that while my main goal is the creation of a big fancy controller with multiple channels that is just over-engineered cause i want to. I also wanted to create a tiny "Minimum Viable Controller". One that is just for controlling one single channel and do so without much of a fuss. Basically the controller i SHOULD create.

    So the USB Powered "MVC" was born. Created with a small, cheap boost-converter that is easy to hand-solder, a cheap ATTiny controller that is easy to program (all you need is a generic USB->UART bridge, A schottky diode and maybe a resistor) and equipped with a simple "Power-Only" USB-C connector.

    I want people to be able to make a bunch of these by hand for less than 20 USD/Euros max.