First post on here, please be gentle!
I’m having issues getting my 4313 to work with relays. If i direct connect a relay to the ouput pin i get nothing, and i have also gone to the extent of using a transistor to boost the power, with no luck. I’m programming the tiny fine, I have an indicator LED which flashes as and when it should. A multimeter shows voltage coming from the right pins to activate the relay, however no luck! I have attached an image of my circuit itself. Any suggestions? I have attempted to get the tiny working with relays in the past without luck, whichever route I try.
In your schematic you have at least Two Critical errors...
- You have no bypassing on the uC at the junction of R2 the 1K resistor and the uC.. Move that part to the output to the base of the transistor BD679 and connect it between the base of the transistor and the uC port controlling the relay.
- Move the relay coil to the collector side of the transistor and ground the emitter.
- Move the diode in series with the relay coil so that it is in parallel with the coil with the cathode pointing to the collector and the anode grounded.
4. Add a voltage regulator for the uC to supply 5 Volts to the uC... R2 from a 12V source will NOT power the 4313 properly and ESPECIALLY with no bypassing.
If you MUST power the uC from 12V then using a 1K resistor AND a 5V Zener AND some bypassing, or better a Regulator... Is a beginning.
The 1N4001 diode from 12V to the relay coil, as is is doing little for the negative back Emf pulse that occurs when the coil power is removed by turning the transistor off.
A .1 uF capacitor is required at the Vcc connection to the uC for best stability of the uC.
Before you can develop code for the 4313 you need a stable and clean source of power for it.