Author Topic: Small computer-controlled square wave generator?  (Read 1766 times)

0 Members and 3 Guests are viewing this topic.

Offline Per WestermarkTopic starter

  • Contributor
  • Posts: 11
  • Country: se
Small computer-controlled square wave generator?
« on: October 07, 2023, 12:23:35 pm »
Any programmable square wave module with programmable voltage?

Looking for something small and practical to generate test pulses.

- Frequency range 1 Hz to 100 kHz. Doesn't hurt if it can go lower than 1 Hz.
- Square wave configured lower/upper voltage within 0-10V but preferably 0-20V
- Controllable using RS-232, USB or maybe Ethernet
- No need for sine wave, triangle wave etc. Square wave is enough. Programmable high/low ratio a bonus but not needed.
- Preferably panel-mounted module

Intended for an automatic test setup. I'm currently using a general signal generator but that is a bit too clumsy. Best is if I can panel-mount in a 19" chassis.

Preferably if it could have similar footprint as these voltage modules:

https://www.amazon.se/-/en/DollaTek-Bluetooth-Communication-Constant-Converter/dp/B07PLFZ3H2/
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3903
  • Country: nl
Re: Small computer-controlled square wave generator?
« Reply #1 on: October 07, 2023, 01:49:00 pm »
This seems like an easy task for any microcontroller with a PWM output. It is of course just a uC pin output, so you have to beef up the output to whatever signal levels you want, and there is a tradeoff between PWM speed, resolution and cost. The most time consuming part will be to design a communication protocol between the PC and implement it in software and firmware.

 

Offline kripton2035

  • Super Contributor
  • ***
  • Posts: 2687
  • Country: fr
    • kripton2035 schematics repository
Re: Small computer-controlled square wave generator?
« Reply #2 on: October 07, 2023, 02:13:23 pm »
 

Offline Per WestermarkTopic starter

  • Contributor
  • Posts: 11
  • Country: se
Re: Small computer-controlled square wave generator?
« Reply #3 on: October 08, 2023, 05:04:24 am »
Creating square wave is the trivial part. But I have almost zero time and it's a commercial project so money isn't an issue.

If I build myself then I would, beside square wave, also need to
- design an output stage that takes logic-level in and delivers programmable low and high levels in 0-20V range.
- implement SCPI to control on/off, frequency and voltages

So I can buy several full-size signal generators for the corresponding cost of building one myself.
 

Offline Per WestermarkTopic starter

  • Contributor
  • Posts: 11
  • Country: se
Re: Small computer-controlled square wave generator?
« Reply #4 on: October 08, 2023, 01:30:07 pm »
Note that I want to be able to programmatically control the output voltage (low and high level) too within 0-10V or preferably within 0-20V.

The goal is a simulate a square-wave signal with configurable amplitude and configurable offset.

So it wouldn't be enough to just supply 20V and a transistor to get that module to deliver.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1935
  • Country: au
Re: Small computer-controlled square wave generator?
« Reply #5 on: October 08, 2023, 08:19:37 pm »
Creating square wave is the trivial part. But I have almost zero time and it's a commercial project so money isn't an issue.

If I build myself then I would, beside square wave, also need to
- design an output stage that takes logic-level in and delivers programmable low and high levels in 0-20V range.
- implement SCPI to control on/off, frequency and voltages

So I can buy several full-size signal generators for the corresponding cost of building one myself.
?
Then why ask in projects & designs , if you want commercial test equipment?
You may find waveform generators easier to source, where you load the dac pattern with your hi and low levels, then set the playback speed.
You get sine and triangle for free  8)

Addit : A quick scan of aliexpress, finds items like this
JUNCTEK JDS8060 8080 Dual Channel Function Arbitrary Waveform Signal Generator Source 275MSa/s 14bits Frequency Meter 60M 80MHz

https://www.aliexpress.com/item/1005005956668675.html
that looks to manage +/-12.5V range, USB and rs232.TTL connections.

You could add an external amplifier, if the 20V is important  ?  example : https://www.aliexpress.us/item/3256803968826290.html
« Last Edit: October 08, 2023, 09:15:49 pm by PCB.Wiz »
 

Offline Per WestermarkTopic starter

  • Contributor
  • Posts: 11
  • Country: se
Re: Small computer-controlled square wave generator?
« Reply #6 on: October 09, 2023, 09:21:44 am »
I already have access to signal generators. That works for me at my desk. But I need to create a number of test systems and then it isn't practical to have a large set of full-size instruments - which I did mention in my original post.

What I'm asking about is if anyone knows about a square wave generator *module* according to the requirements I specified.

Ï selected this subforum because this *is* a project - fitting multiple *modules* into a 19" rack box. So this is more like "anyone seen an OP-Amp with xx specification" than it is asking about "What oscilloscope would you recommend for ..."
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3903
  • Country: nl
Re: Small computer-controlled square wave generator?
« Reply #7 on: October 09, 2023, 12:45:33 pm »
It was also not clear to me from your first post that you wanted to buy some ready made product and assumed you wanted to build a project.

