Introduction: How to Make a USB to TTL (CH340G)
I made a USB to TTL from CH340G and i would like to share it with you!
It can be used to program microcontrollers like ATMega and such.
It's pretty simple, you only need a few components, PCB creating skills and SMD soldering.
I used it and it works just fine.
I know, it's a chinese IC, but they're quite cheap and easy to use.
It won't blow up,
Step 1: Prepare the Components
You will need those components:
- CH340G (it's quite cheap, under 1$ in my place)
- USB PCB Jack (not the socket). Trust me, i tried using USB socket and a cable but it failed miserably and it doesn't look AS COOL as the USB jack.
- 3x 1k Resistors
- 2x 22pF Capacitors
- 2x 100nF Capacitors
- 1x 10nF Capacitors
- 12MHz Crystal Oscillator
- 0-3x LEDs (one for indicator, one for RX indicator, another for TX indicator). Well, you can just remove or add the LEDs as much as you want. I used one 1206 LED just for the indicator.
- 5-pin Header, i prefer the bent one.
- PCB and dissolving agents ( i don't know what are these called in english ) like HCl, H202, FeCl, etc.
- Soldering iron, Tin, and stuff.
I don't include the links because i bought the components from my local store.
Step 2: Create the Schematics and Layout
You can find the schematics in the internet. But you can use mine. It's quite rubbish but that should do the job.
You can change the schematics all you want. Like, change the connector, remove or add LEDs, change capacitor values, but what worked for me is this.
R4 = 330-2k2 (330 is.very.bright)
C3 = 100n
C4 = 47n - 1u (use ceramic, don't use only electrolytics, unless you want to parallel it with another ceramic cap, which is quite redundant.)
R1 and R2 = 1k. It's just to prevent short circuit and stuff
C6 = 10n
C1 and C2 = 22pF
XTAL must be 12MHz, as stated in the datasheet.
P.S. You can change it to THT or smaller SMD packages, or whatever. Anything that works for you.
Step 3: Create the PCB, Drill and Solder It.
Create the PCB. Etch it and dissolve it. You can find other instructables on this.
I used HCl, H202, and water with a ratio of 1:2:5 or 1:2:4.
Drill and solder it.
You can already tell that i'm too lazy to even cut the excess parts.
Step 4: Test It.
You should have the drivers installed beforehand, or else your computer won't recognize it.
I tested it using ATMega328P that is already arduino-bootloaded.
Create the minimum system of the ATMega chip. XTAL 1 and XTAL 2 connected to crystal, and then grounded. Add decoupling cap, add the reset circuit, and so on..
Then connect the :
- ATMega RX to programmer TX
- ATMega TX to programmer RX
- ATMega Reset to programmer DTR
- ATMega VCC and GND to programmer VCC and GND, respectively.
Upload the code, select the matching port, and upload the program. Wait until it finishes.
If you received getsync error, make sure you already bootloaded the chip. Or maybe there are some loose wires or unconnected traces and/or shorts on the TX or RX rails.
There ya go!
*this is my first instructable. I'm sorry if it's not really that good or just too plain. Any responses are appreciated!