
Fig. 1
Arduino SSR Power Enable Program
by Lewis Loflin
In fig. 1 a solid state relay is used as a power enable switch for a generic H-bridge circuit. Below is the program used to operate the above.
Pressing S1 and S2 together enables power. Press both again and power is off.
Arduino digital pin 11 (LED3) turns the solid state relay ON-OFF. This is done by reading I/O pin state then inverting (XOR or NOT) the result then writing it back.
- Arduino Nano Test Template
- Arduino Solid State Relay Motor Enable Control
- Arduino Blink LED Tutorial
- Arduino SSR Power Enable Program
- SSR Based High Voltage H-Bridge
- Arduino H-Bridge Motor Control Program with LCD Display
- Arduino XOR Blinks LED
- Arduino IF Statement Code Examples
- Arduino Motor Control Program Using IF
- Related:
- Arduino Port Registers Revisited
- LM317 High Power Constant Current Source Circuit
- LM317 Adjustable Voltage Source Current Boost
- Build a Transistor H-Bridge Motor Control
- H-Bridge Motor Control with Power MOSFETS
#define SW1 2 #define SW2 3 #define LED1 9 #define LED2 10 #define LED3 11 #define pot 0 // HIGH = 1 and LOW = 0 #define ON 1 #define OFF 0 byte temp; void setup() { pinMode(LED1, OUTPUT); pinMode(LED2, OUTPUT); pinMode(LED3, OUTPUT); pinMode(SW1, INPUT); digitalWrite(SW1, HIGH); // pull up on pinMode(SW2, INPUT); digitalWrite(SW2, HIGH); // pull up on } void loop() { delay(100); if ( S1() && !S2() ) { delay(200); if (S2()) { } // do nothing else digitalWrite(LED1, 1); } else digitalWrite(LED1, 0); if ( S2() && !S1() ) { delay(200); if ( S1() ) { } // do nothing else digitalWrite(LED2, 1); } else digitalWrite(LED2, 0); // power enable if ( S1() && S2() ) { byte temp = !digitalRead(LED3); digitalWrite(LED3, temp); while( S1() || S2() ) {} } // end if } // returns 1 if switched pressed byte S1(void) { if (digitalRead(SW1) != 1) return 1; // or use (digitalRead(SW1) == 0) // 1 is a HIGH else return 0; } // returns 1 if switched pressed byte S2(void) { if (digitalRead(SW2) != 1) return 1; else return 0; }
- Related:
- Optocoupler MOSFET DC Relays Using Photovoltaic drivers
- Connecting Crydom MOSFET Solid State Relays
- Optical Isolation of H-Bridge Motor Controls
- Arduino Projects Revisited Revised
- Schematic for Following Projects
- Programming ADS1115 4-Channel I2C ADC with Arduino
- Arduino uses ADS1115 with TMP37 to Measure Temperature
- Connect Arduino to I2C Liquid Crystal Display
- Arduino Reads Temperature Sensor Displays Temperature on LCD Display
- Arduino with MCP4725 12-bit Digital-to-Analog Converter Demo
- Videos
- Arduino with ADS1115 4-Channel 16-bit Analog-to-Digital Converter
- Arduino with MCP4725 12-Bit DAC
Videos:
My YouTube Videos on Electronics
Introduction to the Arduino Microcontroller
Part 1: Programming Arduino Output
Part 2: Programming Arduino Input
Part 3: Arduino Analog to Digital Conversion
Part 4: Using Arduino Pulse-Width-Modulation
Repost Arduino AC Power Control
- Comparator Theory Circuits Tutorial
- Constant Current Circuits with the LM334
- LM334 CCS Circuits with Thermistors, Photocells
- LM317 Constant Current Source Circuits
- TA8050P H-Bridge Motor Control
- All NPN Transistor H-Bridge Motor Control
- Basic Triacs and SCRs