Your signal output requirements are quite modest, but SCPI (or at least programmability) is going to reduce your options quickly. I bought a JDS6600 (Similar to other chinese function generators, but max 15MHz and EUR80 or so) and it has programmability though USB, but not SCPI. These function generators are also mostly empty boxes. The whole function generator itself is a quite thin PCB (With an FPGA), and there is another PCB in the front panel. (With an STM32 clone, I think it's an GD variant, but that may vary)
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3903
  • Country: nl
Re: Small computer-controlled square wave generator?
« Reply #8 on: October 09, 2023, 01:25:14 pm »
I just did a simple search for "signal generator" on kickstarter and found the link below. It's apparently an open source project so that makes it easier to add things like SCPI.

https://www.kickstarter.com/projects/nickjohnson/tsunami?ref=discovery&term=scpi

And on similar crowd funding websites you can probably find other such projects.
« Last Edit: October 09, 2023, 01:39:12 pm by Doctorandus_P »
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1935
  • Country: au
Re: Small computer-controlled square wave generator?
« Reply #9 on: October 09, 2023, 09:31:54 pm »
Ï selected this subforum because this *is* a project - fitting multiple *modules* into a 19" rack box.

Yet your original post missed that vital multiple *modules*  part, you merely said    Best is if I can panel-mount in a 19" chassis.

Simplest may be to find an Aliexpress DDS module that can waveform generate (RAM table), and make a rack motherboard for N of those, with buffer amplifier if needed.

eg https://www.aliexpress.us/item/3256802987667363.html can piggyback

 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1935
  • Country: au
Re: Small computer-controlled square wave generator?
« Reply #10 on: October 09, 2023, 11:01:40 pm »
Any programmable square wave module with programmable voltage?

Looking for something small and practical to generate test pulses.

- Frequency range 1 Hz to 100 kHz. Doesn't hurt if it can go lower than 1 Hz.
- Square wave configured lower/upper voltage within 0-10V but preferably 0-20V
- Controllable using RS-232, USB or maybe Ethernet
- No need for sine wave, triangle wave etc. Square wave is enough. Programmable high/low ratio a bonus but not needed.
A full DDS may be over-kill, but would be very flexible !   8)

What Frequency resolution and stability do you need ?
A MCU with Dual DAC and a PWM output, could analog MUX between the two DAC levels to give you the variable VOL VOH
Parts like EFM8BB3 and EFM8LB1 have 4 x 12b DAC and 50/72MHz sysclks,

If you are ok with PWM-DAC, modules like RP2040-Zero might do ?
 

Offline aeg

  • Regular Contributor
  • *
  • Posts: 112
  • Country: us
Re: Small computer-controlled square wave generator?
« Reply #11 on: October 10, 2023, 10:15:23 am »
How many do you need and what is your target price?
 

Online coromonadalix

  • Super Contributor
  • ***
  • Posts: 6743
  • Country: ca
Re: Small computer-controlled square wave generator?
« Reply #12 on: October 10, 2023, 10:31:41 am »
A simple Juntek like the JDS-2900 series, is easily controlled by its usb --- rs232 port 

We have done at my job a simple gui who read an crafted csv sheet to navigate on 80 possible / selected frequencies and set the output voltage .... to help calibrate a filter

And we will automate our test rig in the future, this gui was a fast solution ...


no need to overthink a project ???

yes tons of projects too based on small dds modules on Ebay can be used,     if the OP is not lazy, all the answers can be found on the web,   time lost is money, just buy an already made generator and have fun


AND juntek have  panel mount  generators  in the JDS-2800 series, they are worth to be checked

and finally   all the protocols are given to control them ....
« Last Edit: October 10, 2023, 11:25:06 am by coromonadalix »
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1935
  • Country: au
Re: Small computer-controlled square wave generator?
« Reply #13 on: October 10, 2023, 11:15:41 pm »
Checking into eval modules that might be used, I found some DACS have a toggle setting option, that allow alternate between two DAC values under HW control.
eg EFM8BB3 / EFM8LB1 and EFM8BB52 do that.
Note however, that many small MCUs like this, lack crystals on the eval boards, so the precision is lower.

The RP2040 PiPIC0 also looks well suited here. I'm not sure how much register-access python gives, but code looks simple.

There are many low cost RP2040 module choices, and it has 125MHz PCLK, so can go as low as 125M/65535/(255+15/16) = 7.45Hz, and 100kHz is ~0.1% steps
RP2040  has 8 PWM pairs, so you can do 8 channels of PWM-DAC for HI/LO setpoints, using 4 pairs and have independent  any-kHz outputs on 4 remaining channels.

Depending on how important below 7.45Hz is, you could nudge down the PCLK to get to 1Hz, or you could add a D-FF between two outputs and generate a 50% duty, low frequency-difference, that can go as low as 114 microHz  (2.44 hours)

A simple daughter card would have opamps for LPF and DAC -> 20V swing amplify, and the optional FF for sub-1Hz

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf