DRV8876 and 9V Step-Up Voltage Regulator U3V40F9


I’m trying to control a 9V Latch Solenoid with an ESP32 powered with a 3.7v battery.

I’m using a U3V40F9 connected to a DRV8876 and a PWM impulse for 100ms. It can close the valve but it cannot open it. It makes a coil sound when trying to open but it can’t. I tryied to change the time of the pulse, the values of the PWM and nothing works. It’s seems that there are not enough current to latch the solenoid.

The solenoid only needs a 500 mA pulse for 50ms to latch.

Any help would be appreciated

1 Like


Can you post some pictures that show all of your physical connections? Can you make sure your battery is fully charged and monitor the voltage across the input and the output of the regulator while you are trying to control the solenoid?

If possible, I also suggest you try to confirm that the solenoid is working separately from the rest of your system. Do you have any other equipment you use for that, such as a bench-top adjustable supply that you could use to supply the solenoid with 9V directly?

- Patrick

Hi Patrick,

I tested the solenoid with a power supply. Tomorrow I will post a diagram with the connections. It’s 23:00 here and I don’t have my pc with me.


Hi Patrick,

This are the connections.

An ESP32 and two boards from Pololu.
The Step-Up board raises the voltage to 9V.
The Solenoid is a 9V latching type.

It closes the solenoid but it doens’t open it (but make noise trying to).

I’m using the following code just for testing.

// Define Pins
#define PWM 22
#define PH 23

// Setting PWM properties
const int freq = 2000;
const int channel = 0;
const int resolution = 8;
void setup(){

  // Initialize PH Pin
  pinMode(PH, OUTPUT);

  // Configure PWM functionalitites
  ledcSetup(channel, freq, resolution);
  // Attach the channel to the GPIO to be controlled
  ledcAttachPin(PWM, channel);
void loop(){
  digitalWrite(PH, HIGH);
  ledcWrite(channel, 255);
  ledcWrite(channel, 0);

  digitalWrite(PH, LOW);
  ledcWrite(channel, 255);
  ledcWrite(channel, 0);

I will get an Oscilloscope today to make some measurements, but I’m an amateur.

Can You notice something wrong from the diagram and the boards specifications?

Thanks in advance

The connections in your diagram seem okay, but could you also post some pictures of your actual setup, including close-ups of both sides of the boards, so I can check the soldering?

Looking at your setup with a scope should tell us more about what is actually going on. If you don’t have much experience using one, then this “How to Use an Oscilloscope” tutorial on SparkFun’s website might be a useful resource. As I suggested before, the first things I would suggest looking at are the voltages across the input and the output of the regulator. If that does not reveal any obvious problems, then you might also look at your control signals and the motor driver outputs, though make sure you are always attaching ground clips to ground. (Do not connect a ground clip to a motor driver output; that is a common mistake that could damage your probe.) Please take scope captures as you go so you can post them here.

- Patrick

Hi Patrick,

I forget to tell you that I have a 1000uF/25V capacitor in the power supply. Without it the ESP32 reboot when the pulse to solenoid is done. I think this is a problem. The supply came from the ESP32.

The Osciloscope I have is an hold one from 2011. The USB port doesn’t work and connecting it to PC doesn’t work too. I can’t find drivers for Windows 10. So I take some pictures with my phone.

I haven’t read the link you sent me about how to use an osciloscope yet. I already use one like 30 years ago. I will read it later.
I take some measures with the osciloscope and 3 pictures.

The first one is from the power connection between the ESP32 and the breadboard (DRV8876 and U3V40F9). It seems there are a lot of noise an a drop in voltage.

The second one is from the Out1 from DRV8876.
The third one is from the Out2 from DRV8876.

What should I look to. I should measure the current but I don’t have a Clamp Meter. Any other way to measure current with osciloscope?

What else should I measure?

EDIT: I power the DRV887 and U3V40F9 with the 5v line from ESP32 instead of the 3v3 and remove the 1000uF capacitor and it started to work. This is supposed to work with a 3v7 Li-ion battery. I didn’t try with the battery yet. I had to put double wires in every VCC and GND too. Those little wires for breadboard didn’t help.
Next I will try with the 3v7 battery.

Thanks for your patience

It sounds like you found at least one way to get your system working; I am glad to hear it!

In general, it seems like the scope captures from watching the power connection is the smoking gun here since that shows that the supply could not maintain the desired output voltage when the solenoid was drawing power. In general, I suspect the most important benchmarks for your setup are to make sure that supply and the 9V regulator’s output voltage stay close to constant during operation.

- Patrick

Yes. I think that the solenoid draw more current than the circuit can deliver and because of that the voltage drops. Ohm’s law correct?

It didn’t work with the battery. I need a battery that can deliver the current needed by the solenoid.

Thanks for your help.

Yes, the relationship between voltage and current is dictated by Ohm’s law. Keep in mind that the most basic application of Ohm’s law (V = IR) probably does not tell the whole story here since it’s unlikely that the load from your solenoid is perfectly constant, but it seems like you have the right idea.

- Patrick