hy im working on kind of complicate project that drives 28 relays of R2R net witch is 2 balanced audio channels.
7 relay for each phase for 128 binary steps like an adc.
im using teensy 3.5 to control them and im connected to pins 40 > 46.
in beginning i start to run a simple code to test is but i got some fast peaks and drops in some same steps on the binary series.
i played with the code and read some info about speed an interrupts so i take down the priority of interrupts from example
in that way: SCB_SHPR3 = 0x20200000; // Systick = priority 32 (defaults to zero).
i hope i did it right... allso im using FASTRUN and i rise up the cpu to max speed.
it gives me a better precision for the relay timing action and i see it on my scope.
i still got some peaks but less with this code im using now and about 13 nf cap between phase and gnd. theres is still peaks for example when switching step 63 to 64.
6 relays r getting closed and the 7 is opened there is still peaks on those steps that switching few relay at onece.
with this code i m getting half of the peak levels with minimum drops.
i tryd to use some micro delay between actions to see if its helps but i figure out the any delay or timing should but different for the noizy
steps and i try to avoid using delay till i figure out the right method.
im using reed relays of 3ms time switching. im using resistor and transistor nets to control the relays and suppression diode for every 2 relays.
i read in few placed that adding a zener diode back to back to the suppression diode... it should work better for fast closing relays.. this can solve the problem?
here is the part code im using for drive the relays now
tnx for any help or suggestion to solve it.
7 relay for each phase for 128 binary steps like an adc.
im using teensy 3.5 to control them and im connected to pins 40 > 46.
in beginning i start to run a simple code to test is but i got some fast peaks and drops in some same steps on the binary series.
i played with the code and read some info about speed an interrupts so i take down the priority of interrupts from example
in that way: SCB_SHPR3 = 0x20200000; // Systick = priority 32 (defaults to zero).
i hope i did it right... allso im using FASTRUN and i rise up the cpu to max speed.
it gives me a better precision for the relay timing action and i see it on my scope.
i still got some peaks but less with this code im using now and about 13 nf cap between phase and gnd. theres is still peaks for example when switching step 63 to 64.
6 relays r getting closed and the 7 is opened there is still peaks on those steps that switching few relay at onece.
with this code i m getting half of the peak levels with minimum drops.
i tryd to use some micro delay between actions to see if its helps but i figure out the any delay or timing should but different for the noizy
steps and i try to avoid using delay till i figure out the right method.
im using reed relays of 3ms time switching. im using resistor and transistor nets to control the relays and suppression diode for every 2 relays.
i read in few placed that adding a zener diode back to back to the suppression diode... it should work better for fast closing relays.. this can solve the problem?
here is the part code im using for drive the relays now
tnx for any help or suggestion to solve it.
Code:
// Relays Binary Postion Pins Control
FASTRUN void RelayBinNumber(int num) {
// order of pin on buses
// pin 42
// pin 40
// pin 41
// pin 43
// pin 46
// pin 44
// pin 45
if(num > PrvNum){
Serial.println("UP");
PrvNum = num;
for (int i = 0; i < 7; i++) {
digitalWriteFast(RelayVolpins[i], LOW);
if (num % 2){
digitalWriteFast(RelayVolpins[i], HIGH);
}
num /= 2;
}
}
else if(num < PrvNum){
Serial.println("DOWN");
PrvNum = num;
for (int i = 0; i < 7; i++) {
if (num % 2){
digitalWriteFast(RelayVolpins[i], HIGH);
}else
digitalWriteFast(RelayVolpins[i], LOW);
num /= 2;
}
}
}