Saturday, January 10, 2015

Preparing a Used SDCard for Raspberry Pi

I'm preparing a previously set up SDCard for Installing a CoPiino (Arduino Hat for Raspberry Pi). The problem is that Windows only recognizes the first partition on a SDCard. Here are the steps I took to remove the old Raspberry Pi partitions, and prepare the card for a new Raspian install.

DISKPART
Start a command prompt, and type in DISKPART and press Enter to start the DISKPART console. List all of your disks by typing LIST DISK, then select the proper disk with SELECT DISK # (where # is obviously the SD card). You can then type CLEAN (MAKE SURE YOU SELECTED THE PROPER DISK!), and it will clear the partition table on the card. To create a primary partition to reuse the space on the card, type CREATE PARTITION PRIMARY. This will then reallocate the previously "cleaned" space.


SD FORMATTER
Download SD FORMATTER and format the SDCard.

DOWNLOAD & COPY THE RASPIAN IMAGE
Go to http://www.raspberrypi.org/help/noobs-setup/ and follow the instructions for downloading and copying the image to the SDCard. Then boot the Rasperry Pi, and finish the install normally.

Monday, January 5, 2015

Interfacing an Old School 15 pin Joystick

Today I'm working with an older PC style 15 pin joystick. This predates the newer USB joysticks by a couple of decades, and makes it a lot easier to interface with the Arduino. I'm using a joystick shield that's made by Lectrobox, with a Joystick made by Suncom. Any 15 pin IBM PC Joystick will work fine. It's only wired for one joystick, so you would need two shields for two joysticks, or mod the shield (moderate difficulty), for use with a Y splitter.

There's no wiring involved, and the onboard jumpers allow you some selection in Arduino pins.

Note: To connect a PS/2 keyboard, see http://www.instructables.com/id/Creating-the-PS2-Keyboard-smart-interface-for-micr/


The sample code provided outputs the analog positions of the stick, and the digital positions of the two buttons:


I'd recommend using interrupts for the buttons (pins 2 & 3) so as to not miss button presses, with some debounce code, but that will take some moderate shield modifications. You will probably have to play with your stick adjustments to get zero readings at rest. You can build your own shield, with a female 15p D Sub, and wire it for 2 joystick operation if you want, or stack a second shield. See http://www.built-to-spec.com/blog/2009/09/10/using-a-pc-joystick-with-the-arduino/ for more info. A Y Splitter Cable would allow two joysticks to a single port in this scenario. The joystick Shield above only is wired fore one.