Hantek PPS2320a PSU adding native RS232 port - Page 1
Forum section: electronics / testgear

author: picitup
author_rank: Regular Contributor
timestamp: October 29, 2015, 05:52:14 pm
content: Hi AllFlush with success after adding an RS232 port to my recently acquired Tonhgui TH1942, I thought I'd have a poke at my PPS2320a PSU. The unit has 3 independent channels, 2x variable 0-30v @3A and 1x fixed 2.5/3.3/5v. The 2 variable supplies can be placed in parallel for 0-30 @6A, series for 0-30v @3A and tracked where both outputs match each other.More interestingly, it's got a USB/Serial port and you can control all features from a PC. I'm a bit new to this and I was hoping it would use the SCPI protocol but not so lucky. I think the commands were sketched out on a cigarette packet in the pub on a Friday night but at least it works.To start with I thought I would play with it via the USB/serial interface. I plugged it in and it auto-installed as "Silicon Labs CP210x on COM2". using TeraTerm, I sent a few commands which seemed to work fine:suXXXX sets the output voltage for CH1 eg su1200 sets it to 12vsiXXXX sets the output voltage for CH2and so on. I've attached a PDF of the protocol document for your amusement. It only works with lower case characters but some of the examples in the document show upper case. lol.Any road up, I had a play with the commands and all seemed fine so a good start.I took a look inside and latched onto the small square hole in the case (see pic) and thought that would be the RS232 port hole but not so lucky. It's too small and I'm pretty sure it's the hole for the 110v/220v switch.And now for a warning. The metal strip on the back of the power socket is connected to the fuse, so yes it's LIVE. Make sure you unplug the mains cable before working on this piece of art.The photos PPS2320aUSB-Serial_1, 2,3 show different views of the CP2102 USB/serial board which is mounted on the rear of the unit.PPS2320aUSBConnector shows where the USB/serial board plugs into the PCB behind the display. J10 on the top left is the socket for the USB/Serial board and there's a spare connector J1 (RS232?) just below it.U7 is pretty close and is a C8051F410 chip. This is as you may have guessed an 8051 chip with a bunch of extra bits, including a UART. I've attached the data sheet for anyone that's interested.So how does it look so far? Promising, but I didn't want to cut a DB9 hole in the case as I'd have to strip it all down as I wouldn't want to get any swarf inside the supply.When I get some more time, I'll post up any (lack of) progress.

author: picitup
author_rank: Regular Contributor
timestamp: October 29, 2015, 06:00:02 pm
content: Here's the photo of the USB/serial connector and surrounding PCB:

author: picitup
author_rank: Regular Contributor
timestamp: October 30, 2015, 02:12:20 pm
content: A little more progress on this today. I buzzed out J1 and J10 (see PPS2320a_RS232PCB and PPS2320a_Wiring) and it looks to me like J1 is not an RS232 connector, but a debug/programming header for the C8051F410 chip as it connects to the reset line, C2D pin (debug) and C2CK (debug clock).However J10 is the serial connector - obviously as it connects to the CP2102 USB/Serial chip. If you look at PPS2320a_Wiring you can see it directly connects to the C8051F410 on pin 22(RX) and 21 (TX) so I should easily be able to connect a MAX3232 board to this and run it over RS232.The other up side is that now I've taken the top and bottom covers off the PSU, I see that the rear plate is only as big as the rear of the supply and can quite easily be removed. The only items mounted on it are the fan, power socket and the USB/Serial pcb so I could completely remove the rear plate to hack a DB9 hole in it.I guess I could fit a c/o switch quite easily to switch between USB/RS232 although, there's not a lot of spare area on the rear plate.I've attached a better data sheet for the C8051F410 as the other sheet was a little confusing as it had die pin numbers and external pad numbers.The C8051F410 comprehensive data sheet is here:https://www.silabs.com/Support%20Documents/TechnicalDocs/C8051F41x.pdfTime for thinks....

author: Kleinstein
author_rank: Super Contributor
timestamp: October 30, 2015, 06:11:08 pm
content: It looks like the Isolation is done at the UART level - which is a good low cost idea. However there seems to be a rather small creap distance under the optocoupler at the USRT to USB board. So be carefull with a large comon mode voltage at the supply.With the Optocoupler between the µC and USB, adding a standard RS232 is not that simple: directly a max232 or similar would give a connetcion from the outputs to the RS232 ground. If optocouplers are used, one usually needs an extra isolated supply. The only simple way would be a non standard RS232 connection driven from the RS232 handshake lines This works with most PCs and programms, though not strictly by the standard (e.g. usually no negative supply).

author: picitup
author_rank: Regular Contributor
timestamp: October 31, 2015, 10:49:03 am
content: Hi KleinsteinThanks for your reply. Clearly you're thinking a little ahead of me and I hadn't considered the isolation yet. I think i see what you mean by the creep distance - is it because they've fitted components on the reverse side of the opto isolators? Not very clever.I checked my USB/RS232 cable and it does have both DTR and RTS handshake lines where I could leech the power for the max3232 although I've come across other cheap adaptors which don't have any handshaking lines so I'm a little unsure about using that method.I could just use the 5v supply to the USB/Serial board, but it would be a shame to break the isolation, such as it is. A battery is a possibility but that would be a drag, having to charge it.I did see a 5v-5v DC-DC convertor which would add that missing isolated power supply. It's a 1W device, so 200mA should be plenty for a MAX3232 and it has 1KV isolation. The part is sold by RS Components and is here:http://uk.rs-online.com/web/p/isolated-dc-dc-converters/5442651/Food for thought....Steve

