Posts | Comments

Planet Arduino

Archive for the ‘teensyduino’ Category

The first Arduino was serial, and over the decade and a half, this has been the default way to upload code to an Arduino board. In 2008, support for in-circuit programmers was added, and later port detection was added. The latest version of the Arduino IDE adds something new: pluggable discovery. Now any protocol is supported by the Arduino IDE.

This feature is the brainchild of [Paul Stoffregen], creator of the Teensy. If you’ve ever used a Teensy, you’ll remember the Teensyduino application used to upload code to the board. The Teensy uses HID protocol instead of serial for uploading. After working to improve the integration between the Teensy and Arduino IDE, [Paul] stated extending the DiscoveryManager. After some discussion with the Arduino developers, this feature was then added to Arduino 1.8.9, released a month or so ago.

There are some issues with Pluggable Discovery, most importantly that it doesn’t yet exist in the Arduino Command Line Interface (yeah, that exists too). If you’re looking to contribute to Open Source, that would be a nice project to pick up.

With the right JSON, and configuration, it is now theoretically possible to extend the Arduino IDE to any sort of protocol. This means (again, theoretically), it’s possible to update the firmware in your DIY MIDI synth over SysEx message, or a parallel port, maybe. Someone is going to upload to an Arduino board over PCIe, eventually.

We aren’t sure this technically qualifies as music synthesis, but what else do you call a computer playing music? In this case, the computer is a Teensy, and the music comes from a common classroom instrument: a plastic recorder. The mistaken “flute” label comes from the original project. The contraption uses solenoids to operate 3D printed “fingers” and an air pump — this is much easier with a recorder since (unlike a flue) it just needs reasonable air pressure to generate sound.

automated-recorder-solenoid-driverA Teensy 3.2 programmed using the Teensyduino IDE drives the solenoids. The board reads MIDI command sent over USB from a PC and translates them into the commands for this excellent driver board. It connects TIP31C transistors, along with flyback diodes, to the solenoids via a terminal strip.

On the PC, a program called Ableton sends the MIDI messages to the Teensy. MIDI message have three parts: one sets the message type and channel, another sets the velocity, and one sets the pitch. The code here only looks at the pitch.

This is one of those projects that would be a lot harder without a 3D printer. There are other ways to actuate the finger holes, but being able to make an exact-fitting bracket is very useful. Alas, we couldn’t find a video demo. If you know of one, please drop the link in the comments below.

We have seen bagpipe robots (in fact, we’ve seen several). We’ve also seen hammering shotguns into flutes, which is certainly more melodious than plowshares.


Filed under: Arduino Hacks, ARM, musical hacks
Lug
15

Using A TeensyLC To Emulate The XBOX 360 Controller

32-bit, 360, arduino, arduino hacks, ARM, fight stick, Programming, Teensy, teensyduino, teensylc, USB, xbox Commenti disabilitati su Using A TeensyLC To Emulate The XBOX 360 Controller 

After the release of Mortal Kombat X, [Zachery’s] gaming group wanted to branch out into the fighter genre. They quickly learned that in order to maximize their experience, they would need a better controller than a standard gamepad. A keyboard wasn’t going to cut it either. They wanted a fight stick. These are large controllers that look very much like arcade fighting controls and include a joystick and large buttons. [Zachery’s] group decided to build their own fight stick for use with a PC.

[Zachery] based his build around the TeensyLC, which is a 32 bit development board with an ARM processor. It’s also compatible with Arduino. The original version of his project setup the controller as a HID, essentially emulating a keyboard. This worked for a while until they ran into compatibility issues with some games. [Zachery] learned that his controller was compatible with DirectInput, which has been deprecated. The new thing is Xinput, and it was going to require more work.

Using Xinput meant that [Zachery] could no longer use the generic Microsoft HID driver. Rather than write his own drivers, he decided to emulate the XBOX 360 controller. When the fight stick is plugged into the computer, it shows up as an XBOX 360 controller and Windows easily installs the pre-built driver. To perform the emulation, [Zachery] first had to set the VID and PID of the device to be identical to the XBOX controller. This is what allows the Microsoft driver to recognize the device.

Next, the device descriptor and configuration descriptor had to be added to the Teensy’s firmware. The device descriptor includes information such as USB version, device class, protocol, etc. The configuration descriptor includes additional information about the device configuration. [Zachery] used Microsoft Message Analyzer to pull the configuration descriptor from a real XBOX 360 controller, then used the same data in his own custom controller.

[Zachery] programmed the TeensyLC using the Arduino IDE. He ran into some trouble here because the IDE did not include the correct device type for an Xinput device. [Zachery] had to edit the boards.txt file and add three lines of code in order to add a new hardware device to the IDE’s menu. Several other files also had to be modified to make sure the compiler knew what an Xinput device type was.  With all of that out of the way, [Zachery] was finally able to write the code for his controller.


Filed under: Arduino Hacks, ARM

ir arduino

We’ve featured loads of IR Arduino projects and they are all exciting and unique. The projects spring from a specific need or problem where a custom infrared remote control is the solution. [Rick’s] double feature we’re sharing in this article is no exception, but what is interesting and different about [Rick’s] projects is his careful and deliberate tutorial delivery on how to copy infrared remote codes, store the codes with a flavor of Arduino and then either transmit or receive the codes to control devices.

In the case of his space heater an Arduino was used to record and later retransmit the “power on” IR code to the heater before he awakes on a cold morning. This way his room is toasty warm before he has to climb out from under the covers, which has the added benefit of saving the cost of running the heater all night. Brilliant idea if you don’t have a programmable heating system. Maybe he will add a temperature sensor someday so it doesn’t have to run on strictly time.

A more complicated problem was controlling DVD playback software on his computer remotely. [Rick] says he sits at a distance when watching DVDs on his computer but his computer doesn’t have a remote control like a normal TV. Arduino to the rescue again! But this time he pulls out a Teensyduino because of its added feature of being able to emulate a keyboard and of course the computer DVD playback software accepts keyboard commands. Once again he used the “IRremote.h” library to record certain button codes from an old remote control before adding the retrieved codes to a Teensyduino setup and programmed to receive and decode the remote’s IR signals. The Teensyduino then maps the IR codes to known keyboard shortcuts and transmits the simulated keyboard shortcut commands to the computer via its USB cable where the DVD playback software recognizes the key commands.

As always [Rick] shares all his libraries and sketches on his blog so follow the above links to download the files. You will not miss a single step if you follow his excellent videos below. Plus, here are some other ways and other tools for using an IR remote with your Arduino and cloning an infrared remote.


Filed under: Arduino Hacks, computer hacks, home entertainment hacks


  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook