Introduction: USB PCB Business Card

Picture of USB PCB Business Card

This is a business card that will type out some text when you plug it into a USB port.

It uses a ATtiny85 microcontroller with V-USB based code to emulate a keyboard. The typing is triggered by the CAPS LOCK status LEDs being toggled 3 times.

This instructable will focus on using CadSoft EAGLE to create your own USB PCB business card. I want you to be creative in the design, so some minor steps I've taken may have been omitted.

Code download is provided on step 8.

Step 1: Circuit

Picture of Circuit


The circuit is based on V-USB's recommended circuitry. It's powered by the 5V from the USB port. There's two 68 ohm resistors, one on each of the USB data lines, these act as terminating resistors which suppress reflected signals. There is a 1.8 kilo ohm resistor on the D+ line, which allows the computer to detect when something connects to the USB port, and it identifies the device as a low speed device. Two Zener diodes with Vz of 3.6V are on the data lines to clamp the voltage on those lines. There is a 0.1 uF capacitor between the 5V and GND as a decoupling capacitor.

Since the business card should be a compact and thin design, 0604 surface mount packaging is selected for most of the components. The diodes are Mini MELF packaging (they look cool in my opinion).

The microcontroller is an ATtiny85, which is a 8 pin AVR microcontroller. The SOIC package version is chosen to keep the design compact and thin.



To program the microcontroller, in-circuit serial programming is used, which requires the signals: reset, SCK, MOSI, MISO, along with power and ground. The SCK and MOSI are exposed by the USB connector, while two pads are provided for the MISO and reset signals. This allows for a programming adapter to be made.

Step 2: USB Connector

Picture of USB Connector

For the business card, the USB connector is actually the PCB itself. This saves on cost, looks great, and it keeps the card thin.

This connector will be a USB male "A" connector, which plugs into a USB female "A" port (the kind found on computers). First, measurements are taken from the USB port. I create an Eagle component with the dimensions (you need to create a library file first), and also place the pads. It is important to use pads because Eagle will remove the soldermask from pad areas by default. We need the pads to be exposed (not covered by soldermask) in order to make a connection with the USB port.





The created connector component is placed onto the PCB layout. The dimension layer must be a continuous line that follows the outline of the business card and the connector. The dimension layer is what the manufacture will follow when milling your PCB outline.



Step 3: Layout

Picture of Layout



Layout the component as shown, or you can be creative, as long as your layout matches the circuit. For low speed USB, you don't have to worry too much about how the traces are layed out. For high speed designs, you should try to keep the differential D+ and D- signals together and away from noise, but our design is low speed.

Make it look nice! Personally, I like seeing symmetry, parallel or perpendicular angles, and even spacing, but that's my personal preference. You might like curves, abstractness, and chaos. This is all personal preference.

Step 4: Artwork

For my design, I placed my name and some instructions using the text tool in Eagle CAD.


The tStop and bStop layers in Eagle control the soldermask. Soldermask will not be present on the areas covered by tStop or bStop. The "t" and "b" mean "top" and "bottom. This fact can be used to your advantage.



Remember that areas with copper and soldermask will look light green, areas with no copper but with soldermask will look dark green, areas with no copper and with no soldermask will look sort of yellowish. Also remember that more light will go through if the bottom layer is uncovered.


Area with no soldermask but with copper will become tinned. This will be silver if you get your board tinned with regular tin or lead solder. If you want to spend more money, you can ask the PCB manufacture for gold plating instead.

On my own card, you can see that I've placed my own name in both the top copper layer and the tStop layer, thus creating the silver text effect by placing text under an area without any soldermask.



You can also ask the manufacture for other colours aside from green. Here is my friend's University of Waterloo PCB Ruler, created with black solder mask and gold plating (black and gold are my school's colours):


Here are some other possible PCB colour combinations:


Silk screen is the layer usually used for text, it goes over the soldermask. It is usually specified using the "tSilk" and "bSilk" layers in Eagle. It is important to remember that silk screen cannot exist without being on top of soldermask. You can usually ask the manufacture for a specific silk screen colour, the default is usually white silk screen with green soldermask.

Another neat trick is to import bitmap images as components so you can have bitmaps on your PCB, you can do this for any of the layers. Create a component in a library file, and then run the user script called "import-bmp". Save the library and add the component to your PCB.



