On my Arduino Mega, there are two PWM pins open. There are eight analog voltage inputs to a datalogger. They are connected through a PCB, and I need test them with a DC voltage sweep. (There are many boards, so that is why I'm making a testing device instead of manually doing each with a variable power supply.)

As an analogy, it's like using four DMMs to measure the the same +Vcc to see if each DMM works.

Is some sort of amplifier circuit needed to output a maximum of 5 V to the eight datalogger inputs? Is an external power source needed? Please give me some direction.

The DC sweep does not have to go to 5 V. For what it's worth:

for(int s = 51; s < 256; s += 51)
{           // PWM: 255 = 5V
  analogWrite(analogWpin, s);      // sweeps thru 1, 2, 3, 4 & 5 V
  analogWrite(analogWpin, 0);


  • 1
    Can each analog input can have the same value, or is it necessary to give different voltages to each input? Do you need to test them at the same time?
    – chrisl
    Jan 1 '19 at 19:31
  • There is a module with the AD5669. It is a 8-channel 16-bit dac. Adafruit and sparkfun have a MCP4725 module, a 1-channel 12-bit dac, perhaps there is a way to use eight of those.
    – Jot
    Jan 1 '19 at 19:32
  • @chrisl It's just sweeping each with the same increasing value. It doesn't have to happen at the exact same time. All the test is doing is showing if the PCB is all connected correctly and functioning properly.
    – adamaero
    Jan 1 '19 at 19:59
  • 2
    analogWrite() does not create an analog voltage (I hate that function name!). It creates a PWM signal. To make it an analog voltage you have to add some signal conditioning to filter out the carrier frequency.
    – Majenko
    Jan 1 '19 at 23:26
  • 1
    Ok. As long as you understand it that's fine.
    – Majenko
    Jan 2 '19 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.