Newbie Advice please


Good news that it worked! This new idea could work but in this case likely has some issues. Pwm works by changing the ratio of on time to off time and the relays are likely not fast enough to react quickly enough to do that. If you replace the relays with motor drivers or an output driver of some other type that are fast enough to support pwm that should work fine. You may need to opto isolate the outputs to keep the isolation that the relays are currently providing if you need that. You likely don’t want to use the output enable however because it switches from active drive (high or low) to no drive which leaves the output floating and cmos inputs (motor drivers and many other drivers these days) don’t like floating inputs, they want either high or low with a fast transition between the two states. Unl2003 Darlington transistor drivers should be happy enough with the output drive from the shift registers though (they aren’t bothered by the lack of active pull up or pull down like a cmos input is) . You might be better to do the pwm on the input side of the shift registers by alternating shifting all 0s into the registers with shifting the values for the leds in to the registers which uses the active outputs from the shift register to drive the input to the electronic driver at high speed. You have to add code to start from always shift the data from Vixen to the shift registers (as now) to alternating shifting the Vixen data and all 0s. The fade is arranged by (using a simple 4 bit example, scale to higher numbers for a smoother fade) start with every bit time being the Vixen data, next 3 time periods of Vixen data and one time period of 0 (somewhat dimmer) then 2 time periods of Vixen data and 2 time periods of 0s (dimmer again) then 3 time periods of 0 and 1 time period of Vixen data (dimmest) then all time periods of 0 (off). That is essentially what the pwm is doing in hardware but it can be done as software too.



I’ll draw out the schematics of my boar tomorrow for you I have Optus and solid state relays not mechanical so should be fast enough,


I just have resistors and leds on the outputs of the shifter at present, I’ve kept the relays out of it until I’m happy with the code


While they are possibly fast enough (and opto isolated usually) assuming they are switching AC power to the LEDs pwm may not work. LEDs powered from the line typically have a AC to DC converter in them which in turn has large capacitors that tend to hold brightness through short losses of input power. You would probably need to have LEDs that can run from a dimmer and a dimmer that can be controlled from your Arduino for the fade to work. As well when you come to drive the relays the 74hc595 may not have enough output drive. Each output is only good for 5ma as I recall and the optoisolators (if that is what they are driving directly) want about 20ma to work properly. You can either try one and see if it works or find the specs of your relays to find the input current requirement.