Step 5: Manufacturing the PCB

Picture of Manufacturing the PCB

You can achieve a really nice "DIY" feel if you etch the PCB yourself, but I choose to go for a "professional" look by sending my PCB design to a PCB manufacture.

Seeed Studio offers a service that can get me 10 pieces for $28 plus shipping, and it takes 5 days to manufacture, plus shipping time. I think this is an extremely good deal.

I have a CAM job (see attached) that you need to load into the CAM processor inside Eagle, running this CAM job will generate a collection of PCB Gerber files that you need to send to Seeed Studio (or another company) in order to get your PCB manufactured. Zip up the file, and email them to the company (after you pay).



Please be aware of the file that your bitmap layer goes into! If you select the bitmap layer in the copper gerber file, then the bitmap will become a part of the PCB's copper. If you select the bitmap layer in the silkscreen gerber file, then the bitmap will become a part of the PCB's silkscreen.

Please use a Gerber file previewing tool before sending it off to manufacturing. I personally use Gerbv http://gerbv.sourceforge.net/

For kicks, I also made some non-USB business cards/keychains, see picture above (I forgot why I blurred the picture). The smaller size made these dirt cheap.

Step 6: Fixing the Connector

Picture of Fixing the Connector

It's a good idea to add some solder to the pads of the connector. This makes it more resistant to wear and tear.

Ideally you want 2.4mm thick PCB material, but apparently this costs extra, so the default 1.6mm was used. The USB connector needs to be thicker than 1.6mm so green electrical tape was applied to the back of the connector to add some thickness to it. See above diagram for my technique for applying the tape.

Step 7: Circuit Assembly


Solder all of the electrical components. 0604 sized components are very easy to solder if you have a pair of tweezers.



Put some solder on one pad, keep heating that pad and move the component into that pad, make sure it's aligned correctly, then remove the heat and let the first joint cool. Then you are able to solder the 2nd joint very easily.

Remember, flux can make the difference between a fun project and quitting the electronics hobby. I suggest you get a flux pen.

Step 8: Programming the AVR

You need to download the code provided here.

Open up the file "main.c" and find the place where the string is stored, look for the function "puts_P". You need to edit this string before compiling (or else it will print my text instead of yours). You'll notice that the string is stored in flash memory, and if you compile a longer string, the size of the flash compilation increases. Please be advised that you cannot exceed the memory capacity of the ATtiny85, which is 8KB of flash memory.

After editing the string, compile the code. The ".avrproj" file is a file format that can be opened by AVR Project IDE (a IDE I made for myself), which makes compiling the project very easy.

A hex file is generated and you can write the hex file into the AVR. You need an AVR programmer of some kind, and connected to the business card as shown in the schematic below. Remember to connect those hidden connections!

Also please note that the programmer must be set to use a low speed due to the 68 ohm resistors on the D+ and D- signals. This means the AVRDUDE option "-i <delay>" must be included, so the command looks something like: "avrdude -c programmer_name -p attny85 -i 100 -U flash:w:file_name.hex"

How do you connect the programmer? First take a look at the schematic:


I made a not-so-neat looking programming adapter using a USB port, a AVR ISP connector, and some wire:


Here it is, connected to my USBtinyISP:


This is what the card looks like while being programmed:

Step 9: Explaination of the Code


The code uses V-USB to create a USB keyboard. V-USB is a software package that allows you to make USB devices out of AVR microcontrollers.

Instead of explaining using text, I have a video tutorial about how to build a USB keyboard:

http://www.frank-zhao.com/index.php?page=usnoobie_rfid_keyboard

Please note that this two part video is over 15 minutes in total. I've put an incredible amount of effort into the video. Please watch it in 720p full screen so you can read all the text.

I also have another Instructable that will explain more USB and V-USB stuff to you: https://www.instructables.com/id/USB-Wii-Classic-Controller/

The differences between the RFID USB Keyboard and this USB PCB Business Card is that the ATtiny85 is used instead, and the text comes from internal flash memory instead of a serial port. One important aspect to note is the fact that the ATtiny85 uses an internal PLL to generate the clock speed that V-USB requires.

Also read my other USB instructable involving creating more USB devices, where I explain the USB bus, descriptors, and other aspects in more detail.

Step 10: Using the Card