author: ErikTheNorwegian
author_rank: Frequent Contributor
timestamp: October 31, 2015, 11:40:19 am
content: Hi Steve,very intresting thing you work with! I got i PPS2320a in the post and its from the US, and i wounder if you could taake a photo og the toroid transformers label and show it here? The one i have orderd has the same label over the power selection switch, and it would be great to know if its a 110-0-110 Volt transformer in it, that i can rewire to 220 V on the primary side.. saves me from a step down trafo..I talked with he Circuit Specialists support, but even after sevral mails, they did no take the efort to check if it ws posibel to rewire it to 220Volts.. I think they dont even got a scematic for it.regardsErik

author: picitup
author_rank: Regular Contributor
timestamp: November 03, 2015, 03:43:44 pm
content: Hi Erik I see you found my other pps2320a post :-)I managed to blag a bit of time today. The Murata NME0505SC 5v DC-DC converters have arrived but I've not had a chance to check them yet but thought I would trace out the USB/RS232 daughter PCB. There are not great surprises so the circuit is below.When I can get a little more time I'll fit the DC-DC convertor and a MAX3232 and see if it works before hacking a hole in the back of my PSU.CheersSteve

author: picitup
author_rank: Regular Contributor
timestamp: November 05, 2015, 05:54:46 pm
content: A bit more progress on this. I wired up the 5v DC-DC converter, powered it from the PSU PCB side +5v and connected the output across the USB 5v rails. I tested the DC-DC converter and it output 6.8 volts which was a bit worrying. I checked the data sheet and the minimum load is 10% otherwise the output can go high. So for this 200mA device, you need to draw 20mA. When connected, the output dropped to 5.3v so I'm happy with that.Then I got a MAX3232 based converter and wired the TX to the CP2102 TX and the RX to the CP2102 RX.It didn't work lol. A quick check with the scope showed the problem. I had hoped that the CP2102 would go into standby mode as there was no USB signals, but not so lucky. A quick check with the scope on the TX of the MAX3232 board showed the problem. The CP2102 was dragging the TX of the MAX3232 output down to 1.8v pp (see RS232CompeteWith2102).I did a bit more tracing on the PCB in the hope that I could remove power from the CP2102 and hopefully its output would go high impedance. Due to the track layout, this seemed quite tricky so I went for the easy option and removed R2 (see diagram in previous post). I then hung a 1K resistor from the opto isolator diode connection and connected that to the MAX3232 and voila it worked! (The scope trace is in RS232_OK)As the MAX3232 RX is an input, this caused no conflict with the CP2102, just the pesky TX.I tried a few commands as follows:a 3203su1200 set ch1 to 12vsi0600 set ch1 to 600mAo1 turn output onAll worked well but why couldn't they make it SCPI?I think the final solution will be to power the boards (CP2102 and MAX3232) from the DC-DC converter, cut the +5v track on the USB port so USB and DC-DC converter won't compete then connect a 5v relay to the USB +5v which will change over TX lines from the CP2102 and the MAX3232.So when you plug in a USB cable, the relay will switch and connect the CP2102 TX to the opto isolator and when you unplug the USB cable, it will change back to RS232 TX.As luck would have it, I bought a tiny 5v dpco relay when I was messing around with my Tonghui meter, but never needed it. Took me 10 mins to find it though. I'd put it in my switches drawer.I'll draw out the full diagram and post it up soon.Thanks for reading this far!Steve

author: picitup
author_rank: Regular Contributor
timestamp: November 09, 2015, 06:59:00 pm
content: Almost there. I wish I had more spare time....I removed the back plate from the PSU today. The fan came off easily with 4 self tapping screws but I had to desolder the mains wires. The existing soldering wasn't brilliant. While the joints were good, they were only tack joints. I would have fed the wires through the tags, making a strong mechanical connection before soldering. I'll do this when I put it back together.There's not loads of space to fit a DB9 connector. I did fleetingly consider using the hole for the mains voltage selector switch, but didn't want RS232 next to mains wires in case of smoke so just under the USB socket looks good. I've attached a picture of the back with the rough position of the DB9 connector (PPS2320aBackPlate).I found a template for DB9 on the internet and have attached a piccy (DB9Dimensions) in case you find it useful. Also attached is a Word '97 (DB9CutoutTemplate) document from OpenOffice which prints it out the right size so I'll use this to mark the DB9 connector out. It's not exact, but when your wielding a rat tail file a mm or so is of no consequence.For the level conversion, I had a nice little MAX3232 PCB with LEDs but this was to big to fit in the small space, so I bought 5 MAX3232 converters (RS232PCBsBottom, RS232PCBsTop) from fleabay in China for £1.41 including postage. Bargain.That's all for now, but I intend to finish this off tomorrow so I'll post up the diagram and any notes then.CheersSteve

author: picitup
author_rank: Regular Contributor
timestamp: November 15, 2015, 12:33:33 pm
content: OK the final run and it's all working. I was going to fit a relay to switch over the competing TX lines from the MAX3232 and the CP2102 but I've managed to lose the relay so that's a job for another day. Good job my head's not loose.The only thing that threw me for some time was that sometimes the RS232 worked and sometimes it didn't. I tried to trace it with the scope and all voltages seemed OK, but there was no output on the far side of the opto isolator. Eventually, I connected the DB9 pin 1 (ground) the the PSU chassis (mains earth) and it worked fine. Weird. Must have been an earth loop or something.I've attached a diagram below and some piccies of the insides and the RS232 connector. There's also a piccie of the output in Teraterm too. Due to the lack of available space, I strapped the MAX232 PCB to the cable loom.Thanks for reading...Steve