iasonopaido
Published

Hydrolic Engine with Arduino

There is a hall sensor that sends signals to Arduino to close the relay for the solenoid valve to pass through the oil.

AdvancedShowcase (no instructions)2,403
Hydrolic Engine with Arduino

Things used in this project

Hardware components

Relay (generic)
×1
Arduino UNO
Arduino UNO
×1
hall sensor
×1
Resistor 10k ohm
Resistor 10k ohm
×1

Hand tools and fabrication machines

hydrolic pump
electric motor
solenoid valve

Schematics

untitled_sketch_bb_IVg5KrAyD7.jpg

Code

magnetic_switch.ino

Arduino
const int hall1Pin = 7;     // the number of the hall effect sensor pin
const int ledPin1 =  2; // the number of the LED pin
const int hall2Pin = 10;
const int ledPin2 = 4;
int hall1State = 0; 
int hall2State = 0;  // variable for reading the hall sensor status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);      
  // initialize the hall effect sensor pin as an input:
  pinMode(hall1Pin, INPUT);
  pinMode(hall2Pin, INPUT);     
}

void loop(){
  // read the state of the hall effect sensor:
  hall1State == digitalRead(hall1Pin);

  if (hall1State = HIGH) {     
    // turn LED on:    
    digitalWrite(ledPin1,LOW);
     
  } 
  
  else {
    // turn LED off:
    digitalWrite(ledPin1, HIGH);
  } 
    
    
    
   hall2State = digitalRead(hall2Pin);

  if (hall2State == HIGH) {     
    // turn LED on:    
    digitalWrite(ledPin2,LOW);  
  } 
  else {
    // turn LED off:
    digitalWrite(ledPin2, HIGH); 
  }
}

Credits

iasonopaido

iasonopaido

0 projects • 0 followers

Comments