make: my first usb device

3
H O T W I R E D! GET MORE FROM YOU RIG ¤ DIY WATER COOLING ¤ MAKE A CASE SENSOR ¤ CORE i 7 OVERCLOCKING ¤ MAKE A CASE SENSOR Issue 230 Sep 2009 £5.99 Outside UK & ROI £6.49 ISSUE 230 IT CAN’T RAIN ALL THE TIME EVEN MORE… NOVATECH X90 GTX PRO MESH SLAYER PC COOLIT DOMINO ASUS XONAR DS ZOTAC ION MOBO TRINE, ANNO 1404 Men of War PROTOTYPE: UNLOCK GENETIC SHACKLES ARMA 2: WAR HAS NEVER FELT SO REAL PERFORMANCE GEAR & GAMING GIVE WINDOWS A HUGE BOOST! P54 56 GAMES 12 gaming mice in the labs Pixel-perfect shooters FREE DVD “A BRUTAL CROSS BETWEEN DIABLO AND ROGER RABBIT Dave loots and shoots in Borderlands IT CAN’T RAIN ALL THE TIME WWW.PCFORMAT.CO.UK ISSUE 230 SEP 2009 THERE’S MORE… Gigabyte: behind the scenes Core i5 specs revealed Real Time Strategy classics! AMD: still best for budget gaming?

Upload: jeremy-ford

Post on 11-Mar-2016

232 views

Category:

Documents


1 download

DESCRIPTION

Hold on to your breadboards, we’re going to try and make a fully working USB device. We’re a little scared… While we regularly like to disembowel, disassemble, disfi gure and generally ‘dis’ USB devices in all of their forms, it’s always either standing on the shoulders of the geniuses that made the device in the first place, or at least leaning on the fact that the USB interface offers a handy 5v supply.

TRANSCRIPT

Page 1: Make: My first USB device

HOTWIRED! GET MORE FROM YOU RIG ¤ DIY WATER COOLING ¤ MAKE A CASE SENSOR ¤ CORE i7 OVERCLOCKING

¤ MAKE A CASE SENSOR

Issue 230 Sep 2009 £5.99 Outside UK & ROI £6.49

ISSUE 230 IT CAN’T RAIN ALL THE TIME

EVEN MORE… NOVATECH X90 GTX PRO MESH SLAYER PCCOOLIT DOMINOASUS XONAR DSZOTAC ION MOBOTRINE, ANNO 1404

Men of War

PROTOTYPE: UNLOCK GENETIC SHACKLES

ARMA 2: WAR HAS NEVER FELT SO REAL

PERFORMANCE GEAR & GAMING

GIVE WINDOWS A HUGE BOOST! P54 56 GAMES

12 gaming mice in the labs12 gaming mice in the labsPixel-perfect shooters

FREE DVD

“A BRUTAL CROSS BETWEEN DIABLO AND ROGER RABBIT”

Dave loots and shoots in Borderlands

IT CAN

’T RA

IN A

LL THE TIM

E W

WW

.PCFOR

MAT.CO

.UK

ISSUE 230

SEP 2009

THERE’S MORE…Gigabyte: behind the scenesCore i5 specs revealedReal Time Strategy classics!

AMD: still best for budget gaming?AMD: still best for budget gaming?AMD: still best for budget gaming?

PCF230.cover 1 15/7/09 10:10:25 am

Page 2: Make: My first USB device

While we regularly like to disembowel, disassemble, disfi gure and generally ‘dis’ USB devices in all of their

forms, it’s always either standing on the shoulders of the geniuses that made the device in the fi rst place, or at least leaning on the fact that the USB interface offers a handy 5v supply.

We’d never pretend to be electrical engineering experts or even acolytes. But, for once, we’re going to stick out our necks a little and attempt to put together a fully functioning USB device. This borrows heavily from clever people online and is based around a more advanced ‘PIC’ device. These are simple programmable processors produced by a company called Microchip Technology (www.microchip.com).

Over 6 billion of these bad boys have been shipped in their time and, costing as little as 50p for the basic models, they’ve been rather popular with hobbyists. Coming with their own

Make: My first USB deviceHold on to your breadboards, we’re going to try and make a fully working USB device. We’re a little scared…

onboard fl ash memory and boasting easy-to-use interfaces, they can be turned to a host of applications.

Before you can use a PIC it needs to be properly programmed. This involves loading it with a program from your PC. Programmers are available on eBay for as little as £10, but if you buy one make sure it’s compatible with the model of PIC that you want to use. In our case, that’s the 18F2550. It’s a more advanced PIC and so is less widely supported than the default PIC16 models. ¤ Neil Mohr

What you will need¤ PIC programmer¤ PIC 18F2550 MCU¤ 20MHz crystal clock¤ Breadboard¤ PCB USB B-type socket¤ 1x 0.22uf capacitors¤ 2x 22pf capacitors¤ 1x 0.1uf capacitors¤ 1x LED¤ 1x 330ohm resistor

64 September 2009

Future Publishing Limited provides the information for this project in good faith and makes no representations as to its completeness or accuracy. Individuals carrying out the instructions in this project do so at their own risk and must exercise their independent judgment in determining the appropriateness of parts, equipment, sealants and other

adhesives for a particular use. (Yes, we know, but it’s what the lawyers tell us to print). Protective clothing, gloves and goggles/safety glasses should also be worn at all times, when using drills and soldering irons. Use of the USB device may void a product’s warranty (like you really care, but, again, we have to say this for the stupid people). To the fullest

extent permitted by law, Future Publishing Limited takes no responsibility for any person relying on the information relating to this project and disclaims all liability for any errors, omissions, damage or injury to users or their equipment as a result of or relating to their making and use of the USB device.

Costs

£25

1

4

3

2

PCF230.make 64 16/7/09 8:21:31 am

Page 3: Make: My first USB device

Make: My fi rst USB device

Every PIC programmer is different – some are USB, some are serial, others are standalone. Either way, you need to program the PIC with a USB fi rmware. From www.schmalzhaus.com/UBW/index.html grab the Firmware D v1.4.3 HEX fi le, near the bottom under the fi les section (1). Looking at the USB B female socket’s terminals with the connection pointing left. The top left pin is the ground terminal, to the right of this is the 5V positive terminal. Bottom left is the positive data terminal and right of this is the negative data terminal (2). The 20MHz clock crystal connects to pins 9 and 10; there’s no polarity so either terminal will do. Each terminal also requires a 22pf capacitor connecting to the USB ground terminal (3). It’s best if you connect the USB ground to its own strip as this is used a lot. For instance, connect the 0.22uf

capacitor from pin 14 to the USB ground for the USB voltage regulator (4). Connect the USB positive data terminal to pin 16 and the negative data terminal to pin 15 (5). Pin 8 and pin 19 of the PIC both connect to the USB ground. Pin 20 connects to the USB positive power terminal (6). It’s worthwhile placing a 0.2uf capacitor across the power pins 19 and 20. This helps eliminate any spikes in the supply (7). From Pin 26, connect the 330ohm resistor and the status LED to the USB ground (8). Download and install the driver from tinyurl.com/5dbco2. When you plug in the device, choose to manually install the driver from C:\MCHPFSUSB\fw\Cdc\inf\win2k_xp_vista32_64 (9). This base USB device is the gateway to a host of projects, such as can be found at www.semifl uid.com/?cat=9 or search Google for 18F2550 for more things to try (10).

How to program your PIC

September 2009 65

“Over 6 billion of these bad boys have been shipped in their time and they’re popular with hobbyists”

5

6

7

8

9

10

PCF230.make 65 16/7/09 8:21:34 am