Archive | January 2014

Arduino Pro Micro 3.3v Based HID Flight Controller Box

From time to time me and my closest friends like to have a good bout in IL-2 Sturmovik  . Despite being released in 2001 this game still seems to be the go to sim for online fighter battles. The one thing that always irritates me is keeping track of my key mappings while preoccupied with trying to fly a plane. There’s nothing worse than lowering your gear in the middle of a turn or worse, accidentally dropping the only bomb you have in the wrong place because you hit G instead of B…especially if the wrong place is 20ft above your own runway, where you’d normally be raising gear. Anyhow, to solve this problem I built this.

IMG_20131228_092546IMG_20140125_112526

It may not be pretty but it should do the job. It gives me 5 way selector switches for flaps, potentiometer sliders for mixture and pitch control, missile still switches for…missiles I guess :), and a few switches for things like gear and ignition.

The guts are fairly simple, it’s all straightforward IO wiring into a Sparkfun Arudino Pro Micro. I made a poor choice here though,  I bought the 3.3v version, which happens to run at 8Mhz instead of the 16Mhz that the 5v version does. This shouldn’t really have been a problem but I was making use of the Leojoy package to get this working and, despite being an excellent package, it came with a couple of snags.

If you’ve got a 3.3v pro micro (or potentially any 3.3v/8Mhz leonardo based board) you’ll need to take a couple of steps to get it working. 

1. Install the leojoy package following the instructions included with it. Once its installed you should be able to build, compile, and upload your sketch to the board using the “LeoJoy!” board type, however when it resets after loading you’ll get a “Unrecognized USB Device” error, and the device will show up as a disabled “Unknown Device” in your device manager. To fix this:

2. Add the entry below to your .\arduino\hardware\leojoy\boards.txt

##############################################################
promicro8.name=SparkFun Pro Micro 3.3V/8MHz Leojoy!
promicro8.upload.protocol=avr109
promicro8.upload.maximum_size=28672
promicro8.upload.speed=57600
promicro8.upload.disable_flushing=true
promicro8.bootloader.low_fuses=0xff
promicro8.bootloader.high_fuses=0xd8
promicro8.bootloader.extended_fuses=0xfe
promicro8.bootloader.path=caterina
promicro8.bootloader.file=Caterina-promicro8.hex
promicro8.bootloader.unlock_bits=0x3F
promicro8.bootloader.lock_bits=0x2F
promicro8.build.mcu=atmega32u4
promicro8.build.f_cpu=8000000L
promicro8.build.vid=0x20A0
promicro8.build.pid=0x41B2
promicro8.build.core=leojoy
promicro8.build.variant=leojoy

This will add a “SparkFun Pro Micro 3.3V/8MHz Leojoy!” entry to your list of boards in the arduino IDE. This entry is a copy of the one that comes with the sparkfun addons for their versions of the pro micro but with the “name”, “vid”, “pid”, “core”, and “variant” fields changed to line up with the LeoJoy board configuration. The VID and PID change is what allows the device to be identified as a HID device on connection. The “core” option is what points the compiler to the LeoJoy set of code files on compilation. 

3. Open up  .\arduino\hardware\leojoy\cores\leojoy\USBCore.cpp and replace this line:

PLLCSR = 0x12; // Need 16 MHz xtal

with this

#if F_CPU == 16000000UL
 PLLCSR = 0x12; // Need 16 MHz xtal
 #elif F_CPU == 8000000UL
 PLLCSR = 0x02; // Need 8 MHz xtal
 #endif

It seems that in the version of the core that leojoy was compiled with there still wasn’t the support for the 8Mhz crystal option.

After making these two changes you should be able to upload the sketch to your board and have it show up as a game controller. 

Devmgmt_leojoy

Hopefully this helps anyone else out there hung up with the 8Mhz version of these nifty boards.

Advertisements

Raspberry Pi WSPR Bucket Beacon

It was a snowy lousy day here which was a good excuse to stay in and play with the Pi I had kicking around. I used the software and instructions from the package located here . Whipped together a lowpass filter that could be plugged in easily for the 20m band. Powered the package with the battery from my old IC-02AT and a LM2577 based module to get the voltage right for the Pi.

Here’s all that junk together before it went in the bucket.

Image

The guts of the bucket beacon

This was all tossed in an kitty litter bucket to keep the snow out and taken out in the backyard. A quick and dirty 20m dipole was strung up between a couple of trees a few feet off the ground. In the picture you can just make out the bit of red signal wire strung to the the 1:1 balun that the bucket ties into.

Image

I really wasn’t expecting much from this 2 hour cobble, but the result was actually quite decent. From my QTH in Waterloo I reached out to as far as Edmonton, Dallas, and the west shore of Florida.

Image

A pretty neat little project for a Friday afternoon.