Intro: Arduino Micro USB OTG
Arduino is a powerful compact size programmable microcontroller for DIYers. The minimum basic equipment you need is a laptop, an USB cable, and an arduino. Can we make it even more portable? YES!
All you need is an Arduino and a micro USB OTG which is as big as the USB-B plug itself and you can keep it plugged in the Arduino's socket. Then how can you program it? I guess every DIYer has at least one smartphone in his/her pocket. Sorry if you don't. I don't mean to insult anyone. If you read this i-Ble means that you are interested in Arduino, you have an Arduino, or you are going to have one in the near future. Then you should have an laptop or a PC to program it. If you don't own a smartphone, you should now consider to sell you laptop or PC and buy a smartphone :D
Step 1: USB Type-B Cable
At the first time I hold an Arduino in my hand, I wonder (until now) why Massimo Banzi (the inventor) chose USB Type-B socket, while Micro USB is more compact and widely used on mobile phones.
Well, you don't have to answer that. I will find it out someday :)
Type-B cables are still used on printers. So it is easy to grab one from your old printers. Use a cutter to peel of the rubber seal, cut along the metal part. After you peel off the whole rubber seal, open the cable clamp which is also part of the metal case. Then lift the back part of the metal case with a slotted screwdriver as you can see in the third photo of this step.
Now pull out the plastic case out of the metal case from the backside (you can pull the cable if you haven't cut it off). The inner plastic case is as long as the metal case. If you look carefully, you will see that it has two parts and the joint is about in the middle. Pull apart as in photo number five. Do not throw away the cables, we will need some later on, only about 5 mm of each color :)
Step 2: Micro USB
Micro USB is popular in smartphone. You can use a smartphone's data cable or you can find one in any powerbank which is also popular by this time. Phone's data cable is better. It has wires on its data pins. As you see in photo number two, micro USB has 5 pins namely :
- Vcc (Red)
- Data - (White)
- Data + (Green)
- ID (not connected)
- Ground (Black)
Here I use a micro USB connector comes with powerbank. Peel off the rubber or plastic case with a cutter. If you see 5 pins at the back, that will be easier for you to complete this project. But most connectors come with powerbanks has only 2 or 3 pins show up at the back. They need only pin 1 (Vcc) and pin 5 (Ground) for charging.
Now look at photo number three, that was my first failure project. I will show you what went wrong. You see a vertical line after the cable soldering pads, either you clean up the solder entirely or cut off those pads, then you can pull the left part (the rear of micro USB connector) off. There you see the straight connectors from the front pins. Here you need to test it with a multimeter, set it to "continuity test". Attach a needle on one probe to reach the front pins as they are really micro. In my case (my failure project) pin 2 and pin 3 are connected (see photo number four). So I need to cut off pin 2 and pin 3 (see photo number five).
You need to be very patient to complete this project as you are working with "micro" things. I was almost giving up myself in soldering wires to those pins :P
Step 3: Pinouts and Connection
Well, pinouts are hand drawing as I have no time to draw it with vector app for I am racing with "Small Spaces Contest" deadline :D
All you need to is put that connectors back to back and solder the pins in adjacent (Vcc to Vcc, Data - to Data -, Data + to Data +, Ground to Ground). There is one more ID pin (pin 4) on micro USB which you have to connect it to Ground (pin 5) so that the host device (phone) knows when there is an USB On-The-Go (OTG) device connect to it.
Lastly, before you seal up everything, re-check with your multimeter "continuity test" to make sure that every pins are connected perfectly and no short circuit.
I know.. yes... this is the hardest step to solder tiny pins and make sure no short. But if I can do it then you can ;)
Step 4: Finishing
Put a tape on its metal case. We are going to put the connector back in its metal case so we need to make sure what we solder won't get shorted with that metal case. The micro USB connector is also has the same width to fit in that Type-B case. Then I use hot glue gun to fill every gap, also to hold the tiny wires and connection in place. Give it some time to dry perfectly.
Now you can try to upload a sketch to Arduino. I simply use basic "Blink" sketch.
If you can't upload sketch, maybe you need to install USB Host Controller.
Step 5: Entering Contest
With this I am entering the Small Spaces Contest. I put an Arduino Uno R3 in Hershey's Choclate tin with this Arduino Micro USB OTG, some buttons, servo, variable resistors, LEDs, LDR, capacitors, I can still put in some jumper wires, transistor, or any other small components on top of the Uno. I also stick a mini breadboard on the back of the tin.
Now I can bring my Arduino Uno everywhere in my pocket with components nedded for small projects and show off, especially to kids, about the blink blink magic of a microcontroller :D