Power Supply PS3005D / KA3005D RS232 protocol - Page 1
Forum section: electronics / testgear

author: hexreader
author_rank: Frequent Contributor
timestamp: June 20, 2014, 11:35:54 pm
content: Can anyone help me out and shed some light on the RS232 protocol used on Velleman PS3005D PSU please.Seems to be the same unit as Korad KA3005D.I have seen this alreadyhttp://sigrok.org/wiki/Velleman_PS3005D/Info... but it seems to be related to the USB port, not the RS232 port, as far as I can guess.I have sniffed the RS232 port and have worked out a few sketchy bits of information.The following mikroElectronica C code seems to work well when writing.Code:// Operate Velleman PS3500D Power Supply// 9600,8,n,1 with cross-over cable RS232// for EasyPIC7 board with PIC18F45K22 fitted// 8MHz crystal x4 PLL gives 32MHz clock// turn on switches SW1-1 and SW2-1// amateur code - use at your own risk - author accepts no responsibility for anything// make up a cable DB9M to DB9M with the following three wires:// pin 2 Tx to pin 3 Rx// pin 3 Rx to pin 2 Tx// pin 5 gnd to pin 5 gnd// This program sends a 24 byte message to PS3500D power supply// PSU appears to send two 24 byte messages in reply// one message just a byte or two after the send message// a second message after 100mS// can only guess at what information the messages contain// cannot find any official information// prototypesvoid checksum_out(); // calculate checksum// power supply parametersunsigned int volts = 300; // x0.01 Volts e.g. 400 = 4 Voltsunsigned int milliamps = 110; // milliampsunsigned char txt_out; // transmit message is 24 bytes (0 to 23)unsigned char txt_in; // receive message is 24 bytes (0 to 23)void main() {char n; // general purpose counterUART1_Init(9600); // PS3005D power supply requires 9600,8,n,1while(1){Delay_ms(1000); // repeat control string every secondtxt_out = 0xaa; // headertxt_out = 0x20; // headertxt_out = volts/256; // voltage x 0.01 high bytetxt_out = volts&0xff; // voltage x 0.01 low bytetxt_out = milliamps / 256; // milliamps high bytetxt_out = milliamps & 0xff; // milliamps low bytetxt_out = 0x00; // ?txt_out = 0x00; // ?txt_out = 0x00; // ?txt_out = 0x00; // ?txt_out = 0x00; // ?txt_out = 0x00; // ?txt_out = 0x00; // ?txt_out = 0x00; // ?txt_out = 0x01; // 01 for ?, 00 for ?txt_out = 0x01; // 01 for output on, 00 for output offtxt_out = 0x01; // 01 for ?, 00 for ?txt_out = 0x00; // ?txt_out = 0x00; // 01 for OverCurrent Protection on, 00 for offtxt_out = 0x00; // ?txt_out = 0x00; // ?txt_out = 0x00; // ?txt_out = 0x00; // ?txt_out = 0xc2; // dummy checksum (ignored)checksum_out(); // calculate a real checksum for byte txt_outfor(n=0;n<24;n++){ // 24 bytes in totalUART1_Write(txt_out); // send each byte to UART}//while(!UART1_Data_Ready()); // wait until data is received//UART1_Read_Text(txt_in, "zz", 24); // reads 24 text bytes ("zz" will never be found)volts++; // just for funif(volts > 3000){volts = 3;}}}// calculate a checksumm by adding bytes 0 to 22// result goes to byte 23void checksum_out(){char n;unsigned char chksum;for(n=0;n<23;n++){chksum += txt_out;}txt_out = chksum;}You may, or may not want to follow my progress here:http://www.libstock.com/projects/view/1016/easypic7-control-velleman-ps3005d-power-supply-korad-ka3005d...but I would love to have a better understanding of the protocol.Is there anyone out there that knows any more than I do please?Many thanks,

author: biot
author_rank: Regular Contributor
timestamp: June 21, 2014, 02:20:00 pm
content: Hi,I'm one of the people behind the sigrok project, where you found the protocol description you linked to.What you found doesn't match that page's protocol in the slightest. It shows an ASCII-based protocol, but you found it to be 24-byte packet based. But this seemed familiar, and sure enough, here's the protocol:http://sigrok.org/wiki/Atten_PPS3000_Series#ProtocolAs it happens I wrote that page, and the sigrok driver that implements that protocol. It all works quite well.Now we need to figure out whether that PS3005D page is just wrong, or if Velleman has shipped completely different models with the same name. Both are possible :-(

author: hexreader
author_rank: Frequent Contributor
timestamp: June 21, 2014, 02:41:02 pm
content: @biotHow can I ever thank you enough? You are wonderful - this fits perfectly.I can progress with my project now.Thank you

