My software to control Chinese DDS Function Generator - Page 1
Forum section: electronics / testgear

author: Kintekobo
author_rank: Regular Contributor
timestamp: August 02, 2015, 08:41:17 pm
content: Firstly, my apologies if I have posted in the wrong place, and also if I am duplicating work done by others. I did search the blog and while there is a huge amount of postings regarding these cheap Chinese function generators I couldn't find the same as I am about to post.Having just purchased a remarkably cheap DDS Function Generator from China my expectations were not high, but I was completely taken by surprise by what arrived. It is an excellent piece of kit far exceeding my expectations and produces nice stable waveforms. As is to be expected the interface is diabolical and it took quite some time to get the hang of it so I thought I would give the PC control software a try. Eeeek! What can I say about this software. Probably best to draw a discreet veil over it. This is not to denigrate the Chinese programmer who wrote it. I doubt I would have done better if I had to write a program using a Chinese IDE and programming language.So I figured no point in sitting cursing the dark when I can light a candle, so I sat down and reverse engineered the command structure and wrote my own program. On the off-chance that this may be useful to others, and for constructive criticism I thought that I would make it available for anyone who has a similar device. I have attached a .ZIP file containing the application install file, which is a DotNet program and will need to install the Framework 4.5 if you don't already have it. You may already have the driver software for the Frequency Generator, but if not I have also included that in the ZIP file. I have virus checked everything but I would recommend you do likewise.I have attached a picture of the DDS Function Generator that I bought and that the software works with so you can see if you have a similar device. It may work with others but I have no way of testing. This is version V0.01 having just knocked it up today so it doesn't have the sweep generator code yet, that's a job for tomorrow.It should be self explanatory in operation. Just select the com port and connect. Then make any changes in the settings for frequency or amplitude etc and press the Set button to transfer the changes to the machine. You can set the two channels independently. See the screen capture attached.I would welcome any feedback as to problems installing or running.All the best, ChrisP.S. Sorry about the picture of the DDS. For some reason my iPhone decided that upside down was the new right way up.

author: pascal_sweden
author_rank: Super Contributor
timestamp: August 02, 2015, 08:53:36 pm
content: It looks like you have the MHS-5225A. This unit has been compared with the FeelTech FY2224S:https://www.eevblog.com/forum/testgear/feeltech-fy3224s-24mhz-2-channel-dds-aw-function-signal-generator/msg697718/#msg697718The FeelTech FY2224S is slightly more expensive, but has a higher resolution.MHS-5225A:Do you have the 25 MHz version? How much did you pay for it?The MHS-5225A goes for only 73 EUR on Ebay:http://www.benl.ebay.be/itm/6-25MHZ-Dual-Channel-DDS-Function-Signal-Source-Generator-NC-Arbitrary-Waveform-/381327872060?var=&hash=item58c8e9903cFeelTech FY2224S:The FeelTech FY2224S goes for 100 EUR on Ebay:http://www.benl.ebay.be/itm/24MHz-Dual-channel-Arbitrary-Waveform-DDS-Function-Signal-Generator-FY3224S-/281537687541?pt=LH_DefaultDomain_3&hash=item418cf42ff5

author: Kintekobo
author_rank: Regular Contributor
timestamp: August 02, 2015, 09:10:13 pm
content: Possibly Pascal, but mine does not have as many buttons such as SYS and SWEEP etc. The display looks similar though so it could perhaps use the same command structure. Perhaps somebody will test and let me know.I paid £59 for mine which isn't very much for what I actually got. The waveforms are rock solid and have come in with pretty good accuracy when checked against my Agilent scope and HP DVM, both of which have been recently calibrated.

author: Eartoot
author_rank: Contributor
timestamp: August 02, 2015, 11:02:03 pm
content: I just picked one of these up as well.Thread linked below has info about reverse engineering the serial protocol, links to code to handle arbitary waveforms and a really well done english manual.https://www.eevblog.com/forum/testgear/mhs-5200a-serial-protocol-reverse-engineered/

author: wd5gnr
author_rank: Regular Contributor
timestamp: August 03, 2015, 02:29:46 am
content: Yeah the software I posted earlier ought to run in Windows using Cygwin (or maybe even some other environments that provide bash/awk/etc.). The waveform editor is Windows but I run it under Linux/Wine. So you ought to be able to adapt it to Windows. I ought to be able to run yours under mono but I won't be able to try that for a while.You might look at the manual and see if you reversed any of the protocol that I missed (see the notes on what I missed in the document).

author: Kintekobo
author_rank: Regular Contributor
timestamp: August 03, 2015, 08:35:37 am
content: Quote from: Eartoot on August 02, 2015, 11:02:03 pmDamn! I wish I had found this post before I started writing my code. It would have saved a lot of time decoding the protocols.An excellent piece of work on the manual. I really wish I had found this blog before I started trying to work out how to set it up.One thing I noticed was that you hadn't worked out how to set the sweep time, and that is probably because you have the same manufacturers software as I do where there is a bug in that it doesn't actually set the time when changed. However i made a guess that it would be 't' and that the command number 5 was unused and this turned out to be correct, so the sweep time command is -:s5tnnPerhaps you can add this to the manual?

author: Kintekobo
author_rank: Regular Contributor
timestamp: August 03, 2015, 11:04:03 am
content: Right, I have added the sweep generator code which seems to work ok. I would appreciate any feedback as to functionality and/or bugs. I will publish the source code once I have added a few salient comments.To use, set the signal parameters on the first tab page, no need to set frequencies though. In the second tab page you set the start/stop frequencies and sweep time and type etc. Then press the start sweep and away it goes. (Hopefully)

