How would I produce a pulse like this image? This is to power and actuate a solenoid valve. enter image description here

I'm using a 3D printer Arduino board to do this. This is what I have so far. The if code_seen() passes a number to the main function to change the usecs of the pulse.

inline void gcode_M530() {
  pinMode(VALVE_1_PIN, OUTPUT);
  uint16_t pulse_usec = 200; //default to 200 usecs
  if (code_seen('S')){
    pulse_usec = code_value_int();


  • \$\begingroup\$ Can you share solenoid drive requirements? \$\endgroup\$
    – User323693
    Mar 2, 2017 at 1:50
  • \$\begingroup\$ Current must be specified or exact load impedance \$\endgroup\$ Mar 2, 2017 at 2:39
  • \$\begingroup\$ Activation and hold voltages for solenoids are a mixed blessing and unless you have a pressing reason to lower the hold voltage it's not always a good idea. I have a commercial wall timer switch on my water heater that uses the set back relay method. Every time the power glitches, the relay drops out and I don't have hot water. \$\endgroup\$
    – Trevor_G
    Mar 2, 2017 at 2:41
  • \$\begingroup\$ This is the solenoid: theleeco.com/electro-fluidic-systems/solenoid-valves/vhs/… \$\endgroup\$ Mar 2, 2017 at 3:02
  • \$\begingroup\$ The relay data seems to indicate that it's either 12 or 24 V spike followed by the lower voltage holding supply? What levels do you really need? \$\endgroup\$ Mar 2, 2017 at 4:31

2 Answers 2


You can use PWM to genrate any kind of staircase or hold signal you want to generate. The output of the signal as such should be buffered.

Second method is to use multiple transitors, to generate multiple voltage Levels. I hope you have spare digital output pins on Arduino.

Below image depicts the basic idea. enter image description here

Q3, R3 and R6 aren't required. You can pull up R4 to 2.3V. Use voltage divider rule to calculate value of R5, so that 1.3 volt is generated. Here you have the waveform shape you need.

Specify, more about solenoid and I will edit my answer as needed.

Edit: I would suggest to follow Tony Stewart answer as it is from the same solenoid manufacturer.


This circuit can be used as either an enhanced response time driver or as a low power consumption driver. As an enhanced response time driver, select V1 (usually 2-4 times the rated voltage of the valve being driven) as required to obtain the desired valve response. V2 is the nominal rated valve voltage. Choose values for R1 and C1 to determine V1 pulse duration.

As a low power consumption driver, V1 is the rated valve voltage and V2 is one half the value of V1. This serves to provide full actuation voltage to the valve, which reduces the applied voltage by 50%, thus reducing the valve's power consumption by 75%.

enter image description here

ref http://www.theleeco.com/engineering/electrical-engineering/lee-solenoid-valve-drive-circuit-schematics.cfm#SHD


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.