Plug into an USB port, making sure that the pads on the card will connect with the contacts inside the USB connector.

Your operating system may start install a driver automatically, if this happens, wait for it to finish installing.

Open a text editor such as "Notepad".

Press CAPS-LOCK on your keyboard a few times.

Watch the magic happen as the card types out text into the text editor.


What if it doesn't work

Did you try taking it out and plugging it back in?

Did you plug it in right-side-up? Follow this diagram:

If CAPS-lock doesn't trigger it, then try NUM-lock and scroll-lock (this seems to be a problem with Linux).

If it causes your computer to act weird after unplugging the card, just hit both of your shift keys a few times. This should only be a problem if you unplug the card before it finishes typing, because it may have "held down" the shift key.

Comments

Ah-che (author)2017-07-03

Hi, i have a trouble with this project . AVR Project IDE says : Error, failed to open file.

jeanzhu (author)2015-07-15

nice job, here is my card, if you need PCB,you can go to www.syspcb.com

Colleen GrochV (author)jeanzhu2017-02-17

can you make one of these for me??? i am interested as to having something like this for our entire staff as business cards and looking for the right person that can do it????

TushaarS made it! (author)2016-08-15

Finally i made it, also added led's in it......thanks a ton for guiding FRANK!!

Capacea (author)2016-02-20

Hello!

Have you used any compiler optimizations?

bnicholas3 (author)2015-12-10

can you just use a regular flash drive or sd card?

sasha2105 (author)2015-09-23

verence (author)2011-07-27

Very nice Instructable and a very nice product - although I would never plug an USB device given to me by a stranger into my computer (neither private nor at work).

But at an interview, the idea and the quality of execution alone would mean something.

frank26080115 (author)verence2011-07-27

People are afraid that it'll do "rm -f /"

I could also (in theory) open up a web browser using a multimedia key and then visit any URL

Revanchist (author)frank260801152015-09-09

ah this was what I was looking for... would you be able to elaborate on this? I'm looking to build one so that it opens a browser.

Thanks

Give them a regular card with a URL on it. If they say that they don't have internet or their internet's down, give them one of these.

pmk222 (author)2015-07-14

i really like the idea of using the chip to hide the two hidden pins from the front while also allowing that to make it more compact (as far as the actual circuit goes).

Marc_Escobaem made it! (author)2015-02-25

Thanks for this Instructable! Made it and will use it for my applications!

ntsagarides (author)2015-02-22

That is a great and impressive idea but I have a v1.1 idea.
You could cut a rectangle on the PCB to the place where the IC sits and solder the IC dead-bug style so that it doesn't stick out that much. Of course the rails would need to be adjusted a bit to match the new layout.

Tecwyn Twmffat (author)2015-02-18

Hello There, this looks great and I want to make something similar but cant find the eagle pcb file. Am I missing something here?

amuralha (author)2014-09-26

Can I program the attiny with an arduino?

attiny85etc (author)amuralha2015-01-03

This link explains how:

https://www.instructables.com/id/Programming-an-Atmel-AtTiny85-using-Arduino-IDE-an/

Tangoforce (author)2012-11-23

Very cool idea. Just one quick question please, is it possible to make a custom flash drive like this instead of using a microcontroller?

Eonir (author)Tangoforce2014-10-19

Of course, it is possible, but iIt would be much harder, depending on your requirements.

In this project, the micro is acting as a HID keyboard, which is very simple once you have the right library (V-USB). But to make it act as a USB drive, you would of course need something much different.

The easiest way to achieve this would to find an open source schematic of a USB flash drive and redo the layout into the form of a business card. It would be much more complex.

thelinuxnerd (author)2013-04-02

Can you please fix your schematic as it took me over 10 tries to finally realize that the pin #s are wrong. Other than that great project.

pvalyk (author)thelinuxnerd2014-07-16

and what is the correct one? was the schematic fixed? thanks

Jan_Henrik (author)2014-05-02

This is more then Awesome!!!

hornbadoing (author)2013-10-30

Just a question. Could ou do the same with this but make it hold down a key for the time its plugged in? and how small could you make it?

I can make it hold down a key, but it will keep being held down even if you unplug it, or at least in Windows it will do that, I'm not sure about Mac or Linux.

Size has nothing to do with this.

jgidel (author)2012-08-03

