OPAMP Inverter for USB Adapters

SAborn

Senior Member
Recently i needed an inverter for use with a USB to TTL adapter (CP2102) and as most common inverter chips are hex inverters with a large than needed package i decided to use a smaller dual opamp LM358 (8 pin chip) its a common opamp that will work from a single supply.

I tried it with the CP2102 USB adaptors and the PL2303 adapters and both work without fail even sending data at 32mhz.

The circuit makes a smaller foot print on the pcb and easy to setup.


LM358 USB Inverter..JPG

View attachment LM358 USB Inverter.pdf
 

Goeytex

Senior Member
Dang SAborn,

Those things cost 30 cents each! Guess I need to get a second job.

Let's see now.


Dongle: ..... $3.00 US
Inverter: ... $0.30
Resistors: .. $0.20
USB Cable ... $2.00

----------------------------
Total:........ $5.50

Not bad for a Poor Man's USB Programing Adapter
 

hippy

Ex-Staff (retired)
$5.50 ... plus any stripboard and sockets, PICAXE connecting cable, a box to put it in, postage costs for those, plus build, testing and debugging time, along with solder and electricity used. All hidden costs that people forget to take into account, but I'll agree it's still not a bad deal.

BTW : I'd change the top resistor to something higher so the comparators are switching below 2V5 for use with PICAXE operating at lower voltages.
 

SAborn

Senior Member
BTW : I'd change the top resistor to something higher so the comparators are switching below 2V5 for use with PICAXE operating at lower voltages.
I knew someone would find a fault;)
Good point though, i didnt even consider the lower voltage chips.
It was just a quick throw together circuit that worked well for a compact size.
The good part about these dongles are they have 5v and 3.3v supply pins on the dongle, eliminating the need for other power sources on a prototyping board.

The switch is needed for hard resets or the drive disconnects when you unplug the usb dongle.
They also have leds to show traffic on the lines during TXD and RXD.
When all is said and done i still rather the cheap Chinese USB to serial cables or the rev-ed ones as they are fixed to a port setting, and the dongles assign a port when plugged in, all fine unless there is serial data being transmitted when the driver is loaded and then the PC sees it as a mouse or some other pointer device and it causes problems with the normal mouse.
It can be a real problem that makes the mouse do some crazy stuff with the arrow out of control zipping all over the screen.:confused:
 

Goeytex

Senior Member
Wow,

I've been using these CP2102 Dongles for two years ans have never had an issue with the mouse.
However, several things need to be noted with these cheap modules.

1. You cannot adjust the serial "latency" like with the more advanced FDTI chip.

2. The TX data level is 3.3v not 5v like with the AXE027

3. The RX input is "5v tolerant" but it likes 3.3v better. Sometimes with a 5v input I have
experienced memory verification errors when programming a Picaxe

4. All modules seem to have have the same serial number (0000001)
If using more than two of these at the same time whether for Picaxe Programming or for a UART
interface to a RS232 Port, etc , it may be a good idea to use the Silabs utility to program a unique
serial number for each dongle.
 

SAborn

Senior Member
3. The RX input is "5v tolerant" but it likes 3.3v better. Sometimes with a 5v input I have
experienced memory verification errors when programming a Picaxe
That works to he opamp inverter advantage, as the LM358 will have an output voltage 1.5 volts less than the supply voltage, making it close to the 3.3v. (5v - 1.5 = 3.5V output)
 

Goeytex

Senior Member
Or you could use a rail-to-rail op amp and use the 3.3v supply on the CP2102 module to power the opamp.
 

SAborn

Senior Member
I just received a delivery with some other USB dongles that i had ordered to match up with some wireless modules.

On testing the dongles they are far a better module than the other CP2101 and PL2303 ones i have, these have selectable (jumper pins) RS232 or TTL output, a inverter on the board, 5V+ and ground output supply pins, they use the HL340 driver which is a FIXED com port, and work perfect straight out of the box for @$6.00 including postage.

http://www.ebay.com.au/itm/170710234943?ssPageName=STRK:MESINDXX:IT&_trksid=p3984.m1436.l2649
 

