Hi guys... i am somehow newbie in Arduino platform and electronics so it may sound stupid but i have problem-i am using two solenoids(for pneumatic pistons) running independently(with Millis()) on Arduino Uno.(each of them have to be opened for specific time) Now i have 24V DC power supply for them and i am switching them ON/OFF with duble relay module...softwear is working fine- tried on LED-s but now when i connected relay module with solenoids valves were blinking very fast(loudly) and leaking air-but stil turning ON/OFF correctly(sometimes i notice bugging)...How can i solve this problem? And would want to know if i need flying diode?
A/ is your 24v power supply big enough?
B/ could you post your code so that we could see any problems.
Allan
Hmm for power supply i am using Bell Transformer 30VA/12-12-24V (https://www.switchesplus.com.au/assets/files/pdf-files/catalogues/Schrack/h_bz326578-a_en.pdf) i think it is big enough...
My air pressures are 600000Pa on first Bar1 and 200000Pa on second Bat2(using pressure regulator)-maybe the load has some impact on this to....
i appreciate any help
Ok this is my code
const byte Senzor=8;//
const byte Bat1=11;
const byte Bat2=12; //
unsigned long SenzorMillis;//when button was released
unsigned long Bat1Millis;// when bat1 is triggered
unsigned long Bat1OnAt; // when bat1 was turned on
unsigned long Bat1OnDelay = 500; // wait to turn on ba1
unsigned long Bat1OffDelay = 700; // turn off ba1 after this time
unsigned long Bat2OnAt;
unsigned long Bat2OnDelay = 700;
unsigned long Bat2OffDelay = 700;
bool Bat1Ready = false;// flag for when button is let go
bool Bat1State = false;// for ba1 is on or not.
bool Bat2Ready = false;
bool Bat2State = false;
void setup() {
pinMode(Senzor, INPUT);
pinMode(Bat1, OUTPUT);
pinMode(Bat2, OUTPUT);
digitalWrite(Bat1, HIGH);
digitalWrite(Bat2, HIGH)
}
void loop() {
unsigned long currentMillis = millis();
// check the button
if (digitalRead(Senzor) == HIGH) {
SenzorMillis = currentMillis;
Bat1Ready = true;
}
if (Bat1Ready) {
if ((unsigned long)(currentMillis - SenzorMillis) >= Bat1OnDelay) {
digitalWrite(Bat1, HIGH);
Bat1State = true;
Bat1OnAt = currentMillis;
// wait for next button press
Bat1Ready = false;
}
}
if (Bat1State) {
if ((unsigned long)(currentMillis - Bat1OnAt) >= Bat1OffDelay) {
Bat1State = false;
digitalWrite(Bat1, LOW);
}
}
//-------------------------------
{
unsigned long currentMillis = millis();
// check the button
if (digitalRead(Senzor) == HIGH) {
SenzorMillis = currentMillis;
Bat2Ready = true;
}
if (Bat2Ready) {
if ((unsigned long)(currentMillis - SenzorMillis) >= Bat2OnDelay) {
digitalWrite(Bat2, HIGH);
Bat2State = true;
Bat2OnAt = currentMillis;
// wait for next button press
Bat2Ready = false;
}
}
if (Bat2State) {
if ((unsigned long)(currentMillis - Bat2OnAt) >= Bat2OffDelay) {
Bat2State = false;
digitalWrite(Bat2, LOW);
}
}
}
}
The link you posted is a transformer giving 24vac out. Your solenoids ( you say) are dc.
1/ Do you have a rectifier ?
2/ how does the arduino control this system?
Allan.
wow massive mistake i overlooked that solenoids are DC and transformer is giving out AC-newbies mistake.( i hope i did not fry anything) i am going to use rectifier...
Idea behind this project is detecting an object with arduino IR sensor and after 500ms it should trigger first piston through relay(remains open for 700ms) and after 800ms(from the start) it should trigger second piston through second relay(remains open for 700ms).
i am really appreciate your advice
Hi,
That transformer does not look very efficient, "BELL" usually means its meant for a "door bell" system, that is LOW duty cycle.
So when you get a rectifier and smoothing caps connected, and check its output DC volts, keep an eye on how warm it gets over a long period of time.
Tom...
OK thanks for advice i will check it=)
i think that rectifier will solve my problem. I will install it and then let you know how it is working.
You will likely need a bridge rectifier to get the full waveform available to power the solenoids.
I only looked quickly at your code and it looks like you are trying to control the solenoids at / for 700 ms through a relay. May be a little too fast for the two mechanical devices.
What is the current requirements of the solenoids? They may overheat with unfiltered, pulsating DC. ?
i used "Schneider electric" with OUTPUT 24V DC/1,2A and it is working great now. The solenoids requirements are 24V DC and 3,1W. For now i didn't notice any overheating but i will pay attention on them.
Thanks for all your help
P.S May the Electricity be with you