Your circuit and you description of the circuit are different. Could you please add a corrected version of the circuit to your instructable. I like the idea and want to try it but I can't get it to work.

lukestanmore (author)2012-06-07

I'm amazed that nobody has asked, but can you please elaborate on the use of the vibrator on the soldering iron? Being a teenage lad, it isn't really the kind of thing I just have lying around in a cupboard or whatever!

it's a joke, the joke is that SMD soldering is so easy, you can even do it while holding a vibrator

Ahhh! Right, that makes sense now! I was thinking it was something about making the iron bounce off of the board for a split second so not to over heat anything! Great instructable though! I might have to try it!!

laxap (author)2011-09-17

Frank,

frankly, this is an awesome project. The ideas to (1) use an HID profile, and to (2) use capslock to "talk" to the card are just terrific.

I'm sure you impressed your card recipients.

You totally deserved your 1st prize in the USB contest. Did you get your HP TouchPad? What will you do with it? hack it?

  Pascal

frank26080115 (author)laxap2011-09-26

Hi Pascal

Thanks for the kind words.

I didn't get the HP Touchpad because it was being discontinued, I received a prize of equivalent value instead.

On a somewhat related subject (since now people are hacking the HP Touchpad with Android), I did recently get my first ever smartphone, a Samsung Galaxy Infuse 4G, running Android 2.3. I also got a Micropendous. So I am completely ready to start hacking with Android ADK.

Kryptonite (author)frank260801152012-02-24

Did you end up hacking the ADK??

FightCube Technologies (author)2012-02-01

I really appreciate your effort to show how easy it is to solder 0603 SMT ... honestly I do. Great job! However... it's still wrong on so many levels ;-) Great Instructable!

Matrix-technician (author)2011-12-15

Hey there! Pardon me if i missed it, but what is the cost of these per (1) assembled at home. And what would it cost to have these manufactured?

xa4 (author)2011-10-20

Very cool !! thank's a lot for sharing

Yandle (author)2011-09-29

Very awesome! ... .. Vibrator... #$*%ing PRO!

sdtrent (author)2011-09-28

What happened to the picture of the USB connector? It was cool to see the details on the pcb layout. Perhaps I am missing something. It looks like you can download the files to do the project yourself but I cannot find the file for the pcb.

frank26080115 (author)sdtrent2011-09-28

Thanks for bring this to my attention, I've formatted my Instructables in HTML and they seem to have disappeared, causing most of my pictures to be missing.

see:

https://www.instructables.com/community/All-my-HTML-disappeared/

I'll add the PCB file soon.

hornbadoing (author)2011-09-20

im not that good with computers.. is there a way i can do that with a flash drive??

hornbadoing (author)hornbadoing2011-09-22

Nobody answered my question so i went searching.. the answer is yes you can do it with a flash drive. its actually pretty neat and u don't have to be a genius to do it.

c.klomp (author)2011-09-16

how does one get his hands on one of these? its awesome!!

BeefyHaze (author)2011-08-20

Wow, thats pretty slick but people might shy away and think that you are controlling their computer... Ive done things like this and some of the more computer illiterate freak out and shout "VIRUS" great design though

husamwadi (author)2011-08-17

woah

SDgeek (author)2011-07-27

I can't help but do a double post here...Using this for handing out a resume is an instant job offer in my opinion.

MatthewEnderle (author)SDgeek2011-08-14

WOW!!! Never thought of that... but I just found this so it's too late for me.

thoraxe (author)2011-08-14

That is godly bro, +1000 internets to you.

Franzjr (author)2011-08-11

Felicitaciones un excelente proyecto, Congratulations, one excelent project

MrF_DT_teacher (author)2011-08-10

Nice job, I like it a lot!!

EngineeringShock (author)2011-08-08

I sincerely hope this wins first prize. You deserve it!

ryanlg (author)2011-08-07

Can you please supply the full specifications on the diodes (Forward voltage, etc) or a product code.
Kthxbye

frank26080115 (author)ryanlg2011-08-07

look for 1N5227B

About This Instructable

117,852views

668favorites

License:

Bio: I am an electrical engineer. I graduated from U of Waterloo. I used to work for Adafruit Industries as an EE. Now I work for ... More »
More by frank26080115:LED Pocket WatchEasy Cord Wrapping Around Power BricksUsing SMD Components on Breadboards
Add instructable to: