Need help understanding and simplifying circuit

Thread Starter

trace

Joined Jan 10, 2013
9
I'm trying to build an interface to talk to this particular battery charger that has a single wire bidirectional serial port.

Someone created the following schematic based on the official interface you can buy. It may not be 100% accurate but it's a good starting place. The zener voltages listed were measured values, I imagine most or all of them are actually 3.3V zeners or thereabouts because that's supposedly the signal wire communication voltage. The interface is an RS-232 to single wire serial converter with optoisolation.



This circuit is beyond my very basic understanding of electronics. The interface I want to build does not need the RS-232 conversion components because it will have straight TTL serial TX/RX and I do not need the optoisolation because I'm using separate unconnected power sources for each side (batteries).

My plan is to use an Atmel ATmega with two serial ports to provide the interface. The software on the ATmega will do nothing more than pass data between the two serial ports. The ATmega runs at 5V so I'm using a CD4050 to convert the single wire signal down to 3.3V.

The following is the schematic I have started. I believe I need some pull-up or pull-down resistors and possibly signal inversion but I'm not sure, this is where I need help understanding the original circuit.



Thanks!
 
Last edited:

Thread Starter

trace

Joined Jan 10, 2013
9
Well I tried my circuit above with and without pull-ups on the RX side from the charger but nothing works. It seems like the charger may be receiving data OK but the response is garbled.

I guess without help I'm going to have to start analysing the data stream manually. Unfortunately I don't have the equipment to do this easily.
 

praondevou

Joined Jul 9, 2011
2,942
Look at page 7 of this datasheet: MAX232.

You need only one of these chips. It will provide you with 2 channels of TTL to RS232 converters and 2 channels of RS232 to TTL.

Basically no additional circuitry needed. Unless you need the hardware control lines as well.
 

Thread Starter

trace

Joined Jan 10, 2013
9
Thanks but I don't need RS-232 to TTL, I have that covered (this is the "PC" RX/TX input in the lower circuit).

Instead I need to understand how the first circuit is working and make my circuit have the same behaviour. Essentially I need to build a version of the first cicuit without its optoisolation and without its RS-232 to TTL conversion.
 

praondevou

Joined Jul 9, 2011
2,942
Confusing.

Can you confirm the following:

The PC communicates via RS232 with the ATMEGA.
The ATMEGA communicates with the battery charger IC.

Is that right?

Then why do you need a simplification of the first circuit if you already have RS232/TTL covered? What do you mean by "you have that covered"? Aren't the signals from the ATMEGA 5V TTL signals? How do you communicate with a PC RS232 interface like this?

Last but not least:
What IC do you want to communicate with? Datasheet please.
What's the 3.3V about if both the ATMEGA and the battery charger IC work with 5V?

And, if you want a simplifaction of the first circuit then use the IC I proposed and tie the 5V signal side output/input together. That's all.
 

Thread Starter

trace

Joined Jan 10, 2013
9
OK, you win! :D Yes, hooking up my TTL serial source directly to the charger worked. I kept the 470 ohm resistors and I still used the CD4050 to do 5V to 3.3V conversion. I know the charger uses a 5V output but why would they have those 3V zeners on the line? THat makes me think the charger needs 3V signalling level, I don't know.

I had tried this before and it didn't work which is why I was posting here for help with designing my more complex circuit. However, I just tried again and this time it worked. Maybe this means it will be unreliable, I don't know but it seems to work at the moment. This certainly is a much simpler design and with about $1 in parts versus $25 for the official interface. No optical isolation though (I'll add that later).

Thanks again
 

Thread Starter

trace

Joined Jan 10, 2013
9
Does this look acceptable as a dual-line TTL to single wire optically isolated circuit? Or am I way off?

 
Last edited:

Thread Starter

trace

Joined Jan 10, 2013
9
My circuit above does not work. Maybe the PC817 is too slow or something? I believe the serial port is running about 115200 bps.
 

MrChips

Joined Oct 2, 2009
30,802
If you are going from TTL to TTL both at the same voltage levels, then you don't need RS-232 or opto-isolation. Three wires will do.

TX to RX
RX to TX
GND to GND

If the voltage levels are different, you can add a 220Ω resistor in series with the signal lines and add a 3V zener across the RX signal to GND of the 3.3V circuit.
 

Thread Starter

trace

Joined Jan 10, 2013
9
Normally that is true but this device is a charger (with high voltage buck/boost circuits and such) and there is a risk of getting a destructive ground loop.
 

Thread Starter

trace

Joined Jan 10, 2013
9
Unfortunately no, there is no way to adjust the serial rate on the device. That would be handy because it might tell me if the PC817 is the problem. I suppose I could try smaller than 470 resistors on them to increase the switch rate (maybe).
 
Top