AVR Microcontroller Doubles Up As A Switching Regulator

[SM6VFZ] designed, built and tested a switched-mode DC-DC boost regulator using the core independent peripherals (CIP) of an ATtiny214 micro-controller as a proof of concept, and it looks pretty promising!

A Buck, Boost, or Buck-Boost switching regulator topology usually consists of a diode, a switching element (MOSFET) and an energy storage device (inductor/capacitor) in the power path, and a controller that can measure the output voltage, control the switching element and add safety features such as current limiting and temperature shutdown. A search for switching regulators or controllers throws up thousands of parts, and it’s possible to select one specifically well suited for any desired application. Even so, the ability to use the micro-controller itself as the regulator can have several use cases. Such an implementation allows for a software configurable switch-mode regulator and easy topology changes (boost, buck, fly back etc.).

The “Getting Started with Core Independent Peripherals on AVR®” application note is a good place to get an overview of how the CIP functionality works. Configurable Custom Logic (CCL) is among one of the powerful CIP peripherals. Think of CCL as a rudimentary CPLD — a programmable logic peripheral, which can be connected to a wide range of internal and external inputs such as device pins, events, or other internal peripherals. The CCL can serve as “glue logic” between the device peripherals and external devices. The CCL peripheral offers two LookUp Tables (LUT). Each LUT consists of three inputs, a truth table, a synchronizer, a filter, and an edge detector. Each LUT can generate an output as a user programmable logic expression with three inputs and any device that have CCL peripherals will have a minimum of two LUTs available.

This napkinCAD sketch shows how [SM6VFZ] implemented the boost regulator in the ATtiny214. The AND gate is formed using one of the CCL LUT’s. The first “timer 1” on the left, connected to one input of the AND gate, is free running and set at 33 kHz. The analog comparator compares the boosted output voltage against an internally generated reference voltage derived from the DAC. The output of the comparator then “gates” timer 1 signal to trigger the second “timer 2” — which is a mono-shot timer set to max out at 15 us. This makes sure there is enough time left for the inductor to completely release its energy before the next cycle starts. You can check out the code that [SM6VFZ] used to built this prototype, and his generous amounts of commenting makes it easy to figure out how it works.

Based on this design, the prototype that he built delivers 12 V at about 200 mA with an 85% efficiency, which compares pretty well against regular switching regulators. Keep in mind that this is more of a proof-of-concept (that actually works), and there is a lot of scope for improvement in terms of noise, efficiency and other parameters, so everyone’s comments are welcome.

In an earlier blog post, we looked at how ATmegas with Programmable Logic came about with this feature that is usually found in PIC micro-controllers, thanks to Microchip’s acquisition of Atmel a few years back. But we haven’t seen any practical example of the CCL peripheral in an Atmel chip up until now.

Russian Hacker Multiplies Value Of Boost Converter

We have a love/hate relationship with LiIon batteries. They pack all this power in such a small and light package. But for running 3.3 V devices, they’re cumbersome. They need to be stepped down a little bit when they’re fully charged at 4.2 V, but then they need to be stepped up at the end of their charge around 3.0 V.

A simple boost or buck converter can’t do both jobs, although you’d be tempted because they can be purchased for peanuts online. So [Kirich] hacked cheap boost converters into the more capable SEPIC topology, which sell for nearly 10x as much. (Google translated version here.) The bottom line? With a little desoldering, a cut trace here and an extra inductor there, and [Kirich] had a very capable circuit that would maintain a constant 3.3 V output when the input swung between 1 V and 5 V.

95aa17If SEPIC power converters are foreign to you, have a read through Maxim’s white paper on the subject. Basically, it’s a boost converter with a capacitor in the middle that lets the output voltage drop below the input voltage. An extra inductor keeps the output side of this capacitor at ground potential (on average).

If you want more detail, [Kirich] doesn’t disappoint. He tested his modifications in multiple configurations on two different models of boost converter. As you’d expect with power circuitry, layout and trace length matters, and [Kirich] took good notes. This is a great read for the frugal hacker, or anyone who’s interested in boost/buck converters.

Speaking of boost/buck circuits, we’ve got some more links for you. This video from Sparkfun’s [Pete Dokter] is worth fifteen minutes, and if you want to get your hands really dirty in the construction of such circuits, this ATtiny-based boost converter circuit is fun to play with.

Thanks [kirillre4] for the great tip!

Nixie Clock Uses Ingenious Software RTC

There’s something about Nixie Tube Clocks that keeps drawing hackers to build their own iterations, even if its been done a gazillion times before. Their depleting supply, and the high voltage drivers to control them, makes it all the more interesting. [Pete Mills], a veteran of several interesting projects, many of which we have featured here, is no exception and decided to build his own version of a Nixie Tube Clock, but with several nifty features.

To put it in a nut shell, his Clock uses Nixie tubes for display, has USB serial communication, temperature measurement, AC frequency measurement, time and date keeping with a software based RTC, software driven boost converter for the 175V DC nixie tube supply and a windows app for clock configuration.

The software based time keeping is pretty interesting. It is essentially a method to calibrate the crystal to more closely match real time, and some code to keep track of the time and date.  This obviously leads to a reduction in components and the spin-offs that comes with that; increased reliability, cost reduction, real estate savings. The RTC code can easily be ported to other clock projects irrespective of the display used. Besides keeping track of time and date, it can also account for leap years, and report the day of the week. A zero-crossing detector connected to the low-voltage transformer supply that powers the clock can also be used as an alternative way of keeping time.

When connected to a serial console over UART, the clock can report back many variables depending on the queries it receives. The high voltage DC needed to drive the Nixie tubes is generated using a simple boost converter controlled by the micro controller. An important “gotcha” that [Pete] deduced after blowing off several fuses, was to disconnect the micro controller port connected to the PWM timer and explicitly set it to output low via software. There’s a couple of other issues that he ran into – such as board layout, power supply, incorrect pullups – that make for interesting reading. The clock enclosure is still work in progress, but [Pete] hopes to get it done sometime soon.

He also wrote a Windows application – Nixie Clock Communicator – to help with time setting and calibration. Finally, he describes in detail the process of calibrating the clock’s software based RTC. Based on his calculations, the clock will drift by about 48 seconds over an 8 month period. Since he will be adjusting for DST much sooner than that, his clock ought to be off from correct time by not more than a minute at any given time. Not bad for a clock that does not use a dedicated RTC chip. [Pete] still has some of the prototype boards to give away if someone is interested. If you’d rather build it yourself from scratch, [Pete] has posted the software code, schematics and PCB, and a BoM.