Grove MOSFET with Arduino PWM Signal

Hi,

I would like to control a device with a range of 0-10V with an Arduino Uno Rev2 Wifi. Since the PWM Signal of the Arduino has a maximum output of 5V I tried to use the Grove MOSFET with a Vin of 10V. The problem I have is that the output voltage of the MOSFET only changes between 9.5V and 9.9V. For the test I used the demo code.

// demo of Grove - MOSFET
// use  pwm pin 6 to control a motor
 
int motorPin = 6;
 
void setup()
{
    Serial.begin(9600);
    pinMode(motorPin, OUTPUT);
    Serial.println("Grove - MOSFET Test Demo!");
}
 
void loop()
{
    motorAcceleration();
}
 
void motorAcceleration()
{
    int delayTime = 50;
    for(int i=0; i<256; i++)
    {
        analogWrite(motorPin, i);
        delay(delayTime);
    }
 
    for(int i=255; i>=0; i--)
    {
        analogWrite(motorPin, i);
        delay(delayTime);
    }
}

I don’t know what the schematic of the “Grove MOSFET” is, but I’m wondering if it’s just seeing the maximum value of the analogWrite - the analog output is just a pulse width modulated signal with a mark/space ratio output of 5V/0V so if, for example, there is a capacitor across the input to the Grove MOSFET module it’d hold the input to 5V long enough until the next pulse. A resistor across the input would give you an idea.

Have you tried filtering the analogWrite signal? With your 50ms delay between each output change you can surely filter pretty hard before you notice it? The most annoying feature of the UNO is that it has no genuine analog output.

My preferred way of producing a higher voltage is to input into an op amp (+) with output into the base of a transistor used as an emitter follower with the emitter output fed back via a resistor into the (-) of the op amp, with another resistor to ground - the gain determined by these resistors so that the (-) and (+) of the op amp are the same. So equal values of the resistor would give output to input voltage of 2 and you are not drawing much current from the UNO of the op amp.

It would really help if I could post photos on this forum, is there a way??