author: Kintekobo
author_rank: Regular Contributor
timestamp: August 03, 2015, 11:15:41 am
content: And here's the project source code if anyone would like it. It is a Visual Studio 2013 project but it doesn't use anything too esoteric so it should convert to Mono pretty easily.

author: Kintekobo
author_rank: Regular Contributor
timestamp: August 03, 2015, 12:40:53 pm
content: Having just worked out that "Trace" actually means "Track" and when enabled links the sweep outputs so that 2 tracks 1 I have added that to the program.There seems to be a strange problem with tracking in that it will work ok stoping and starting but sometimes it seems to "run past the end stop" and it will not sweep properly after that but just keeps going up and up. Need to power cycle to fix this. Has anyone else seen this?Anyway, here is the version with tracking added if anyone is interested.

author: Kintekobo
author_rank: Regular Contributor
timestamp: August 03, 2015, 05:57:55 pm
content: Added the ability to transfer waveforms to Arbitrary store. Currently only accepts .CSV files (example of sine wave in zip file for testing )Works for me but of course your mileage may vary.

author: pascal_sweden
author_rank: Super Contributor
timestamp: August 03, 2015, 06:08:38 pm
content: Good job!When will you implement the same for the FeelTech series? =)

author: Kintekobo
author_rank: Regular Contributor
timestamp: August 03, 2015, 06:30:13 pm
content: I don't have one to test with so it's a bit difficult. I'm putting the source code up so if anyone has a different type of FG they can mess with it. If the command structure isn't too different and someone sends me it I could have a quick look to see what would be involved.

author: Kintekobo
author_rank: Regular Contributor
timestamp: August 04, 2015, 05:20:27 pm
content: OK, this is probably the final version for now as it does everything that I need it to do. No more functionality added but more in-depth verification of the input CSV file to ensure it is correctly formatted.I have been having great fun creating exciter waveforms using Excel of generate the data which can be exported as a CSV file. I have attached some screen captures of these waveforms which were a Tangent, a Random noise tangent and a random noise sine wave. The CSV files are inside the .ZIP if anyone is interested in them.Also not wishing to teach granny to suck eggs so to speak, but when you upload to an arbitrary store if you are on the the store number when you upload you need to switch away and back again for the new waveform to be output. Caught me out to begin with and was the cause of much swearing until I figured out why my uploads weren't workingCheers,Chris

author: pascal_sweden
author_rank: Super Contributor
timestamp: August 04, 2015, 10:13:04 pm
content: Nice screenshots made with your Keysight MSO-X 3012A scopeCool to see that there is a perfect marriage possible between a sub 100 USD signal generator and a plus 4500 USD scope

author: Kintekobo
author_rank: Regular Contributor
timestamp: August 05, 2015, 05:21:41 am
content: Don't forget the iMac that Benchview is running on

author: Kintekobo
author_rank: Regular Contributor
timestamp: August 05, 2015, 06:40:16 pm
content: I need a spot of help here and I'm hoping there's a Mac guru here who can point me in the right direction.I have ported my function generator to Mono and it seems to run OK. Problem is that the DDS Function Generator, although it is recognised as a serial device by the Mac ( see screen capture ) there doesn't seem to be a tty entry in the /dev folder, so I can't send to it. Bummer!I have attached the Mono version of the program in case anyone can help. It should also run under Linux. You need to have Mono installed of course, and it used the DotNet Framework 4.5 but I think that gets installed with the MDK. To run the program just type mono FunctionGen.exe from the command line and it should start up ok.Any feedback would be helpful.

author: wd5gnr
author_rank: Regular Contributor
timestamp: August 09, 2015, 04:38:41 pm
content: Quote from: Kintekobo on August 03, 2015, 08:35:37 amIs that right? Or is it :s5Nt where N is the number? That's the format of the other commands. I assume it replies with OK?I will update my source document. It will up to the manual translator to pick up the change, of course.

author: Kintekobo
author_rank: Regular Contributor
timestamp: August 09, 2015, 04:52:31 pm
content: Yep, just tested with Hyperterm and sending -:s5t10resulted in -okand the sweep time changed to 10 seconds on the display on the signal generator.I also noticed that you have to use only lowercase letters on my unit as it doesn't seem to accept upper case.

author: chris77
author_rank: Newbie
timestamp: May 26, 2016, 07:35:55 pm
content: To get you guys updated. I just bought such a device MHS-5225-A too. It looks like the one on the first pic of pascal_sweden.It comes with a really good software for a device in that price-range and it is much better than the self-made one presented here.

author: r07
author_rank: Newbie
timestamp: December 18, 2016, 03:07:34 am
content: Hi there,i downloaded your software and installed it. that part works just fine. however, when clicking the Connect button an unhandled exception is generated if the drop box doesn't have anything selected. on my PC, the only option I get is COM1. the PC does show a COM1 in device manager, but when this is selected, clicking Connect causes the application to freeze. I have to use task manager to close it. I can see by the files and folders that you used visual studio. what am I missing?thanks!

author: hussamaldean
author_rank: Unknown
timestamp: March 03, 2018, 06:24:14 am
content: Hi,I recently bought this function generator and I downloaded your software and it does workthanks

author: kevinateev
author_rank: Regular Contributor
timestamp: November 13, 2018, 03:39:37 pm
content: Dear Kintekobo :Could you post the code that has the waveform upload in it??That would be much appreciated. It would be a great reference to what is known to work.k.

author: JulIkk
author_rank: Newbie
timestamp: June 04, 2021, 07:55:32 am
content: Hello !Thank you for your soft, it is great. However, with my windows 10, I don't detect any COM. With the windows XP it works. I'm sure it is just a setting on my compure but I can't find it. ANy one could help me ?