I have a nearly finished prototype that I want to move to a standalone Atmega328. I am setting it up so that it runs off an on-board 5v power supply I have ready to go. I want to keep the ability to connect it to my laptop via USB as needed to log data and/or update the arduino sketch. To date, I have had success using this USB/TTL converter http://www.ebay.com/itm/130563510226?ssPageName=STRK:MEWAX:IT&_trksid=p3984.m1423.l2649 for USB serial communication.
What I am wondering is, what's an appropriate way to connect the converter so that I keep powering the arduino off it's power supply and not off my computer's USB port? The converter typically gets it's power from the USB port and sends that on to whatever device it's connected to. Should I let the PC power the converter, but just not connect the converter's VCC and GND pins to the standalone MCU board? How can I go about testing if this works without risking frying something?
I guess you could modify a USB cable*, or build your own special USB cable with no power connection.
You're probably OK with both power supplies connected. I think this is how the Arduino works when you run it from ~12V, using the on-board regulator. If I've got the board running off a 12V supply and nothing bad happens when I plug in/out the USB.
Now, if something horrible goes wrong with 5V (home built?) 5V supply and it starts putting-out 12V, you might blow the Arduino and your computer's USB port.
Cut it apart and ohm-out the wires to find the 5V wire, then re-connect the other 3 wires. (Somewhere, I've got a USB cable that we cut apart so we could measure current. It's ugly, but it does the job.)
I did just a project to read/write and program an "live" Arduino, power on it own, using the USB from the computer. My project / test work just great. I use opto-couplers. Schematics, tested, resulted is on this tread. Check it out. That might solve this problem.
Edit: If you have electroinics experience, you can build it. The schematic show only one channel. Just build two. One for RX and TX and a third one for the DTR line. Just like a two-way road. The DTR is the extra road - emergency.
I have two version. One with 4N35 and the other with 6N135.
Edit : One more thing about the USB -TTL adapter. The RX pin from the adapter goes to the TX of the Arduino and the TX of the adapter goes to the RX of the Arduino. Check and test your USB-TTL adapter to confirm. It maybe RX --> RX TX --> TX or RX --> TX TX -- > RX Double check for that. The DTR goes like this : DTR --> 0.1 uF ---> Reset pin to re-program your Arduino.
Should I let the PC power the converter, but just not connect the converter's VCC and GND pins to the standalone MCU board? How can I go about testing if this works without risking frying something?
Having the converter powered from just the USB +5vdc only and isolated from your boards Vcc is OK and actually a good idea. However the USB ground will still have to be wired to your boards ground. In addition it's a good idea to wire two series 1k ohm resistors from the converters send and receive pins and the avr receive and send pins. That's what the arduino design does and gives good isolation against 'backdoor circuit flow' type situations, and lets you use the avr pins for other purposes without damage to or effect from the FTDI chip.
Thanks for the helpful comments everyone! I went ahead and tried it out last night. I connected the TX and RX (apparently with my converter, the TX pin goes to the Arduino TX) and the ground from the converter to the Arduino which was running off it's own power supply. It worked really well. I also put in the 1K resistors in as suggested. The only thing I didn't get working was the auto reset. The DTR pad on my converter's CP2102 chip was way to small for my soldering skills to let me attach a wire or capacitor. I looked around on eBay and found some of the other type with a nice large pad for about $3.00. I ordered a couple of those, so I should be able to play with them in a couple weeks when they get here from China.
I feel silly for needing to ask this, but what does the 0.1uf cap do when connected between the DTR and RST pins? I've usually seen a setup like that for suppressing line noise on the wires connected to a brushed motor. Is this the same type of thing, just smoothing out a digital signal coming out of the DTR pin?