64-channel Arduino shield for generating and controlling 40kHz square-waves

I am currently working on a project where I need to be able to generate and phase shift 64, 40kHz square waves individually. It would also be nice to be able to adjust the amplitude of the signal, but not a must.

I have heard a rumor of a controller shield for Arduino Mega that allows for this with a single Arduino, but I have searched far and wide and cannot find any such thing. Also, because I need the phase differences of the signals to be fairly accurate, I think it would be easier to do this with a single Arduino (so I don't have to try to sync clocks between multiple Arduinos).

So I was just wondering if anyone here has heard of such a controller shield or could maybe suggest a different setup that would help accomplish this?

I know that this isn't a super specific question but I'm desperate for help.

Thanks!

I am currently working on a project where I need to be able to generate and phase shift 64, 40kHz square waves individually. It would also be nice to be able to adjust the amplitude of the signal, but not a must.

I have heard a rumor of a controller shield for Arduino Mega that allows for this with a single Arduino, but I have searched far and wide and cannot find any such thing. Also, because I need the phase differences of the signals to be fairly accurate, I think it would be easier to do this with a single Arduino (so I don't have to try to sync clocks between multiple Arduinos).

So I was just wondering if anyone here has heard of such a controller shield or could maybe suggest a different setup that would help accomplish this?

I know that this isn't a super specific question but I'm desperate for help.

Thanks!

Don't cross-post >:( 64-channel Arduino shield for generating and controlling 40kHz square-waves - #2 by mprisim - LEDs and Multiplexing - Arduino Forum

There exist port expander shields, but I would be surprised if there is one with that many I/O pins. Without having worked through timing, being able to update that rapidly without skewing pulses seems like a problem. This project sounds like a candidate for an FPGA solution.

40 kHz and a lot of phased outputs suggests an ultrasonic phased array. I'm intrigued if this is your project.

Threads merged.

MrMark:
There exist port expander shields, but I would be surprised if there is one with that many I/O pins. Without having worked through timing, being able to update that rapidly without skewing pulses seems like a problem. This project sounds like a candidate for an FPGA solution.

40 kHz and a lot of phased outputs suggests an ultrasonic phased array. I'm intrigued if this is your project.

That's what I'm experiencing, I have seen many expander shields. I have seen however none, like you mentioned, with that many i/o pins.

I am working on an ultrasonic phased array, something similar to this paper
[Holographic acoustic elements for manipulation of levitated objects | Nature Communications].

It's not the same, but similar hardware would be needed. I emailed the author about it and he mentioned that they used an Arduino Mega shield that allows for generation, phase modulation, and amplitude adjustment of 64 signals. I just can't seem to find it.

This may be a good candidate for FPGA indeed, thanks for the suggestion!

Also, sorry for the cross-posting everyone, I'm new, didn't realize that was frowned upon. I won't do it anymore.

Thanks

It's could be done with DUE board. You also would need fast DAC with conversion rate 10 MSPS or so (internal arduino DUE has 1.6 MSPS at the best) and sample and hold circuitry for 64 channels (4 HC4067 with small caps perhaps). So arduino on timer interrupt base ~100 kHz goes into subroutine where it's setting multiplexers to channel number 0 ( direct port manipulation, of course, digitalWrite is too slow) than read sine wave array with phase offset specific for channel 0, sets data on port registers for DAC (8-bits probably enough, parallel), click conversion, wait 100 nsec or so to get S&H settled and than move for next channel 1.
Having 64 channels it would require 6.4 MBytes data rate. Each channel has to be served in less than 150 nanoseconds.
Buffer amplifiers /drivers for piezo is different story

Their is a chip, the PCA9685 that will generate 16 PWM signals with 12 bit resolution. That will only require 4 chips for your 64 outputs. They are controlled by I2C and have 6 external address lines, that means you could have up to 64 of these chips on the same buss so 4 is no problem.

Look to see if anyone has a shield with 4 chips, otherwise solder 4 breakout boards onto a Mega proto shield.

Unlike MasterT's solution once they are set up going they require no processing resource to keep going.

Grumpy_Mike:
Their is a chip, the PCA9685 that will generate 16 PWM signals with 12 bit resolution.

This seems like a great potential solution. Thanks for the suggestion, Grumpy_Mike

One thing, though. It says that it has 12 bit resolution allowing for adjustable frequency up to 1.6kHz. Does this mean that I can send it a 40kHz PWM and adjust it around the 40kHz by 1.6kHz or does that mean that the maximum frequency output is 1.6kHz and I can adjust below that?

It looks like the spec sheet says 1.6Khz is the max. Is this correct or am I understanding it wrong?

Thanks

Yes sorry, just had a look and it doesn't go fast enough for you. You could use a phase locked loop to boost the frequency of each output but then that is a lot of phase locked loops.

mprisim:
I am working on an ultrasonic phased array, something similar to this paper
Holographic acoustic elements for manipulation of levitated objects | Nature Communications

It's not the same, but similar hardware would be needed. I emailed the author about it and he mentioned that they used an Arduino Mega shield that allows for generation, phase modulation, and amplitude adjustment of 64 signals. I just can't seem to find it.

Note 1 in the Supplementary Material to that paper indicates they used an XMOS processor, which is a family of very high performance microcontrollers, some of which appear to have sufficient I/O and processing horsepower to do this directly. Something like this, but perhaps not this precise board.

mprisim:
It's not the same, but similar hardware would be needed. I emailed the author about it and he mentioned that they used an Arduino Mega shield that allows for generation, phase modulation, and amplitude adjustment of 64 signals. I just can't seem to find it.

I don't see any mention of Arduino, or shields there. You will need one or more fast CPUs with lots of IO, or FPGA. There aren't any MCUs that could do 64 channels in hardware, so you would need to drive it with software.

It could be designed as a shield, not sure that would be much advantage.

How much phase resolution do you need?

Edit; the paper linked above says they use 50 phase steps. So the rate for one channel is 50*40kHz = 2 MHz. At 500ns per step, even one channel would be a struggle on a 16 MHz AVR. Handling several channels might be doable on a Due, but probably not 64.