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.

DIY Magsafe Charger Feeds Off 12 V Solar Battery

[Steve Chamberlin] has a spiffy solar-charged 12 V battery that he was eager to use to power his laptop, but ran into a glitch. His MacBook Pro uses Apple’s MagSafe 2 connector for power, but plugging the AC adapter into the battery via a 110 VAC inverter seemed awfully inefficient. It would be much better to plug it into the battery directly, but that also was a problem. While Apple has a number of DC power adapters intended for automotive use, none exist for the MagSafe 2 connector [Steve]’s mid-2014 MacBook Pro uses. His solution was to roll his own MagSafe charger with 12 VDC input.

Since MagSafe connectors are proprietary, his first duty was to salvage one from a broken wall charger. After cleaning up the wires and repairing any frayed bits, it was time to choose a DC-DC converter to go between the MagSafe connector and the battery. The battery is nominally 12 volts, so the input of the DC-DC converter was easy to choose, but the output was a bit uncertain. Figuring out what the MagSafe connector expects took a little educated guesswork.

The original AC adapter attached to the charger claimed an output of 20 volts, another Apple adapter claimed a 14.85 V output, and a third-party adapter said 16.5 volts. [Steve] figured that the MagSafe connectors seemed fine with anything in the 15 to 20 V range, so it would be acceptable to use a 12 V to 19 V DC-DC boost converter which he had available. The result worked just fine, and [Steve] took measurements to verify that it is in fact much more efficient than had he took the easy way out with the inverter.

MagSafe has been displaced by USB-C nowadays, but there are plenty of MagSafe devices still kicking around. In a pinch, keep in mind that a little bit of filing or grinding is all that’s needed to turn MagSafe 1 into MagSafe 2.

Tiny Cube Hosts A Hearty Tube

Tiny PCBAs and glowy VFD tubes are like catnip to a Hackaday writer, so when we saw [hamster]’s TubeCube tube segment driver we had to dig in to learn more. We won’t bury the lede here; let’s enjoy a video of glowing tubes before we go further:

The TubeCube is built to fit the MiniBadge badge addon standard, which is primarily used to host modules on the SAINTCON conference badge. A single TubeCube hosts a VFD tube, hardware to provide a 70 V supply, and a microcontroller for communication and control. Each TubeCube is designed to accept ASCII characters via UART to display on it’s display, but they can also be chained together for even more excitement. We’re not sure how [hamster] would be able to physically wear the beast in the video above, but if he can find a way, they all work together. If you’re interested in seeing the dead simple UART communication scheme take a look at this file.

We think it’s also worth pointing about the high voltage supply. To the software or mechanically minded among us it’s easy to get trapped thinking about switching power supplies as a magical construct which can only be built using all-in-one control ICs. But [hamster]’s supply is a great reminder that a switching supply, even a high voltage one, isn’t as complex as all that. His design (which he says was cribbed from Adafruit’s lovely Ice Tube Clock) is essentially composed of the standard primitives. A big low voltage capacitor C1 to source the burst of energy which will be boosted, the necessary inductor/high voltage cap C2 which ends up at the target voltage, and a smoothing cap C3 to make the output a little nicer. It’s controlled by the microcontroller toggling Q1 to control the current flow through L1. The side effect is that by controlling the PWM frequency [hamster] can vary the brightness of the tubes.

Right now it looks like the repository has a schematic and sources, which should be enough to build a small tube driver of your own. If you can’t get enough TubeCubes, there’s one more video (of a single module) after the break.

Continue reading “Tiny Cube Hosts A Hearty Tube”

Give Your Solar Garden Lights A Color Changing LED Upgrade

White LEDs were the technological breakthrough that changed the world of lighting, now they are everywhere. There’s no better sign of their cost-effective ubiquity than the dollar store solar garden light: a complete unit integrating a white LED with its solar cell and battery storage. Not content with boring white lights on the ground, [Emily] decided to switch up their colors with a mix of single-color LEDs and dynamic color-changing LEDs, then hung them up high as colorful solar ornaments.

The heart of these solar devices is a YX8018 chip (or one of its competitors.) While the sun is shining, solar power is directed to charge up the battery. Once the solar cell stops producing power, presumably because the sun has gone down, the chip starts acting as a boost converter (“Joule thief”) pushing a single cell battery voltage up high enough to drive its white LED. Changing that LED over to a single color LED is pretty straightforward, but a color changing LED adds a bit of challenge. The boost converter deliver power in pulses that are too fast for human eyes to pick up but the time between power pulses is long enough to cause a color-changing circuit to reset itself and never get beyond its boot-up color.

The hack to keep a color-changing LED’s cycle going is to add a capacitor to retain some charge between pulses, and a diode to prevent that charge from draining back into the rest of the circuit. A ping-pong ball serves as light diffuser, and the whole thing is hung up using a 3D-printed sheath which adds its own splash of color.

Solar garden lights are great basis for a cheap and easy introduction to electronics hacking. We’ve seen them turn into LED throwies, into a usable flashlight, or even to power an ATTiny microcontroller.

Continue reading “Give Your Solar Garden Lights A Color Changing LED Upgrade”

Simple Ultrasound Machine Shows The Skeleton Lurking Inside Us All

