Learning how magnets and magnetic fields work is one thing, but actually being able to measure and see a magnetic field is another thing entirely! [Stanley’s] latest project uses a magnetometer attached to a robotic arm with 3 degrees of freedom to measure magnetic fields.
Using servos and aluminium mounting hardware purchased from eBay, [Stanley] build a simple robot arm. He then hooked an HMC5883L magnetometer to the robotic arm. [Stanley] used an Atmega32u4 and the LUFA USB library to interface with this sensor since it has a high data rate. For those of you unfamiliar with LUFA, it is a Lightweight USB Framework for AVRs (formerly known as MyUSB). The results were plotted in MATLAB (Octave is free MATLAB alternative), a very powerful mathematical based scripting language. The plots almost perfectly match the field patterns learned in introductory classes on magnetism. Be sure to watching the robot arm take the measurements in the video after the break, it is very cool!
[Stanley] has graciously provided both the AVR code and the MATLAB script for his project at the end of his write-up. It would be very cool to see what other sensors could be used in this fashion! What other natural phenomena would be interesting to map in three dimensions?
Continue reading “Measuring Magnetic Fields with a Robotic Arm”
A month ago [Andreas] started playing Starcraft 2 again. As he was not comfortable with the default hotkeys on a normal keyboard, [Andreas] decided to build his own.
He started by salvaging keys from an old keyboard he had lying around, then 3D printed the case you see in the picture above to fit them. The keyboard electrical design is a simple matrix and it appears that he etched the PCB himself. To provide the required USB connectivity, the Atmega8U2 was chosen. It comes with a pre-programmed USB bootloader that [Andreas] chose to activate when the left key is pressed at the system startup. The HID class was implemented using the LUFA-USB Framework and the final product is definitely good looking.
All the files required to duplicate his design can be found here. You can also checkout another starcraft keyboard and an ergonomic keyboard that we previously featured.
This is a fascinating concept. We’re not sure of its usefulness, but it definitely stands on its own just for the concept. [Dean Camera] just added a new HID class to the LUFA project that lets you flash AVR chips by printing to them. This means once you have a file like the one seen open in Notepad above, you can just click on File, then on Print, and the firmware will be uploaded to the chip.
[Dean] is the creator of the LUFA project and still likes to get his hands dirty hacking around with it. This idea came to him while he was exploring the concept of using the MIDI protocol to program a chip. That didn’t pan out because of the way Microsoft has handled MIDI in newer versions of Windows. But he did get the idea of making LUFA identify itself as a simple USB printer. He dug into the specification and figured out how to do that. Once Windows connects to the device it doesn’t really care what data gets sent to it. So [Dean] wrote a parser for the bootloader which could accept the incoming hex code and write it to the chip’s program memory.
Looks like the Lightweight USB Framework for AVRs (LUFA) has just been ported for ARM microcontrollers. NXP recently released a package for their LPC Cortex M3 family of ARM controllers. You won’t find a reference to LUFA on their nxpUSBlib description page (which we think is kind of sad), but if you grab a copy of the beta code the Version.h header file shows that it is indeed a port of the project. This is further backed up by the LUFA creator, [Dean Camera], who consulted with the NXP team doing the work.
The package provides an open-source USB stack that you can use in your projects as a USB host or USB device. We’re advocates of open source packages like this one as it makes it much easier for hobbyists to get help using the tools, and it allows the community to give back through bug fixes and feature additions.
We’ve highlighted a few LUFA projects, like this keyboard remapper and this AVR programmer. We’re looking to seeing the first set of NXP LUFA projects roll through!
[Nav] wanted to change his keyboard mapping for one particular keyboard, rather than on each operating system. He used an AT90USBKey as a replacement PCB by soldering to all of the contacts on the key matrix. This allows him to remap the keys by following onscreen prompts.
The board enumerates as an HID device, and has a special mode which is accesses by plugging the keyboard in while holding down any key. If a text editor window is active you’ll see prompts from the microcontroller to press a series of keys. This is a routine used to learn how the key matrix is organized, and it’s your opportunity to change how each key is mapped. Since the mapping is saved to EEPROM, you can use any computer to map the keys, then plug the device into a systems that don’t offer software remapping. It could also be useful as a gaming keyboard, assuming there aren’t latency issues
As with the AVR-based arcade controller, this project uses the LUFA package to handle the USB stack.
[Jamie] built his own USB connected arcade controller. We’ve been seeing a lot of these lately, and they usually involve soldering buttons to a keyboard PCB. But [Jamie] decided to go a different route and use his own microcontroller. This method always gets a bit hairy when it comes to deciding how to connect it to a computer. Dealing with the USB stack used to be quite tricky, but the LUFA project is slowly taking the pain out of the process.
The Lightweight USB Framework for AVRs is an open source project that handles the hard work associated with USB capable AVR microcontrollers. [Jamie] knew that they already had a sample implementation of a hardware joystick. He’s not using one of the supported boards and so wasn’t able to just compile and go. But porting the code to work with his minimus board was simple enough. With the code in place, the physical build was quite simple. The buttons and joystick were mounted on the surface of an overturned drawer. Each is connected to one pin of the controller board and to ground. LUFA makes sure that the device enumerates as a joystick, and [Jamie] was gaming in no time.
Here’s an altered PCB that gives USB control to an Ikea Dioder. This is a $50 product that comes with four strips each containing nine RGB LEDs. The stock controller has a color selection wheel and a couple of buttons. [Rikard Lindström] wanted to use it to match ambient light to the colors of his computer monitor — yes, it’s another ambilight clone.
Since he already had a bunch of AT90USB162 chips on hand he chose that route. These chips have native USB support (he’s using the LUFA package which is a popular choice), but no on-board ADC. That means no need for the potentiometer from the original controller because there’s no easy way to read its value. Removing it made plenty of room for his add-on PCB. He also depopulated the PIC microcontroller that originally drove the unit, soldering to the empty pads in order to connect is own board. The finished product fits back in the original case, with the addition of a USB cable as the only visible alteration. Now he can dial in colors using a program he wrote.
In case you’re wondering, it looks like this is a newer version of control circuitry when compared to the original Dioder hack we covered.