Amplify PWM signal to 10V/100Hz

Hello
I am currently struggling, due to my limited knowledge on electronics, in a way on how to increase the amplitude of the PWM signal that comes out of the digital pins;
I am looking to produce a square PWM signal, from arduino, between 100 and 400 Hz with 10V of Max amplitude and 0 V of minimum amplitude in order to supply the coil of two relays. The relays I am using are RTH14012. In the Relay, I am supplying current from a current source to the pole (pin 11 - according to the datasheet). I have supplied currents between 10 mA and 50 mA in previous tests that eventually led to the damage of the microcontroller. I also have a resistor of 4.3kohm in pin 14 (channel2) and another resistor of 4.64kohm in pin 12 (channel1). I also programmed code in order to light a green LED to light up when the relay has current passing through channel 1 and a Blue LED to light up when the relay has current passing through channel 2.
Currently I am supplying the coil with a wave generator using a 10 V amplitude and 100 Hz frequency and I need to replace this wave generator with a pwm signal from the arduino but I am having a hard time understading what component or circuit I should use in order to amplify the amplitude from the arduino's pwm signal.
I also can't figure out why my microcontrollers keep getting damaged. I have try to reduce the current to 10 mA applied to both relays but it keeps happening.
I appreciate some guidance.
Thank you.

The code I use to test the circuit with a wave generator is this one:
const int A1Pin = 4; // Input 1 pin
const int B1Pin = 5; // Input 2 pin
const int A2Pin = 6; // Input 3 pin
const int B2Pin = 7; // Input 4 pin

// Pins for controlling LEDs
const int blueLEDPin = 2; // Blue LED pin
const int greenLEDPin = 3; // Green LED pin

void setup() {
  // Initialize input pins
  pinMode(A1Pin, INPUT);
  pinMode(B1Pin, INPUT);
  pinMode(A2Pin, INPUT);
  pinMode(B2Pin, INPUT);

  // Initialize LED pins as outputs
  pinMode(blueLEDPin, OUTPUT);
  pinMode(greenLEDPin, OUTPUT);
}

void loop() {
  // Read the state of inputs
  int input1State = digitalRead(A1Pin);
  int input2State = digitalRead(B1Pin);
  int input3State = digitalRead(A2Pin);
  int input4State = digitalRead(B2Pin);

  // If Input 1 and Input 3 are high
  if (input1State == HIGH && input3State == HIGH) {
    // Turn on the blue LED
    digitalWrite(blueLEDPin, HIGH);
    // Turn off the green LED
    digitalWrite(greenLEDPin, LOW);
  } 
  // If Input 2 and Input 4 are high
  else if (input2State == HIGH && input4State == HIGH) {
    // Turn off the blue LED
    digitalWrite(blueLEDPin, LOW);
    // Turn on the green LED
    digitalWrite(greenLEDPin, HIGH);
  } 
  // If none of the specified conditions are met
  else {
    // Turn off both LEDs
    digitalWrite(blueLEDPin, LOW);
    digitalWrite(greenLEDPin, LOW);
  }
}

Those are 12V relays so you will need a separate 12V power supply.
You can't PWM the coils

Your code doesn't operate any relays.
What are you trying to do?

Do you have 10V available?

If you have 10V, here is a driver circuit for a motor, relay coil, solenoid, etc. It will work with PWM.

An electro-mechanical relay can't switch at 100Hz...

A 10V square wave (50% PWM) is the equivalent of 5V if you are controlling a motor or dimming an LED. (The average is 5V).

This will give you a good explanation of how PWM works: Pulse Width Modulation PWM fully Explained with calculation & example

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.