PWM on the Stellaris Launchpad

[Joonas] has been following TI’s ‘getting started’ tutorials for their new Stellaris Launchpad. Everything had been going swimmingly until [Joonas] reached the fourth tutorial on interrupts. To the ire of LEDs the world over, implementing PWM on the new Stellaris Launchpad is a somewhat difficult task. After banging his head against the documentation for hours, [Joonas] finally cracked his PWM problem and decided to share his discoveries with the world.

The Stellaris has a PWM mode for its six hardware timers, but unfortunately there are no PWM units on the chip. Solving this problem required making two 16-bit timers out of a single 32-bit one. This allowed [Joonas] to specify a ‘load’ and ‘match’ value.

After coding this up, [Joonas] discovered the PWM timer only works on two of the Launchpad’s pins. Hours of Googling later, he had real PWM on his Stellaris Launchpad.

Given the amount of time [Joonas] spent on this problem, we’re glad to help all the other frustrated Stellaris tinkerers out there by sharing this.

The inner workings of servo motors

Servos seem to be the go-to option when adding motors to hobby projects. They’re easy to hack for continuous rotation for use in a robot, but with the control board intact they are fairly accurate for position-based applications. But do you know how the hardware actually works? [Rue Mohr] recently published an article that looks at the inner world of the servo motor.

As you know, these motors use a voltage, ground, and signal connection for control. The position of the horn (the wheel seen on the servos above) is dependent on that control signal. The duty cycle of a 20 ms pulse decides this. Inside the housing is a control board capable of measuring this signal. It’s got a chip that monitors the incoming PWM pulses, but that’s only half of the equation. That controller also needs feedback from the horn to know if its position is correct or needs to be changed. Integrated with the gear box that connects the motor to the horn is a potentiometer. It’s resistance changes as the horn turns. Knowing this, it is possible to fine tune a servo by altering that resistance measurement.

CPLD motor control

[Chris] continues cranking out the tutorials, this time around he’s showing how to use a CPLD for simple motor control. The demo hardware is pretty basic, he built his own FPGA/CPLD demo board a few years back which used a PLCC socket for easy interfacing. You should be able to use just about any gear you have on hand.

Of course the thing about these chips is that you’re working with hardware that can be run in parallel. [Chris] mentions that this is what makes it perfect for timing-critical applications. Here he’s using a motor driver that monitors a PWM signal, using the duty cycle to actuate the direction and speed at which the motor turns. After the break you can see a demonstration of the CPLD reading from an ADC chip and converting the value to a PWM signal. [Chris] has also used the same hardware for VGA signals; something that is usually a timing nightmare if done with a microcontroller.

If this leaves you thirsting for more CPLD goodness check out our own guide on the subject.

[Read more...]

Electric bike (earplugs not included)

It’s obvious this bike has some extra parts. But look closely and you’ll see the chainring has no chain connecting to it. Pedaling will get you nowhere since [PJ Allen] rerouted the chain in order to drive this bicycle using an electric motor.

He’s got beefy motor which pulls 350 Watts at 24 Volts. For speed control he opted to use an Arduino, pumping out PWM signals to some MOSFETs. This results in an incredibly noisy setup, as you can hear in the bench test video after the break. But once this is installed on the bike it doesn’t quiet down at all. You can hear the thing a block away.

The original road test fried the first set of 7A MOSFETs when trying to start the motor from a standstill. It sounds like the 40A replacements he chose did the trick through. We didn’t see any information on the battery life, but if he runs out of juice on the other side of town we bet he’ll be wishing he had left the chain connected to the crankset.

[Read more...]

Adding the Apple ‘breathing LED’ to a motorcycle

[spiralbrain] has a beautiful KTM Duke 200 motorcycle, but he’s found the factory configuration is a little bit plain. Wanting to add his own unique touch to his bike, he decided to add a ‘breathing LED’ to the parking light that slowly changes its brightness much like the LED on recent Macs.

From the factory, [spiralbrain]‘s bike uses extremely inefficient (and somewhat ugly) T10 lamps for the parking light. This was changed over to a 12 Volt white SMD light bulb, but what really makes this build special is the way [spiralbrain] is controlling this lamp.

[spiralbrain] added a very tiny circuit consisting of an 8-pin microcontroller (a PIC12F683) that slowly dims the new SMD light bulb using the built-in PWM module. When the bike is taken out of neutral, the microcontroller stops at the highest PWM setting so the ‘breathing’ LED function is only engaged when not moving.

It’s an interesting mod that’s sure to draw some attention when [spiralbrain] is showing off his bike. As a bonus, the mod is completely reversible, so the bike’s warranty is still good.

Stair accent lights made from cheap LED strips

We really like [Geert's] take on accent lighting for his stairs. He built his own LED channels which mount under the bullnose of each step. The LED strips that he used are actually quite inexpensive. They are RGB versions, but the pixels are not individually addressable. This means that instead of having drivers integrated into the strip (usually those use SPI for color data) this strip just has a power rail and three ground rails for the colors. Ten meters of the strip cost him under forty dollars.

He did want to be able to address each step separately, as well as mix and match colors, so he designed the driver board seen above to use a set of TLC5940 LED drivers. These are controlled by the Arduino which handles color changing and animations. It will eventually include sensors to affect the LEDs as you walk up the stairs. Each strip is mounted in a piece of angle bracket, and they’re connected back to the driver board using telephone extension wire.

Floppy drive as an audio sampler

Here’s a floppy drive which is being used as an audio sampler. At first glance we thought this was another offering which drives the stepper motor at a specific frequency to generate that characteristic sound at a target pitch. But that’s not what’s happening at all. The floppy is actually being used as a storage device (go figure).

From what we can tell, it’s being used almost like an 8-track tape. A PWM signal is stored on one circular slice of the disk, then the head can be moved back to that same “track” to play back the wave form. The head doesn’t move during playback, but just keeps reading the same track of bits. To the right you can see an Arduino board. This allows for MIDI control of the track selection. [Alexis] shows off some keyboard control in the video after the break. There’s a buffer chip on the breadboard which allows the audio output to be quickly switched off as the floppy drive head is moved. This keeps garbage out of the sound until the new track can be read.

[Read more...]

Follow

Get every new post delivered to your Inbox.

Join 93,736 other followers