fernando_g

Senior Member
That works to he opamp inverter advantage, as the LM358 will have an output voltage 1.5 volts less than the supply voltage, making it close to the 3.3v. (5v - 1.5 = 3.5V output)
Another possibility is to use a LM393. It has the exact same footprint and pinout like the LM358, but its output is open collector. As such, the output voltage can be tied to a voltage different to the supply voltage. Therefore, one can convert from 5 to 3.3 volt signals or viceversa. Additionally, since it is uncompensated, the transitions will be much faster, which could be required for higher speeds.

But I agree that the best component to use is the one already at hand.
 

Janne

Senior Member
If we look into digikey, the cheapest through hole dual rail-to-rail opamp(30c) is still much more expensive than the cheapest T-H inverter (13c..) and the opamp needs the extra resistors, so I say the inverter is still the winner =) (One-off component prices)
With SMT the price goes down even more, as goes the requirement for board real estate.
(smart-ass mode off)
:)

But it's a nice board, I like it. I did something similar a bit earlier too, but with XOR gates and a toggle switch to toggle between inverted and normal serial.
 

Goeytex

Senior Member
Hi SAborn,

Those modules are the sames ones Dorji uses for some of their RF modules as a programming interface. (Dorji PN DAC13).
I ordered 10 of those last week for testing / validation. Should be here soon.

The details on the CH341/HL340 USB Chip are sketchy and maybe you can confirm but I need a dongle / module that brings out
RTS and DTR as well as RX and TX. RTS and DTR can be used to trigger interrupts, etc on the Picaxe and allows more than
just a simple RC/TX serial link between the the Picaxe and other devices / software.
 

mrburnette

Senior Member
Why does it matter ?
I think what nick12ab was saying is that most "mail order" resistors these days are about a penny for 1% 1/4W metal film. 'course, being from Georgia, I know that no true Texan would buy a measly 1/4W resistor; Texans would buy a rugged 10W puppy with screw-down heatsink :D

Two of these puppies make for a Real Texas voltage divider:
TEXASresistor.jpg

My last order from taydaelectronicsl was so cheap, that everything I ordered was 1% when available.

- Ray
 

SAborn

Senior Member
The details on the CH341/HL340 USB Chip are sketchy and maybe you can confirm but I need a dongle / module that brings out
RTS and DTR as well as RX and TX. RTS and DTR can be used to trigger interrupts, etc on the Picaxe and allows more than
The wireless modules i bought are a Dorji module so i grabbed a handfull of dongles to suit as the seller offered a discount price on them at the time.

Its not clear on the board as the header is marked VCC, GND, TXD, RXD, SET, CS, and as the Dorji site is not responding to some sections i can not check at present.

I have only had them 1/2 a day so have not had a chance to test a lot out other than a straight download and read serial back in, they past that test well.
 

fernando_g

Senior Member
Mburnette:
That resistor is still wimpy.
A true-blood Texan would use something even larger, along some forced air cooling.

untitled.GIF
 

Goeytex

Senior Member
Ahh, I suspect that Nick was just wanting to jump on the 20c price that I used to tell me I was an idiot for paying that much. The truth be told I pulled a random number out of my *** and multiplied by 3.14159.

I actually haven't bought a resistor, OpAmp, Capacitor, Comparatpr, 555, L0gic IC, etc in over a two years since I bought out most of the inventory of an electronics surplus outfit that decided to shut down. Sometimes I think there's a wee bit to much nitpicking and fault finding going here, with some ready to pounce at a moments notice on anything that is perceived to need "correcting". And If we can't find fault with technical stuff some of resort to correcting grammar and spelling. Waz up wiff dat?

Hey Nick, Would you be happy if I had said "< 20c " ???. OK less than <20c.
 

nick12ab

Senior Member
Hey Nick, Would you be happy if I had said "< 20c " ???. OK less than <20c.
Yes, that would be fine! 20c IS quite a lot for two resistors or even four including the PICAXE download ones so I took the opportunity to mock Maplin's prices again.
 
Top