Better LEDs Through DMA

While regular Hackaday readers already know how to blink a LED with a microcontroller and have moved onto slightly more challenging projects such as solving the Navier-Stokes equations in 6502 assembly, that doesn’t mean there’s not space for newbies. [Rik] has published a great tutorial on abusing DMA for blinkier glowy things. Why would anyone want to learn about DMA techniques? For blinkier glowy things, of course.

This tutorial assumes knowledge of LED multiplexing and LED matrices, or basically a bunch of LEDs connected together on an XY grid. The naive way to drive an 8×8 grid of LEDs is attaching eight cathodes to GPIO pins on a microcontroller, attaching the eight anodes to another set of GPIO pins, and sourcing and sinking current as required. The pin count can be reduced with shift registers, and LED dimming can be implemented with PWM. This concludes our intensive eight-week Arduino course.

Thanks to microcontrollers that aren’t trapped in the 1980s, new techniques can be used to drive these LED matrices. Most of the more powerful ARM microcontrollers come with DMA, a peripheral for direct memory access. Instead of having the CPU do all the work, the DMA controller can simply shuffle around bits between memory and pins. This means blinker projects and glowier LEDs.

[Rik]’s method for DMAing LEDs includes setting up a big ‘ol array in the code, correctly initializing the DMA peripheral, and wiring up the LED matrix to a few of the pins. This technique can be expanded to animations with 64 levels of brightness, something that would take an incredible amount of processing power (for a microcontroller, at least) if it weren’t for the DMA controller.

The setup used in these experiments is an STM32F103 Nucleo board along with the OpenSTM32 IDE. [Rik] has released all the code over on GitHub, and you are, of course, encouraged to play around.

Scrap Bin Mods Move Science Forward

A first-time visitor to any bio or chem lab will have many wonders to behold, but few as captivating as the magnetic stirrer. A motor turns a magnet which in turn spins a Teflon-coated stir bar inside the beaker that sits on top. It’s brilliantly simple and so incredibly useful that it leaves one wondering why they’re not included as standard equipment in every kitchen range.

But as ubiquitous as magnetic stirrers are in the lab, they generally come in largish packages. [BantamBasher135] needed a much smaller stir plate to fit inside a spectrophotometer. With zero budget, he retrofitted the instrument with an e-waste, Arduino-controlled magnetic stirrer.

The footprint available for the modification was exceedingly small — a 1 cm square cuvette with a flea-sized micro stir bar. His first stab at the micro-stirrer used a tiny 5-volt laptop fan with the blades cut off and a magnet glued to the hub, but that proved problematic. Later improvements included beefing up the voltage feeding the fan and coming up with a non-standard PWM scheme to turn the motor slow enough to prevent decoupling the stir bar from the magnets.

[BantamBasher135] admits that it’s an ugly solution, but one does what one can to get the science done. While this is a bit specialized, we’ve featured plenty of DIY lab instruments here before. You can make your own peristaltic pump or even a spectrophotometer — with or without the stirrer.

Continue reading “Scrap Bin Mods Move Science Forward”

Primer On Servos Hits All The Basics

Servos are pretty basic fare for the seasoned hacker. But everyone has to start somewhere, and there’s sure to be someone who’ll benefit from this primer on servo internals. Who knows – maybe even the old hands will pick up something from a fresh perspective.

[GreatScott!] has been building a comprehensive library of basic electronics videos over the last few years that covers everything from using a multimeter to programming an Arduino. The last two installments delve into the electromechanical realm with a treatment of stepper motors along with the servo video below. He covers the essentials of the modern RC-type servo in a clear and engaging style that makes it easy for the newbie to understand how a PWM signal can translate into positional changes over a 180° sweep. He shows how to control a servo directly with an Arduino, with bonus points for including a simple 555-based controller circuit too. A quick look at the mods needed to convert any servo to continuous rotation wraps up the video.

If [GreatScott!]’s video whets your appetite for more, be sure to check out [Richard Baguley]’s deeper dive into servos. And when you’re ready to put your new-found knowledge into practice, maybe a nice project would be to convert a hobby servo into a linear actuator.

Continue reading “Primer On Servos Hits All The Basics”

Modifications to a Razor E300 motor controller to remove limits

Converting An Electric Scooter To Lithium Batteries And Disabling The Safeties

There’s a bunch of different electric scooters available nowadays, including those hoverboards that keep catching fire. [TK] had an older Razor E300 that uses lead acid batteries. After getting tired of the low speeds and 12 hour charge times, [TK] decided it was time to swap for lithium batteries.

The new batteries were sourced from a Ryobi drill. Each provides 18 V, giving 36 V in series. The original batteries only ran at 24 V, which caused some issues with the motor controller. It refused to start up with the higher voltage. The solution: disable the safety shutdown relay on the motor controller by bridging it with a wire.

With the voltage issue sorted out, it was time for the current limit to be modified. This motor controller uses a TI TL494 to generate the PWM waveforms that drive a MOSFET to provide variable power to the motor. Cutting the trace to the TL494’s current sense pin removed the current limit all together.

We’re not saying it’s advisable to disable all current and voltage limits on your scooter, but it seems to be working out for [TK]. The $200 scooter now does 28 km/h, up from 22 km/h and charges much faster. With gearing mods, he’s hoping to eke out some more performance.

After the break, the full conversion video.

Continue reading “Converting An Electric Scooter To Lithium Batteries And Disabling The Safeties”

A Tiny Servo Motor Controller

If you’re building a moving thing with a microcontroller, you’ll probably want to throw a servo controller in the mix. Driving a servo or two with a microcontroller takes away valuable cycles that just babysit the servo, making sure all the PWM signals are in sync. The thing is, most servo controllers are a massive overkill, and you don’t need that much to control a few servos over a UART. The proof of this is an attiny13 servo controller over on hackaday.io.

[arief] developed his tiny servo controller around one of the tiniest microcontrollers – the ATtiny13. This chip has just 1kB of Flash and 64 Bytes of RAM, but that’s enough to keep a few servos going and listen in to a UART for commands to drive the servo.

The construction of this servo controller board is simple enough – just a single sided board, microcontroller, and a few headers, caps, and resistors. Commands are sent to the ATtiny through a half duplex UART we covered before, with servos responding to simple serial commands.

If you’re building a robot army, this is the board to make. You’re going to need a high-powered controller to take over the world, but there’s no need to bog down that controller by babysitting a few servos.

Taking The Pulse (Width Modulation) Of An FPGA

I like to think that there are four different ways people use FPGAs:

  1. Use the FPGA as a CPU which allows you to add predefined I/O blocks
  2. Build custom peripherals for an external CPU from predefined I/O blocks
  3. Build custom logic circuitry from scratch
  4. Projects that don’t need an FPGA, but help you learn

I’d bet the majority of FPGA use falls into categories one and two. Some FPGAs even have CPUs already built-in. Even without an onboard CPU, you can usually put a CPU “core” (think reusable library) into the chip. Either way, you can always add other cores to create UARTs, USB, Ethernet, PWM, or whatever other I/O you happen to need. You either connect them to a CPU on the chip, or an external one. With today’s tools, you often pick what you want from a list and then your entire project becomes a software development effort.

Continue reading “Taking The Pulse (Width Modulation) Of An FPGA”