A Detailed Tutorial On Speeding Up AVR Division

[Alan Burlison] is working on an Arduino project with an accelerometer and a few LEDs. Having the LEDs light up as his board is tilted to one side or another is an easy enough project a computer cowboy could whip out in an hour, but [Alan] – ever the perfectionist – decided to optimize his code so his accelerometer-controlled LEDs don’t jitter. The result is a spectacular blog post chronicling the pitfalls of floating point math and division on an AVR.

To remove the jitter from his LEDs, [Alan] used a smoothing algorithm known as an exponential moving average. This algorithm uses multiplication and is usually implemented using floating point arithmetic. Unfortunately, AVRs don’t have floating point arithmetic so [Alan] used fixed point arithmetic – a system similar to balancing your checkbook in cents rather than dollars.

With a clever use of bit shifting to calculate the average with scaling, [Alan] was able to make the fixed point version nearly six times faster than  the floating point algorithm implementation. After digging into the assembly of his fixed point algorithm, he was able to speed it up to 10 times faster than floating point arithmetic.

The takeaway from [Alan]’s adventures in arithmetic is that division on an AVR is slow. Not very surprising after you realize the AVR doesn’t have a division instruction. Of course, sometimes you can’t get around having to divide so multiplying by the reciprocal and using fixed point arithmetic is the way to go if speed is an issue.

Sure, squeezing every last cycle out of an 8 bit microcontroller is a bit excessive if you’re just using an Arduino as a switch. If you’re doing something with graphics or need very fast response times, [Alan] gives a lot of really useful tips.

apoll013

A Replica DJ Controller To Rule Them All

So like many followers of Hackaday, maybe you’re into electronic music. We’d dare to say though that few of you have the dedication of [adamdzak] as he decided to replicate [Sasha]‘s custom controller for the [Abelton Live] software package. Apparently it’s more difficult than taking apart your DJ Hero controller and hacking it to interface songs on your computer.

The “new” controller is named Apollo, and is meant to be a replica of Sasha’s Maven controller. The build process is well laid out in his post, and the results so far look quite incredible. What’s particularly interesting is the effort taken to reverse engineer this device without ever having been able to use it. Both from a mechanical standpoint and trying to figure out how the buttons are used to control the software must have been quite a challenge. Check out the video after the break to see this new controller in action. Continue reading “A Replica DJ Controller To Rule Them All” →

LVL1 Has A Rocketeers Group, Is Not Working On ICBMs.

We’re very familiar with the Louisville Hackerspace LVL1 here at Hackaday. From their GLaDOS-inspired sentient overlord, an evil box to filter the Internet, and a friggin’ moat, LVL1 is the closest we’ve got to a mad scientist heard cackling from a wind-swept castle on a stormy night. It turns out they also have a rocketry program. Now we’re just waiting for confirmation of their subterranean complex of missile silos.

The rocketery-oriented part of LVL1 spawned from a University of Louisville’s group. The goal of the group is to compete in the NASA University Student Launch Initiative, dedicated to competing against other teams to launch a scientific payload to 1 mile AGL. At the competition last May, the team placed 5th out of 42 teams and won the award for best website. We can’t wait to see what they come up with next year.

Even though the team is out of school for the summer, they’re still cooking up a few rocketry hacks. They’ve built a test stand to measure the thrust of off-the-shelf motors, kitbashed a few Estes Baby Berthas (very awesome and very easy if you have a laser cutter), and are starting a pulse jet project.

We’re assuming the LVL1 Rocketeers group is just a front for their yet to be unveiled moon-based “laser” project, but you can check out a few videos from the ULSI competition after the break.

Continue reading “LVL1 Has A Rocketeers Group, Is Not Working On ICBMs.” →

Android Oscilloscope Built From Parts Just Lying Around

So you need to debug a circuit and you don’t have an oscilloscope. That’s not a problem thanks to [retronics] $0 Android oscilloscope, made with parts he just happened to have lying around.

