selectable square wave frequencies and volatges

Hi,

I would like to use "switch selectable" square wave frequencies and voltages generator with one sketch using arduino uno.
the requirements are as below.

  1. 50Hz and 4volts.
  2. 100hz and 3volts
  3. 200hz and 5.15volts
  4. 1Khz and 4.75volts
  5. 10Khz and 5volts
  6. 100khz and 5volts

frequencies and voltages should be from separate pins. please help.

Thank you

All available at once?

Show us your proposed schematic and the work you have done on the sketch.

What loads you will be driving?

Hi,

Thank you very much for your response.

i need only any one frequency and the voltage at a time. but, should be able to select other frequencies and voltages using switches.
I will use separate driving circuits for the load.
I haven't prepare the sketches or schematic as i am still gathering ideas on how to do it.

Thank you

The frequencies @50duty cycle will not be a problem, you can use the TimerOne library.

What accuracy is needed?

The output voltages from the Arduino are ~0V to ~5V or ~0V to ~3.3V, depending on the Arduino type.

You will need external components to get the voltages you requested.

What is this for?

Hi,

Many Thanks for your advise. is it possible to provide a sample code to generate frequency & voltage and select using a switch.

This is for a test equipment.

Switch handling can be found in the examples in the IDE.

This example generates a 10Khz signal:

#include <TimerOne.h>
//UNO only

void setup()
{
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);

Timer1.initialize(100);  // Frequency, 100us = 10khz
Timer1.pwm(9,512);       // 50% DC on pin 9

//Timer1.pwm(10,255);    // 25% DC on pin 10

// D.C. 
// 10KHz
// You can use 2 to 1023 
// 0 & 1 gives a constant LOW 
// 1024 gives a constant HIGH
// 2 gives ~125ns HIGH pulses
// 1023 gives ~125ns low pulses
// 512 gives 50us
}

void loop()
{
}

Timer1.initialize(100); // Set frequency here

Changing voltage output levels will need external design.

You may be able the use various series diodes to lower the output levels as needed.

Many Thanks.