Hi Guys, I am new to the forum, electronics and Arduino. I have been doing some basic stuff with LED blinks sketches and the like and have managed to write a sketch that senses temperature and switches a green LED on if in the range and a red LED if over the range. - just some background on my skill levels
My ultimate goal is to have my arduino sense temperature increases and automatically start my petrol powered bushfire pump.
I have been trying to use a central door lock actuator to move the choke and the throttle on the engine, but I am having trouble switching the polarity.
I have two options and am having difficulty with both
- using a 8 channel relay https://www.jaycar.com.au/arduino-compatible-8-channel-relay-board/p/XC4418
- using a H Bridge L298N
I can get the actuator to switch in one direction with the relay set but not switch polarity and run in the other direction. I am not sure if it is a coding issue or a wiring issue.
with the H bridge it appears to kind of work but only slowly and there is a lot of buzzing.
Just wondering what is the best way to go. any clues would would be appreciated
void setup() {
// H Bridge setup:
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(8, HIGH);
digitalWrite(7, LOW);
analogWrite(9, 254);
delay(2000);
digitalWrite(8, LOW);
digitalWrite(7, HIGH);
analogWrite(9, 254);
delay(2000);
}
//Relay setup
int RELAY1 = 9;
int RELAY2 = 7;
void setup()
{
// Initialise the Arduino data pins for OUTPUT
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);
}
void loop()
{
digitalWrite(RELAY1,LOW); // Turns ON Relays 1
delay(2000); // Wait 2 seconds
digitalWrite(RELAY1,HIGH); // Turns Relay Off
//delay (2000);
//digitalWrite (RELAY1, LOW);
digitalWrite(RELAY2,LOW);
// Turns ON Relays 2
delay(2000);
// Wait 2 seconds
digitalWrite(RELAY2,HIGH);
// Turns Relay Off