The heart of every modern oscilloscope is the ADC – the chip that takes analog input and outputs a digital signal. Every Android device has one of these converters connected to the microphone port. All [retronics] needed to do was solder up a 3mm headphone jack, wire in a few resistors, and attach a pair of alligator clips. After installing an oscilloscope app, [retronics] had a half decent ‘scope.

Yes, this is truly a poor man’s oscilloscope, and [retronics] probably won’t be debugging high frequency RF circuits with his Android microphone jack anytime soon. Low frequency stuff such as audio is where this ‘scope really excels; even more so if a small preamp is thrown into the mix.

You can check out [retronics]’ build after the break. Sure, it’s not something for precise and calibrated measurement, but sometimes you only need a tool that will do the job.

Continue reading “Android Oscilloscope Built From Parts Just Lying Around” →

XBMC Hits Android

XBMC just issued the announcement we’ve been waiting to hear for some time now. The Android platform is now officially supported. Having seen the popularity of this open source media center software, and the willingness of some to spend hundreds of dollars on small computers to use it as their set-top-box interface of choice, we knew it was only a matter of time before a hardware manufacturer stepped up to the plate. In this case it is a company called Pivos Technology Group, who helped fund the push to bring XBMC to Android.

The good news is that the Android version of XBMC should work on a very wide range of devices. The bad news is that it will take a bit of time for that wide range of devices to support hardware video acceleration. Right now the only platform that has the hardware accelration for all video formats is the Pivos XIOS DS unit seen above. Looks a bit like a white version of the Apple TV huh? This turns out to be a great alternative to the Apple hardware, which requires a jailbreak to run XBMC and there is no jailbreak available for the current generation of that hardware. You can grab the XIOS DS for about $100-120, and as you can see after the break, it runs XBMC without a hitch, shows the ability to navigate menus while 1080p video is playing, and demonstrates working video plug-ins.

Plus, it’s an Android device with access to apps like any other. We looked around and it seems the Netflix app will work, but there is currently a problem with the video driver on units which have been upgraded to ICS. You can check out an unboxing of the device in this forum post, which is where we got the image seen above.

Continue reading “XBMC Hits Android” →

Printing A Boat Made Out Of Milk Jugs

Today, groups from all over the Pacific Northwest will take up their oars and head over to Green Lake for the 42nd annual Seafair Milk Carton derby. The team who builds the fastest boat made out of milk cartons wins the regatta (and $10,000). This year, we’d put our money on the 3D printer group from the University of Washington; they printed a boat large enough to carry a person using crushed melted milk jugs.

After building a huge extruder to feed shredded HDPE plastic through a nozzle, the team repurposed an old plasma cutter to serve as an 8-foot-long 3D printer. There were a number of problems the team ran into – getting layers to fuse together, finding a suitable printing surface, and perfecting the art of squeezing melted milk jugs through a heated metal tube – but the final result is impressive, to say the least.

As far as how lake-worthy the UW team’s boat is, we have no idea. The milk jug regatta will be held later today, and if you have an update of how the team fared, send us a tip.

Hacking A Parallel Port Flash Memory Programmer

[Pulko Mandy] doesn’t use his flash ROM programmer very often, but he does use it. When he tried to get support for a new chip and the manufacturer suggested he just buy a newer version he decided to hack the programmer and it’s software instead.

This device connects to the parallel port and was intended for use with MS-DOS systems (no wonder there’s no longer support from the company). The board uses logic chips to add read and write function. So the first step was to analyze how they connect together and come up with a set of commands. While at it he also made some changes to the board to bring the voltage more in spec and ensure the logic levels on the parallel port met the correct voltages.

His plan was to use the board with a Linux system so the parallel port interface can stay. He used what he learned from the hardware inspection to write his own interface in C++. It works with a chip he was able to use under the MS-DOS software, but he hasn’t gotten it to work with the chip that sparked this adventure. If you’re familiar with how the AT29C040A works please consider lending a hand.