author: hexreader
author_rank: Frequent Contributor
timestamp: June 21, 2014, 07:37:29 pm
content: Now for the next problem...There seems to be some cross-talk between transmit and receive.My suspicion is that the cross-talk happens within the PS3005D power supply itself, but I have not yet gained any evidence for such an assertion.When connected to PC, cross-talk (as seen on an oscilloscope) is minimal, and there are no obvious problems.When connected to EasyPIC7 development board, I receive three messages as replies, instead of one, confirmed by an oscilloscope.Loading the Tx line up with a 150 Ohm resistor reduces cross-talk enough to prevent the first erroneous message, but still leaves what looks like a repeat of the sent message, delayed 100mS, and then a good 24-byte return message 100mS after that.Not really expecting anyone to come up with a fix for this (but it would be nice if there was one). I will filter out the extra messages in software.I am just wondering if anyone else has had similar difficulties?

author: biot
author_rank: Regular Contributor
timestamp: June 30, 2014, 08:27:12 pm
content: I've had confirmation that the Velleman PS3005D page at sigrok.org really does work with the protocol at that page, by the guy who wrote it up. So it looks like Velleman has been shipping entirely different units under the same model name.I also found this post:https://www.eevblog.com/forum/testgear/need-advice-on-a-new-oscilloscope-1500-dollar-budget/msg380866/#msg380866You might reasonably assume Velleman changed suppliers from Korad to Atten.

author: hexreader
author_rank: Frequent Contributor
timestamp: June 30, 2014, 09:52:48 pm
content: thanks biotYou really are greatI am happy now.Thanks to you, I have succeeded in doing everything I want to in the way of communicating from PIC microcontroller.The PC software is truly terrible, but luckily that does not bother me.It is interesting the way that there are very different models with very different characteristics.

author: hermankopinga
author_rank: Newbie
timestamp: March 03, 2015, 01:10:16 am
content: Thank you for the information in this thread! I'll add to it for other Googlers finding this.Although I let myself be misdirected by the information onhttp://sigrok.org/wiki/Velleman_PS3005D(and I'm stubborn) so it took me hours instead of minutes to get going. This you got me in the right direction and now everything seems to run like it should with pps-tools via USB on a Raspberry PI.Things to note about the/mynew? revisionof the PS3005D from Velleman:It shares the lsusb -v identification with the previous model (still based on the same Winbond chip). This made me more stubborn than I needed to be.Connecting with serial (9600,8,n,1) and sending it some text does make it beep (if interface is not set to silent) and lock the front interface but doesn't respond with any serial data. It unlocks after a couple of seconds.This is the best way I can think of now to identify this model.It works beautifully with thehttps://github.com/mturquette/pps-toolsfrom the Atten page on Sigrok:http://sigrok.org/wiki/Atten_PPS3000_Series#ProtocolOn the software-cd I got with the devide there is a filePS Series Communication Protocol 1.3.pdfthat describes the older protocol, not the one for my device.I bought it in a brick and mortar store Okaphonewww.okaphone.nlin the Netherlands about 2 years ago.My device has serial number 008150006780, this curiously is lower than de photographed device onhttp://sigrok.org/wiki/Velleman_PS3005DQuote from: biot on June 21, 2014, 02:20:00 pmThank you for that page. I think it would help if you add a remark to the page that it also supports newer versions of the Velleman PS3005D (1 channel, 0-30V, 0-5A). And perhaps a note on the page for the PS3005D? I was on my way to add it myself but I'm not that comfortable with IRC.Quote from: biot on June 21, 2014, 02:20:00 pmGiven the information in this thread and my experience: 2 different models with the same name.Thanks!

author: nuno
author_rank: Frequent Contributor
timestamp: March 03, 2015, 02:37:35 am
content: There's at least another related thread:https://www.eevblog.com/forum/testgear/korad-ka3005p-io-commands/

author: biot
author_rank: Regular Contributor
timestamp: March 03, 2015, 11:31:10 am
content: Quote from: hermankopinga on March 03, 2015, 01:10:16 amSo done. Life is like a box of Velleman: you never know what you're gonna get.

author: dsandber
author_rank: Newbie
timestamp: April 29, 2021, 08:39:53 pm
content: Just wanted to post something to help the next person --- if you're trying to control a LABPS3005DN over the serial/USB port (perhaps with pyserial or some-such), and you look at the manual and it says to send a command like:STATUS?\nthe "\n" is not a new line. That would make sense. No, it is a backslash followed by an n because the developers of this protocol are sadists, or more charitably, idiots.You're welcome