That first glimpse of a child in the womb as a black and white image on a screen is a thrilling moment for any parent-to-be, made possible by several hundred thousand dollars worth of precision medical instrumentation. This ultrasound machine cobbled together from eBay parts and modules is not that machine by a long shot, but it’s still a very cool project that actually gives a peek inside the skin.

The ultrasound transducer used by [stoppi71] in this build has an unusual source: a commercial paint-thickness meter. Cue the jokes about watching paint dry, but coatings measurement is serious stuff. Even so, the meter in question only ran about $40 on eBay, and provided the perfect transducer for the build. The sender needs a 100V pulse at about 5 MHz, so [stoppi71] had some fun with a boost converter and a 74121 Schmitt-trigger one-shot driving a MOSFET to switch the high voltage. On the receive side, the faint echo is sent through a three-stage amp using AD811 op amps before going through an LM7171 op amp acting as a rectifier and peak detector. Echos are sent to an Arduino Due for display on a 320×480 LCD. The resolution isn’t great, but the video below shows that it’s enough to see reflections from the skin of [stoppi71]’s forearm and from the bones within.

[stoppi71] says that he was inspired to tackle this build by Murgen, an open-source ultrasound project. That project got further refined and entered into the “Best Product” category in the 2018 Hackaday Prize. We like that because focusing on turning projects into products is what this year’s Hackaday Prize is all about.

Continue reading “Simple Ultrasound Machine Shows The Skeleton Lurking Inside Us All”

Reworking MT3608 Boost Converters For Lower Idle Current Draw

The MT3608 is a popular boost converter, able to easily step up DC voltages in useful ranges, at an incredibly low cost. Modules can be sourced from eBay for less than $2, built on a PCB, ready to go. One drawback of these modules, particularly when working with batteries, is the idle current draw, on the order of 1 to 1.5mA. Fear not, however — there is a workaround, courtesy of [Aka Kasyan]. (Video, embedded below.)

The trick is to modify the behavior of the converter when no load is connected. The enable pin of the boost converter is held low through a pull-down resistor, keeping the boost converter switched off. In this state, the output voltage is equal to the input voltage. A current sense resistor is then installed in the output path. When a load is connected, this causes a voltage drop across the current sense resistor. This is then used to switch a transistor, which then connects the enable pin to the positive rail, switching the converter on, leading to the full boosted output voltage being reached.

[Aya] reports that this drastically cuts the idle current draw, which is particularly useful for battery powered projects. It’s important to note that the current sense resistor must be appropriately sized for the given load, however. If you’re a little hazy on the background, fear not — we’ve discussed the nature of boost converters before. Video after the break.

[Thanks to Baldpower for the tip!]
Continue reading “Reworking MT3608 Boost Converters For Lower Idle Current Draw”

Building A 3D Printer That Goes Where You Do

Back when one of the best paths to desktop 3D printer ownership was building the thing yourself from laser cut wood with some string thrown in for good measure, just saying you had one at home would instantly boost your hacker street cred. It didn’t even need to work particularly well (which is good, since it probably didn’t), you just had to have one. But now that 3D printers have become so common, the game has changed. If you want to keep on the cutting edge, you’ve got to come up with a unique hook.

Luckily for us, [Thomas Sanladerer] is here to advance the status quo of desktop 3D printing. Not content with a 3D printer that spends its time loafing around the workshop, he decided to build a completely mobile 3D printer. For a guy who spends a lot of time traveling to different 3D printing conferences and shows, this is actually a pretty handy thing to have around, but there are probably some lessons to be learned here even if you aren’t a 3D printing YouTube celebrity.

Given the wide array of very popular low cost 3D printers out there, some will likely be surprised that [Thomas] decided to mobilize a printer which is nearly an antique at this point: the PrinterBot Play. But as he explains in the video after the break, the design of the Play really lends itself perfectly to life on the road. For one, it’s an extremely rigid printer thanks to its (arguably overkill) steel construction. Compared to most contemporary 3D printers which are often little more than a wispy collection of aluminium extrusion and zip ties, the boxy design of the Play also offers ample room inside for additional electronics and wiring

The most obvious addition to the PrintrBot is the six Sony NP-F camera batteries that [Thomas] attaches to the back of the printer by way of 3D printed mounts, but there’s also quite a bit of hardware hidden inside to break the machine free from its alternating current shackles. The bank of batteries feed simultaneously into a DC boost converter which brings the battery voltage up to the 12 V required for the printer’s electronics and motors, and a DC regulator which brings the voltage down to the 5 V required by the Raspberry Pi running OctoPrint. There’s even a charge controller hiding in there which not only frees him from carrying around a separate charger, but lets him top up the cells while the printer is up and running.

On the software side of things, the Raspberry Pi is configured to work as a WiFi access point so that OctoPrint can be controlled with a smartphone even if there’s no existing network in place. A fact demonstrated when he takes the printer outside for a walk while it’s in the middle of a job. The ability to control the printer without any existing infrastructure combined with the estimated six hour runtime on a charge means this modified PrinterBot can get the job done no matter where [Thomas] finds himself.

The hacker community was saddened by the news that PrintrBot was closing its doors last year, an unfortunate casualty of an increasingly competitive desktop 3D printing market. But perhaps we can take some comfort from the fact that their eminently hackable open source printers still live on in projects such as this.

Continue reading “Building A 3D Printer That Goes Where You Do”