Pages: [1]   Go Down
Author Topic: Advice on a simple ATtiny relay circuit  (Read 2185 times)
0 Members and 1 Guest are viewing this topic.
Italy
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everybody!

I'd like to (try and) program an ATtiny from my Arduino and use it to control three light bulbs (incandescent.) I've done my homework, but I'd like to get some confirmation that I didn't make glaring mistakes, before I fry something smiley-sweat

Can you give a look at this circuit?



Did I forget anything?

Keep in mind the 5V will come from a recycled "wall wart" transformer of the cheapest kind.

Is my hunch right about using the unregulated line to drive the relays?
« Last Edit: June 05, 2012, 04:39:01 pm by whatfireflies » Logged

Grand Blanc, MI, USA
Online Online
Faraday Member
**
Karma: 95
Posts: 4084
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Greetings smiley

I believe the right side of the relay coils should go to the +5V supply, not to ground. I'd measure the 5V unregulated supply just to make sure it's not far in excess of the relay coil specs. Also, if the 5V supply isn't filtered (or if I wasn't sure how filtered it was), I'd add a reasonably large electrolytic
on the input side of the regulator, maybe somewhere between 220µF and 470µF.

The relay and driver setup could be tested with the Arduino to prove that part of the circuit before moving to the ATtiny.
« Last Edit: June 05, 2012, 03:36:37 pm by Jack Christensen » Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Italy
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh my, you're right! I've fixed the diagram.
Of course I'll test everything on the Arduino before adding more complexity!

The supply measures 5.4V with no load (voltmeter straight to the DC connector) so I'll keep that in mind when I choose the relays.

The regulator's datasheet suggests a 100nF ceramic on the input. Does the large electrolytic go in parallel with it, as I've seen done many times? Do they have different functions?
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 207
Posts: 12919
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Is programming in-system part of the plan?
Logged

Grand Blanc, MI, USA
Online Online
Faraday Member
**
Karma: 95
Posts: 4084
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, I usually use an electrolytic in parallel with a 100nF ceramic. The higher capacitance or the electrolytic provides the bulk of the filtering at lower frequencies, but the ceramic capacitor with its lower equivalent series resistance (ESR) and inductance is better at handling the higher harmonics, noise, etc. It's also common to see a 100nF ceramic cap placed physically near pretty much every logic chip, MCU, etc. to address the high-frequency noise generated by the switching in these chips. It's not unusual for an MCU to require multiple bypass capacitors, depending on package layout. Good reading here: http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Italy
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you!

I pried open the power supply. It has a 470µF on the output side, so I guess I can skip that. But I'll still put a 100nF ceramic physically close to my voltage regulator, even though I found the same component in the power supply too, in parallel with the electrolytic.

By the way, this tiny power supply has the strangest circuit! The mains goes straight into a 4-diode rectifier, then there's a power mosfet (K2185), two transistors, and a bunch of passive components. Only then does it go into the (small-ish) transformer. There's also a photocoupler (TLP421) spanning the high voltage / low voltage barrier, alongside the transformer! Do you know what kind of circuit is it? Tomorrow I'll try and draw the schematics. Maybe it's not as cheap as I thought!

Logged

Grand Blanc, MI, USA
Online Online
Faraday Member
**
Karma: 95
Posts: 4084
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

No doubt a switching supply. In which case it may be regulated, many are. I'd probably add an electrolytic to the project anyway, maybe 10, 47, 100µF, something like that. Kind of like chicken soup. Can't hurt! smiley-lol
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Italy
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Awesome!

I'll post pictures and info as my project progresses. My masterplan is to turn a recycled traffic light into an animated light fixture smiley-twist


Is programming in-system part of the plan?

Not really. I'll try and program it on a breadboard. I'll hopefully load something like ard-core13 and use a sketch debugged and tested beforehand on my Arduino.
« Last Edit: June 05, 2012, 06:02:35 pm by whatfireflies » Logged

Italy
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I updated my circuit to add a diode and a fuse (or PTC) to protect from supply polarity reversal and from over-current.

Again I ask for validation and advice. Are there other common protection schemes I should be using? What about the voltage spike from a failing power supply? That could cause damage without even blowing the fuse, wouldn't it?
« Last Edit: June 05, 2012, 06:54:47 pm by whatfireflies » Logged

Grand Blanc, MI, USA
Online Online
Faraday Member
**
Karma: 95
Posts: 4084
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I prefer to have the diode in series, this will block reverse polarity input yet not draw a large current in a reverse-polarity situation which might damage the power supply. I rarely fuse low-voltage, low-current projects, nor do I worry about power supply failures. It happens quite seldom (never, in my somewhat failing memory smiley-wink), I'm not doing aerospace stuff or anything that life or limb depends on, and there's usually not much invested in the circuit itself. So I'm living right on the edge here smiley-lol

Below is a more-or-less typical supply circuit from one of my projects, meant to be powered from a wall wart. This particular example supplies both 5V and 3.3V.


* ps.png (2.2 KB, 706x193 - viewed 75 times.)
« Last Edit: June 05, 2012, 07:13:52 pm by Jack Christensen » Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Italy
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks again.
Logged

Pages: [1]   Go Up
Jump to: