From what you would gather from Hackaday’s immense library of builds and projects over several years, the only way to do PWM is with a microcontroller, some code, a full-blown IDE, or even a real-time operating system. To some readers, we’re sure, this comes naturally and with an awesome toolchain it can be as easy as screwing in a light bulb. There is, of course, an easier way.
[Jestin] needed to vary the current on a small 12 Volt load. Instead of digging out an in system programmer, he turned to the classic 555 chip. With a single pot, it’s easy to vary the duty cycle of the 555 and connect that to a MOSFET. Put a load in there, and you have a very easy circuit that’s a fully functioning PWM dimmer.
If all you have are a few scraps in your part drawers, this is a very, very easy way to set up a dimmer switch. We’re also loving [Jestin]’s improv aluminum tube enclosure, as seen in the video below.
Continue reading “The easy or hard way to build a PWM dimmer”
If you’ve ever considered modding your vehicle’s electrical system, [Josh Oster-Morris’s] Motobrain PDU (power distribution unit) might make life easier by providing precision control and protection for auxiliary 12V outputs in your car, bike, boat, etc. Once the Motobrain is paired to a phone over Bluetooth, a companion app displays real-time telemetry and lets you program up to 8 output channels.
Each of these 8 outputs can be directly controlled in the app, but the real power lies in the 4 programmable inputs. Here you can tie systems together and dictate exactly how one should respond to the other, e.g. detecting high-beams and disabling the auxiliary light bar you added. There’s even a “delayed on” option. Programming also has PWM capabilities, so flipping a switch could raise the brightness of some lights over 4 levels of intensity. If those lights are LEDs, the Motobrain can also provide constant current to specification. Each circuit can supposedly handle 15A continuous current and has a programmable circuit breaker, which would make fuses optional.
You can watch an overview video after the break to get a better idea of how it all works, but stop by [Josh’s] project blog to see all the features explained across multiple videos and blog posts as they are developed and tested.
Continue reading “Motobrain: A Bluetooth controlled PDU”
Whether it’s a Furby or Buzz Lightyear’s button that plays, ‘To infinity and beyond’, most digital audio applications inside toys are actually simple affairs. There’s no Arduino and wave shield, and there’s certainly no Raspi streaming audio from the Internet. No, the audio inside most toys are one or two chip devices capable of storing about a minute or so of audio. [makapuf] built an electronic board game for his kids, and in the process decided to add some digital audio. The result is very similar to what you would find in an actual engineered product, and is simple enough to be replicated by just about anyone.
[makapuf]’s game is based on Game of the Goose, only brought into the modern world with electronic talking dice. An ATtiny2313 was chosen for the microcontroller and an AT45D 4 Megabit Flash module provided the storage for 8 bit/8khz audio.
The electronic portion of the game has a few functions. The first is calling out numbers, which is done by playing recordings of [makapuf] reading, ‘one’, ‘two’, ‘three’, … ‘twelve’, ‘thir-‘, ‘teen’ and so on. This data is pumped out over a pin on the ATtiny through a small amplifier and into a speaker. After that, the code is a simple matter of keeping track of where the players are on the board, keeping score, and generating randomish numbers.
It’s an exceptional exercise in engineering, making a quite complicated game with a bare minimum of parts. [makapuf] estimated he spent under $4 in parts, so if you’re looking to add digital audio to a project on the cheap, we can’t imagine doing better.
You can see a video of [makapuf]’s project after the break.
Continue reading “Giving toys an electronic voice”
As the title says, [José Faria] added the ability to adjust his keyboard backlight based on ambient light levels. But that’s just one of the things he did during his hacking extravaganza with this Razer BlackWidow Ultimate.
When he first received the peripheral he didn’t like the blue LEDs used as backlights. So he removed all of them and put in white ones. He doesn’t talk too much about that but we’d image it was a ton of work. The new color was pleasing, but then the ability to adjust their brightness started to irritate him. There are four predefined levels and that’s all you get. Even the GUI which has a slider for adjustment couldn’t go outside of those levels.
His solution was to augment the controller with his own. He patched in an AVR chip to the transistor which controls the low side of the LED circuits. While at it he also noticed that the keyboard case was actually translucent. This let him hide a photosensor inside which automatically adjusts the light levels. But he did it in a way that still allows him to use the original functionality with the flip of a switch. See for yourself after the break.
Continue reading “Auto dimmer hacked into keyboard backlight”
[Thomas] wanted to play around with a few high-power LEDs and a RaspberryPi. LED controllers usually require some form of PWM to change the brightness of a LED, and unfortunately the Pi only has one PWM pin. [Thomas] could have gotten around this with a custom chip or even an Arduino hanging off the Pi’s USB port. He opted to go with software-based PWM, and did so in a way that is far superior to bit banging a pin.
Conventional wisdom says PWM without a real-time operating system is dumb – right up there with starting a land war in Asia. Turning a pin on and off in a while loop will eat up all the processor power in the Pi, so [Thomas] looked for a better way to do things. He came across the ServoBlaster project by [Richard Hirst] that creates pulses of different lengths by playing with direct memory access; [Richard] created a circular buffer that is read every 10μs. With 2000 values in the buffer, he can control eight different pins with very little impact on CPU usage.
For [Thomas], though, [Richard]’s project wasn’t enough. It was originally written for servos and is only able to drive PWM pins up to about 12%. A quick rewrite of [Richard]’s code allowed [Thomas] to control eight pins with PWM varying from 0% to 100% – and be able to do other things with his Pi in the process.
[Thomas] now has a 40 Watt RGB LED powered by a Raspberry Pi burned into his retina, and the satisfaction of a really clever way of giving the Pi more PWM pins.
Although it’s technically possible to get 16 bits of resolution on a ATMega328, most implementations of PWM on everyone’s favorite ‘mega – including just about every Arduino sketch – are limited to 8 bit PWM. This means the pins can only output 256 different values, so if you’re playing around with music made on an Arduino don’t expect very high fidelity.
There is a clever way around this: use two PWMs, and use one pin for high bytes and another for low bytes. That’s what Open Music Labs did when working on a synthesizer project that needed very high quality audio.
The basic idea behind the build is that PWM pins can be used to create audio frequencies. Using two PWM pins and adding them together means it’s possible to add extra bits of resolution. This requires using different values of resistors on each pin. For example, using the same value of resistors on two PWM pins increases the resolution by one bit. Two pins with a resistor value ratio of 1:4 increases the resolution by four bits, and so on.
There’s a great tutorial for setting up these higher resolution, dual PWM outputs on an ATMega or Arduino, as well as a distortion analysis for this dual PWM setup.
To the casual observer this flower looks nice as its illuminated center fades in and out. But there’s hidden meaning to that light. Some of the blinks are longer than others; this flower is using Morse Code.
[Renaud Schleck] wanted to try a few different things with his MSP430 microcontroller. He decided on an LED that looks like a flower as it will be a nice piece of decor to set around the home. To add the Morse Code message he wanted something a bit more eloquent (and less distracting) than purely digital flashing. So he took the dots and dashes of the hard-coded message and turned them into fading signals by using Pulse-Width Modulation.
He free-formed the circuit so that it, and the coin cell that powers it, would fit in the flower pot. A reed switch is responsible for turning the juice on and off. When placed near a magnet the flower begins its gentle playback.
Continue reading “Morse code flower is trying to tell you something”