Digistump Forums
The Digispark => Digispark (Original) Support => Topic started by: germ on June 07, 2013, 02:24:28 am
-
Hello everyone!
This is me taking my first (almost) steps into the world of microprocessors.
With my Sparkies in the mail-system I'm thinking through my plan again, and I thought I better ask here before I do too many beginner mistakes.
My plan is controlling five high-powered LED lights with the help of a 5v Relay module. (15-20mA Driver Current, AC250V 10A output)
So I was thinking of setting it up like this, and please correct me where I'm being silly/stupid.
//Physcial Setup
First of, connecting a cheap 5V 1000 mA AC/DC Supply to the 5v and GND to the digispark for power, and power the relay module via Jumper wire (parallel) from the 5v and gnd on the digispark.
Then connecting the 5 outputs to the relay board (either directly on the pins or with jumper wire).
When it comes to the programming, I have very little experience, and I've never programmed something with the Arduino IDE.
But from guessing, and looking at the examples I got something together: (I put this in a google document to not take up the entire forum, don't know if this is a bad idea or not).
https://docs.google.com/document/d/1eSis9oCUiWxNFrzun6MIaEQnPXicuQ8lVWRRdpY6LxI (https://docs.google.com/document/d/1eSis9oCUiWxNFrzun6MIaEQnPXicuQ8lVWRRdpY6LxI)
I'm not sure if the pins are 0-4 or 1-5.
Is there any way to repeat the code section to save space?
An alternative setup would be using two digisparks, and using one pin on both for input (for photocell activation) and then sharing the outputs. This would also allow me to power the relay board with a 5v and gnd from the outputs, if that makes any difference, I don't know.
Thanks for your patience with the Newbies! <3
-
Sorry, I just noticed that I do have 6 I/Os. Then I could use one fore input and 5 for output and use a single Sparky for receiving a signal and switching 5 relays.
If anyone has some code examples of executing a code when receiving a signal that would be great :)
-
Did you buy the relay module? (if so it must include everything to protect the digispark and you don't need to worry)
Are there transistor that help switching the relays? (I ask because the recommended max current is 10mA per pin and you seem to be a bit over the limit)
You should use P5 as input since it's weaker than the others
you could do something like
#define COMMAND 5
void setup() {
// setup I/Os
}
void loop () {
if (digitalRead(COMMAND)==HIGH) {
// do something
}
}
It will loop until the input is high, then "do something" until the input is low
-
Thanks for the input!
I didn't buy the relay-shield, it's another relay board.
Darn, I missed the max current part. I was hoping to make this simple and just plug it into the board.
So, any ideas on what type of amplifier I need and how I should wire it?
Should I go for an NPN 2N3904, and if so, do I need more parts to make it work? (yes, I am really new to this)
Thanks for the code part, I need the input to to be a trigger rather than a condition.
-
Do you have a schematic or datasheet of the relay board you have?
Also using relays to rapidly switch lights is probably a bad idea (I saw some 100ms delays in your code, I wouldn't go lower than that)
What do you mean by "trigger"? If it's a state change, you can record the last state in a variable and compare it to the current state (you may need to debounce it).
Yes some 3904 can do the trick and depending on you relay board you may need some flywheel diodes.
-
I don't sorry =(
Why is it a bad idea? And is there an alternative? Or do I just have to keep the switching a bit slow?
Trigger as in, the input should start the code once, and when it's done, start again on next input.
(Photocell activating a blink sequence).
Should I use the I/O to switch a NPN Transistor and let that transistor switch the relays instead?
-
I suppose you're speaking of electromechanical relays, these take some time to turn on and settle (around 10ms), have bouncing outputs and limited switching operations, you can wear one in 2 months if switching continuously twice per second, low voltage loads yield longer lifetime, higher voltage less.
Also one may turn on faster than another one, but it doesn't matter for lights.
For led applications transistors are usually used, you'll be ok if you don't try PWMs.
Yes I think you should use transistors, see schematics there:
http://forum.arduino.cc/index.php?topic=140116.0 (http://forum.arduino.cc/index.php?topic=140116.0)
-
Thanks a lot!
I'll look into that link and into using transistors as switches.
You are right in that it's electromechanical relays, as the lights are powered by 230V (and I don't have any solid state ones).
But they aren't gonna be used for a very long time right now so the wear shouldn't be a problem. Nevertheless good to know.
-
I found the schematics for the relay module:
http://cdn.imthi.com/c70689/wp-content/uploads/2013/04/SainSmart-8-Channel-DC-5V-Relay-03.jpg
I shouldn't need a diode for that, or?
But I guess I still need a few transistors...
-
That's better, it's not really a schematic but it helps, have a look at your board there's already a diode near each relay and I'd bet my house U1 to U8 are optocouplers, so you get a very good protection.
Also you get an indication of the needed current on the inputs, you don't need any transistor since it's 0.35mA for a 5V VCC.
Last it tells this board needs 400mA when all relays are on, which the digispark should be able to provide if using the onboard regulator (it's rated for 500mA, you'd better make sure the unused relays are off to lower the current, you need to tie the unused inputs to VCC).
How do you intend to power the board and the digispark? Using an usb supply? Using the onboard regulator?
-
Yay, you are bringing my hopes up again, thanks!
I'm not sure I understand exactly why I don't need the transistor, but it sure makes me happy. (On the bright side, I've learned a thing or two about transistors)
I was thinking of powering it all with something like this:
https://www.sparkfun.com/products/8269
Just cut the plug and feed it into the 5v on the digispark and then to the 5v on the relay-board. Unless that is a bad idea?
Thank you so much for all your help!
-
FYI digispark can handle as much as 40ma per digital connection. 30ma is a good maximum to design towards. After then the output voltage starts to drop off a bit. Also note that the clock speed of the processor is temperature dependant so if you push lots of current through the spark it might be possible to affect reliability of the usb connection for data transfer.
-
I did a little drawing about how I was thinking of connecting it all, using a standard 5VDC Wall Adapter Power Supply.
https://docs.google.com/drawings/d/1LRfwtz8sct8Hm08lqeQ6B93HI6pUo5tBVU7Jr4_pQUk/edit?usp=sharing
Is it OK to connect the 5V and GND like that? All to the + and - of the PSU.
-
Hey Bluebie, the tiny85 datasheet Rev. 2586N–AVR–04/11 page 167 states : "The sum of all IOL, for all ports, should not exceed 60 mA." same for IOH, that's why I usually say to use a 10mA limit (although the absolute max per pin is 40mA from the same datasheet).
Is this wrong?
-
@germ :
Yes it looks good, you probably don't need to connect both gnds on the relay board.
I've added Vcc connections to the unused inputs to keep the relays off and source less current (if you notice the relays are in fact on, tie the unused inputs to gnd instead)
-
Thanks!
It does seem a bit overkill, but It can't hurt, can it? :) (Didn't see a clear connection on the board, so just making sure nothing goes wrong, I guess if it's the same power-source, there shouldn't really be a problem)
Good idea, I'll have to test the relays on exactly when they are on or not, but keeping the unused ones off sounds like a plan.
Might have to reverse the coding (or just switch the cables?) depending on how they work, but that shouldn't be a problem.
-
Another question to someone who can translate the circuits a bit better than me. Looking at the http://cdn.imthi.com/c70689/wp-content/uploads/2013/04/SainSmart-8-Channel-DC-5V-Relay-03.jpg picture, what will happen if I supply the JD-VCC instead?
-
After careful reading, and based on my own experiences with attiny85, I believe they are saying the chip may not deliver 40ma on every pin at the same time - after you exceed the 60ma total you may start to see a voltage drop on the pin outputs. In this way the attiny85 actually ends up working a little bit like a constant current power supply.. I did something really dodgy once, running LEDs without resistors directly off the attiny85 pins.. and.. well.. everything still works. The chips get pretty warm but it doesn't seem to have hurt them, and likewise the LEDs work fine, so the increasing voltage drop is controlling their heat well enough. Check out the Pin Driver Strength section of the datasheet starting on page 187.
-
Another question to someone who can translate the circuits a bit better than me. Looking at the http://cdn.imthi.com/c70689/wp-content/uploads/2013/04/SainSmart-8-Channel-DC-5V-Relay-03.jpg (http://cdn.imthi.com/c70689/wp-content/uploads/2013/04/SainSmart-8-Channel-DC-5V-Relay-03.jpg) picture, what will happen if I supply the JD-VCC instead?
Nevermind, they are connected with a jumper, silly me.
-
@Bluebie:
From the Pin Driver Strength curves, the drop seems pretty linear but these curves stop at 20mA, to me that sounds like it's not recommended to go beyond that in normal operations if you want the device to keep running reliably.
There's also a 200mA maximum for all the chip on page 166, that would match with 5 times 40mA (ignoring reset and its weak drive).
There must be some thermal considerations too, 200mA@5V is a full watt and chips don't like it hot.
These numbers are probably pretty conservative too, for example overclocking is known to work well even if it's not supposed to.
Do you think I should change the max ratings on the document Mark and I put together (http://digistump.com/board/index.php/topic,455.0.html)?
-
Just wondering... from the info on the card, it seems like I could just supply the relays with a lower voltage than 5V.
Maybe this could help? Or can I only do that with the PWM ports?
Also, will a unregulated 5VDC power supply work? Should I go for a 9V and just plug it into the VIN port isntead? I still need 5V for the relays tho.
-
Yes it seems this board can work with 3.3V for example (some arduinos can work at 5 or 3.3V) I don't think it would change anything for you, just stick to 5V.
Tou can use the digispark 5V to power the relays if you use 9V on Vin
What do you mean unregulated 5V psu?
-
What do you mean unregulated 5V psu?
Something like this:
http://www.mpja.com/5VDC-22A-Unregulated-Desktop-Power-Supply/productinfo/18293%20PD/
But they seem a bit unstable, maybe I should just go for a regulated one, if I can find a decent one.
You can use the digispark 5V to power the relays if you use 9V on Vin
Do you mean that I get 5V from the 5V pin to use as supply for the relay-board if I supply the Sparky with 9V via the VIN, or do you just mean from the I/Os?
-
Oh those supplies aren't good for microcontrollers, they consist of a transformer and a diode bridge, sometimes there's a capacitor to filter the output a bit but they really aren't stable and voltage is much higher than supposed unless you sink a lot of current.
Yes you get 5V you can use on other boards when you use Vin
-
You could try one of these on the Vin and then power the 5v relays as well.
http://www.mpja.com/9-Volt-Desktop-Power-Supply-111A-Fairway/productinfo/17722%20PS/
or use one of these 5v regulated supplies, at slightly higher price.
http://www.mpja.com/5-V-2A-Desktop-Supply-H_P/productinfo/18448%20PS/
mark
-
Thanks a lot guys!
I found this little bad boy at work, just gotta check if it's still alive.
https://docs.google.com/file/d/0B_8icTMsheWfQnVKenJQTTdGZ3M/edit?usp=docslist_api
This should work, found a 24V too, which should work on the VIN in worst case.
-
Yes it'll will work but is a bit overkill.
24V will work on Vin but 7-12V is recommended (else the regulator will get hot)
-
Good point on the thermal issue. I'll stay under 12V then.
Well overkill or not, it's free for me to use. So better than buying something worse :)
Thanks a lot for all the help and patience :D Can't wait for my little sparky to arrive in the mail!
-
Thanks everyone for all the help!
I got my relays in the mail today, and there was no problem getting it all together.
After some soldering and making a few custom connectors, I set up a few lights in my office:
http://www.youtube.com/watch?v=NwEfMo0-19k
(My camera is having some focus issues)
Now to figure out the next thing to build! ;D
-
Ok, so another question about Relays.
First experiment was a success! Now on to a new kind of relay and circuit.
Is there any reason why this wouldn't work:
Digispark 5v output -> 220ohm R -> AQH3223
While running 230v, 0-100mA AC on the other side of the AQH3223
This seems like a simple and cheap setup. But as I haven't seen anything like it, I'm a bit worried.
Possibly running a resistor + LED parallel to the resistor for indication.
Datasheet for the relay: https://www1.elfa.se/data1/wwwroot/assets/datasheets/buAQH_data_e.pdf
Am I just being silly now, or is this really possible? Because that would mean a (not cheaper, BUT) fast and easy way to do my own custom relay-board. Also: TINY.
-
From the datasheet it should work, around 15mA should flow in the input and turn it on.
Did you connect it like that:
DigisparkPin -> 220Ohms -> Pin2
Pin1,3,or 4 -> Digispark Gnd
-
I haven't connected it yet, but yes, that was the idea.
It was between this or an optocoupler and a triac, but this seemed a lot easier.
The only LEDs I have are 2v 20mA though. The same current but different voltage.
Shouldn't I be able to change the resistor and put a led and another resistor parallel to that one?
It was clearly too long ago since I did this kind of math.
I should probably put a fuse on the 230v side too.
-
You could use Digispark pin -> 100Ohms -> 2VLed -> AQH3223 Pin2
and AQH3223 Pin1 -> Digispark ground.
-
Really? That would be great, but doesn't that mean 1.2v over the LED? Or does the resistance not alter the voltage at all, just control the mA?
That would be great ofc to not stress the output on the sparky too much.As far as I understand I have no need for the version with zero cross, and just pick the one rated for the highest current as in AQH3223, as we said.
-
If I'm not mistaken you should get around 18mA, 1.2V across the AQH3223, 2V across the 2V led and 1.8V across the resistor. I'd need the exact datasheet of the 2V led for better values.
Yes the resistor just about controls the current.
A 150 ohms resistor would give about 12mA current (you can use one 100 ohms resistor in serie with 2 paralleled 100 ohms ones).
-
Well I was thinking of this LED: https://www1.elfa.se/data1/wwwroot/assets/datasheets/07530694.pdf
And it's 2v 20mA
But both the relay and the LED are kind of forgiving, so anything between 10mA and 20mA should be fine. The LED is pretty bright for an indication LED I suppose, but who cares :P
Made a quick sketch on a 5 relay setup: https://docs.google.com/file/d/0B_8icTMsheWfbzBQcXRHOUFPbms/edit?usp=sharing
"J" is just a terminal for connecting the 230v.
And for this project I haven't really ordered anything, so if we want a 150ohm resistor or a 120ohm, we can just change it to that :)
Thanks a LOT!
*edit*
I made a quick PCB for it too :D https://docs.google.com/file/d/0B_8icTMsheWfYmx1VlhJWmVMc0E/edit?usp=sharing
*edit2* Yeah ok, you'll probably have a hard time seeing those LEDs as they would end up on the back of the board like that... oh well.
-
germ
Since you're intended to incorporate 230v into this board, there are some additional measures you should be incorporating.
1. You should consider running an earth trace between the low voltage and the mains (ie relay contacts), to prevent any flash-over, etc from sending 230v up the 5v line.
You may be able to accomplish this by extending an earth from the right side, in through the other pins (assuming they are unused)
It will require an earth wire, but will give added protection.
2. Ensuring that suitable warnings are in place about 230v on the pcb and isolating it before working on it.
3. Making sure the 230v connectors are rated, and are physically different to the low voltage ones. (No confusion )
4. Consider fusing the 230v as it enters to ensure that the maximum capabilities of your board are not exceeded.
(The wiring rules here in NZ require that devices are appropriately fused to ensure the wiring is not overrated.)
5. Keep the low voltage and mains seperated (ie not in the same hole), and consider using double insulated wires for low voltage.
ie inside an outer covering or sleeving.
5. If you have access to a friendly electrician, have him check it and possibly perform an insulation resistance test (for peace of mind)
Make sure you are careful working on it with the 230v applied.
If possible use an ELCB (Earth Leakage Circuit Breaker) or isolating transformer, as its the unexpected that tends to get you...
Mark
-
Thanks Mark!
That earth trace is a very good idea. I did feel a bit uncomfortable with putting the 5v and 230v traces close to each other, so I kept as much distance as possible. That means I should be able to get an earth trace in there.
I did consider adding fuses, either one per relay or one general fuse (something like a 500mA glass fuse).
There will be fuses and ELCB outside of this circuit either way (but that fuse is 6A).
I am a friendly electrician, and so is my GF. I will heed your advice and perform an insulation test, and also show it to our company electric engineer so that he can approve it.
I would like to have the DC connectors with 2.54mm spacing. They won't be able to fit the cables used for the 230v LEDs.
I'll change that in the PCB circuit. (It has already been improved a few steps from the version I posted)
*edit*
New improved version:
(https://dl.dropboxusercontent.com/u/524696/Arduino/Rboard.r2.5-digispark.PNG)
-
Don't forget to NOT use P5 it can't provide 10mA.
-
Damn, forgot that I used P5 as my input on the other board. Thanks for reminding me semicolo! I'll redraw it!
-
Germ
Sorry I didn't mean to preach to an electrician ....
I hadn't realised that the DS plugged onto the board ...nice touch.
The PCB tracks should be capable of carrying the full current (6A) and the pad size may need to be larger.
You could run the 230v along the right hand side to each connector, and just cut it if you want to have a volt free contact for other projects.
As an aside for that .... someone I know here found it was better to use join the pairs of screw terminals, rather than have them individual.
The mechanical support stopped them moving and placing a strain on the pcb tracks.
and also show it to our company electric engineer so that he can approve it.
That might be interesting.
Mark
Have you considered making all three mains connections available (P+N+E) so you can terminate each led string in the box.?
-
Mark
Don't worry, just because I work with it doesn't mean I do everything right all the time. Also, I'm young and learning ^^
I really hope there will be no 6A on those tracks, but that's good to know.
Yeah, I just wanted to make the board really compact. At least this allows you to control different mains, (not that it will happen, but still).
Hmm.. I have been thinking about what to do with those terminals. Honestly, the most annoying part so far is the fact that there are no terminals to choose from in the component list :P
I did not really consider putting a neutral in there. This was really just supposed to be a "relay" to switch the mains, and then they share a neutral in a terminal outside of the board.
That might be interesting.
Well he's an odd character. He'll be impressed even if the thing catches fire. (not really tho)
I did a remake of this, using the Arduino Micro. This time I put a fuse on the board and connected the terminals.
(https://dl.dropboxusercontent.com/u/524696/Arduino/Rboard.r3.4-Amicro.PNG)
*edit* I did a quick rework and fused the terminals together instead. (it's a bit jury-rigged, but I blame the software)
https://dl.dropboxusercontent.com/u/524696/Arduino/Rboard.r3.41-Amicro.PNG
*edit*edit* I'm not really sure why I have huge traces for 230v... there won't be running much more current there. Maybe about 200mA at the fuse.
*edit3* The software isn't letting me change the pad size on existing components =/
-
germ
Its looking very good.
You indicated the incoming mains is fused at 6A, so therefore the tracks should be capable of carrying 6A, regardless of the fuse downstream.
If you fused it at 1A, then they only need to carry 1A.
(Somewhere in the regulations you'll find the fuse should be rated to protect the wiring ...)
If the terminals you decide to use are 5.02mm (0.2inch I think) between pins, you should be able to join them together, if you space them at 5.02mm/0.2 inch.
Your "fused the terminals together instead" version seems to show the spacing as the same between connectors as it does between the pins, so you should be fine.
Some packages allow you to make you own components, by placing the pads, then drawing a top layer/screen track around the component.
You then group them together or highlight them and add them as a new component.
I find it useful to obtain the terminals I am going to use, before doing the pcb, as some have larger pin diameters, and therefore need a much bigger pad size.
A small suggestion regarding your resistor placement.
You may want to consider moving them closer to the SSR's as the header and SMD resistors might get a bit crowded there.
You can always rotate them 90 deg as well.
Since everything else is 'thru hole', you have plenty of room for thru hole resistors.
These are a very useful looking SSR, I might have to hunt some down here, as I have some upcoming projects, and was considering my options.
The datasheet shows that Pins 1,3,4 are joined together internally, so your common could consist of joining pin4 of SSR1 to pin1 of SSR2, and give yourself some room to move the earth track across a bit.
It's a good learning exercise and with your background, you can now understand a few of those stupid rules....
Mark
-
Well it's 6A outside of this board. The mains fuse on the board will probably be a 500mA fuse or something.
I did a bit of searching in the store, and for the terminals, I decided to go with this: (as there are no 7 pole versions) one 4p (5.08mm) +one 3p (5.08mm) for the 230v side, they will be tight together. And then a 4p 2.54mm terminal for the + - and input. Different size and completely separated should be good.
I'll work on redrwaing the terminals in the software so that it looks better, and more clear. I think the symbol I'm using is for some kind of capacitor :P
It's true that I don't have to go with SMD resistors. I will try some next week, and if they are too much work then I'll just use thru hole stuff :)
Placing the AMicro/Digispark on the stackable headers gives me tons of space to put stuff under the card too.
Yeah, I was trying to find a good alternative. Was going for Triacs, but then i "need" an optocoupler too, and it was just a bit too much for me :P I guess it's still an option tho, I have lots of triacs lying around here and optocouplers are cheap.
Good find! I knew they were joined internally, I just didn't think of doing it that way! That's a lot better, I'll definetly do that.
I was looking into using a seven darlington array to aid in the switching. I've understood how you can use transistors (and relays, triacs thyristors and so on) for switching, but I never really understood using it as an amplifier.
If I make one with a darlington, could you give me a few pointers in what kind of resistors and such that I would need? I'll edit it in here as soon as I'm done with it!
*edit* So, here it is. Worked a few of your tips in, and a darlington. It's getting pretty crowded and the darlington prohibits a few from the pins on the micro to be used properly. I'll rework the digispark version next. -> https://dl.dropboxusercontent.com/u/524696/Arduino/Rboard.r3.42d-Amicro.PNG <- Latest "A Micro"
So, what should I use for the resistors for that? And do I need resistors after the darlington too? I just can't figure out exactly how it works =/
Not sure if optocouplers + triacs would take less or more space, (probably a bit more), but it's just my impression that maybe a triac would be more durable. It harder to switch if you want a big one tho, so then the darlington would be nice. (Or maybe it isn't? I'm still not sure how those optocouplers work, are they like switches?)
*edit 2* Link to the darlington :P http://www.st.com/web/en/resource/technical/document/datasheet/CD00001244.pdf
*edit3* So I did a total rework of the digispark setup. Zoomed out and realized that it's FREAKING TINY! So anyway, I upped the trace sice and clearance, jammed a fuse and darlington in there just for fun.
This time with the resistors AFTER the darlington. Just because I still don't know any better.
-> https://dl.dropboxusercontent.com/u/524696/Arduino/Rboard.r2.8fd-digispark.PNG <-Latest Digispark
-
germ
If you are only fusing at 500mA, then you should be fine with small tracks.
I normally use a range that slide together, and therefore lock.
http://sterminalblock.en.ec21.com/PCB_Terminal_Block_Connectors_LG127V--6501194_6501432.html (http://sterminalblock.en.ec21.com/PCB_Terminal_Block_Connectors_LG127V--6501194_6501432.html)
Darlington
The darlington is basically two transistors. These versions are inverting output.
That is a HIGH on the input creates a LOW on the output .... hence you need to make Pin2 go to +5v and switch the ground pin for each ssr.
No other way sorry.....
If you use the ULN2003 there are no input resistors required, as they are in-built. (your link was all 4 in the range)
You'll still need them between the Output and the SSR.
The Arduino mini can deliver 40mA per output quite easily, so you probably don't need the darlington.
Basically the optocoupler are a LED inside a plastic housing, so its not a lot different from a LED.
I found some today that are mosfet rather than triac.
A good practice regarding power and loads is to ensure the higher load current paths go directly back to the supply.
You have done this with the DS version but the Mini it travels through the board.
So sorry but adding the darlington array has resulted in some extra work.
mark
-
I see what you mean with the terminals, I'll keep that in mind.
Uhhh... seems the darlington was tricker than I thought. I'm not exactly sure how it inverting the output can cause so much trouble.
But as you said, I don't really need them for this specific project, so I'll just remove them again. It's jut nice to know how they work for future builds. Guess I could just use transistors if the load on the board is too high.
You mean leading the GND to the terminal instead of just the board? Well that's no problem, I'll do that.
I'll bring the AMicro up to DS standard (everytime I rework one of them I get the urge to do the other, because I always improve something that carries over), remove the darlington and see where it all end up.
Realizing how tiny all this is, I'll have a fun day of soldering. Removing the darlington really just makes everything easier anyway.
*edit* So it's back to basic with all through hole nice spacing and thickness, all the other stuff I learned and everything neatly in 90º or 45º angles for my OCD ;)
Also no need for the Arduino to be outside of the board, just makes it easier to damage.
I already changed it a bit since I uploaded the image tho, moved the LEDs one step to the left, they were a tiny bot too close to the SSRs.
I COULD make it smaller, by switching the 230v IN and output 5. But that would add to confusion when it's installed.
With all this work, I hope you won't tell me that it's just as easy to make a double-sided PCB xD
Thanks a lot Mark and everyone for all the help!
-> https://dl.dropboxusercontent.com/u/524696/Arduino/Rboard.r3.5fl-Amicro.PNG <-
-
germ
That looks really great and very polished.
Guess I could just use transistors if the load on the board is too high.
Unfortunately you are in the same boat, since they invert.
Think of a transistor as a relay, but with one contact joined to one of the coil wires, and that has to be ground.
Instead of switching the phase (volts), you have to switch the neutral (ground).
Before you commit to getting it manufactured, you may want to include some mounting holes (pad with clearance for the standoff) and check if it fits in the enclosure of your choice, that gives you sufficient room for the cord grips, etc.
Mark
-
Thanks Mark!
I already tweaked it a little. Increased the size of the pads (compared them to the digispark pads), and removed all 90º bends in favor of the 45º ones.
Also changed to one size bigger resistors, just in case. It turned out pretty small still, only about 65x60mm.
Oh, and I rotated the LED, no one told me they were backwards xD
https://dl.dropboxusercontent.com/u/524696/Arduino/Rboard.r3.5%20final%20Amicro.PNG
Yeah, mounting holes... I'll do a few of those too.
I was going to print it, and try to make my own PCB, following some guides over at instructables. I'm not sure if I'll succeed, but you never learn if you don't try right? :)
-
germ
Your LED's were around the right way to start with.
http://electronicsclub.info/leds.htm
What was not completely right was the pads should have been swapped in the component template.
If you wanted more space, you could consider moving the resistors to be parallel to the ssr, shifting the led left, and running the pin 2 trace through the resistor to the Kathode of the LED. A short track heading right from the Anode to the resistor.
I still think the pads for your connectors are on the light side.
I recall most of the pins are 1.2-1.5mm which doesn't leave a lot of track after drilling.
Sometimes there are VIA's which might be larger. Since you are printing it, their function is immaterial.
Mark
-
Oh, well that's just confusing. Yeah I read that the square pad should be +. But flat side is k huh, well I'll just remake the component :P
I'll consider it, and I'll try it :)
Hmmm, yeah well to be honest they did look bigger in the software, maybe it was the background.
The problem is that I have to de-construct and reconstruct every component manually to replace the pads. But I'll try one size bigger, see how it turns out.
Thanks!
-
germ
re pulling it apart
If you don't care and will build it yourself, it doesn't matter, just stick the led in the right way.
If you are having a silkscreen they changing it to suit might be the better option.
You may be able to drop a much larger PAD over the top.
Since you're manually placing it, it should work fine.
Cheers
mark
-
Well I had to change all the pads anyway. Made the as big as I dared, and made the hole a lot smaller. As I'm drilling it myself, I don't want any holes ending up with gaps between the hole and the pad.
I switched the LED and the resistors, was that how you meant? It became a bit more compact, and the trace looks a little cooler ;)
We'll probably fix the mounting holes when we cut the board later. Probably just make it a bit bigger.
(https://dl.dropboxusercontent.com/u/524696/Arduino/Rboard.r3.51-Amicro.PNG)
Will have vacation in a week, then I'll probably try to etch the board :)
-
germ
Yes that was the way I thought might give you some room.
It looks good. :D
You might have enough room for mounting at the left corners, and for the right side between the two tracks on the upper, and a little left of the fuse for the lower.
No need to make it bigger if you don't have to ... ;)
Mark
-
Measured the 230v LEDs today. My Fluke didn't register over 61mA at any point, so I'm pretty confident the SSRs won't die.
Ok, so I'm pretty happy with this. Now does the micro handle more mA per output than the digispark?
I was thinking that the next step will be flashing one of my sparks with littlewire and mount a chip right onto the board.
I need a chip that is programmable with the digispark, so that's at least all the ATtiny with <=8pins, right?
Can I program a ATMega, and is there any reason to go with an ATMega instead of a ATtiny?
Second question would be, how much do I need apart from the chip? I want to skip all fancy stuff; no power on LED, no test LED, not voltage regulator for 7-12v etc.
I just need 5 outputs and 1 input. Does a ATTINY13A work? (If I keep my code to 1kb)
Yeah I won't let this thread die just yet, I'm learning too much :)
-
If I'm not mistaken you need to keep the reset pin if you want to be able to reprogram your chip (for example you need a high voltage programmer to erase a digispark without using the bootloader).
So you'd get only 5 I/Os on a 8 pin MCU.
But you could use a 14 pins Tiny24, 44 or 84 (I don't think the code is compatible though) and even a mega.
The chip you choose depends on the flash size and peripheral you need.
If using the internal oscillator you only need a 100nF capacitor between Gnd and 5V.
-
Aww, that so? And I need all 6 of them. So I guess I'll go for a 24/44... question is... Can I program those with the digispark, or am I limited to the 8-pin chips?
Was thinking of building a programming shield for my sparky and then program the chips. Too bad you loose an I/O =/
Still, any help in using something else would be nice too.
-
I think I remember some posts about using the spark as a programmer for other chips like the atmega or tiny44. But I'm sure it can be done, problem is the amount of work needed.
You also need to build the code with different tools for the tiny44, you can use the arduino ide for atmegas.
Maybe the arduinoISP sketch can be used with some changes on a digispark too.
-
So, as far as I've gathered, the first number in the name is the amount of flash memory in kB. But what is the last number?
You men that the AttinyX4 doesn't understand the same kind of kode as the 85?
As it seemed extremely simple to program another 85, I thought maybe it wouldn't be rocket science to do it with a 13A or a 24/44/84.
What about Attiny45? Isn't that basically a 85 but with 4k memory?
Worst case, can I sacrifice the reset pin for a "one time only" programming of a chip? To get all the I/Os.
-
I'm not 100% sure but I think tiny84 doesn't use the same code as tiny85, I'll double check.
Yes the first number is a code for flash/ram size the other one tells the chip kind (that's why I say they don't use the same bytecode).
Yes a tiny45 is the same with 4K flash and also half RAM/EEPROM but you have to tell the compiler about this.
Last question is also a yes, you have to burn it right the first time, write the flash then the fuses.
-
Found this http://hlt.media.mit.edu/?p=1695 while searching if 84 and 85 had compatible code.
The guy provides models to build code using the arduino software for different tinys.
You still need a regular arduino to burn the chip though.
-
Thanks. I'll read that more thoroughly later. I might have a friend with an uno I could use maybe.
I should be fine with making a "one time only" chip, as long as I can do it with the sparky, and not some other expensive device. I'll try to research a bit on the net, but if it's too much work, I'll probably end up just using a complete board like digispark or arduino micro anyway.
Did a super compact version of my shield with a chip directly on the board. Would it work this way, or does it need pull-up/down resistors or anything else?
-> https://dl.dropboxusercontent.com/u/524696/Arduino/Rboard.r4l-attiny.PNG <-
-
I'd add a 100nF cap on top of the MCU, else it should work.
-
Exactly where and why? But I'll add one ;)
So I found this guide on how to program the attiny13 with arduino... should work on the digispark too, can't see why it shouldn't.
Just gotta find something about disabling that reset to get all the I/Os.
Attiny24/44/84 seemed to work too, but the store I'm using doesn't have those.
*edit*
So I guess the cap goes between the 5v terminal and the 5v pin?
Any suggestions on what kind of cap? Ceramic, Polypropylene or Electrolytic? Or doesn't it matter?
-
germ
Semicolo was suggesting you need a 100nF capacitor between the +5v and ground.
In each of your other designs, there was a manufactured board that included these. (and a larger 47-100uF as well)
Best suggestion I can make is to shift the input voltage connector to the left, and stick it there.
This is also the closest to the uP where it will protect it from either its own noise or other noise spikes.
100nF won't be electolytic but likely to be mylar or MKT polyester.
http://www.ehobbycorner.com/pages/tut_capacitors.html#Types (http://www.ehobbycorner.com/pages/tut_capacitors.html#Types)
You can usually buy them in 0.1, 0.2 spacing (ie already bent ready to insert).
Mark
-
100nF won't be electolytic but likely to be mylar or MKT polyester.
http://www.ehobbycorner.com/pages/tut_capacitors.html#Types (http://www.ehobbycorner.com/pages/tut_capacitors.html#Types)
I was thinking of this one https://www.elfa.se/elfa3~se_en/elfa/init.do?item=67-005-04&toc=0&q=67-005-04
But nevermind, I'll just choose the ceramic one.
Like this one https://www.elfa.se/elfa3~se_en/elfa/init.do?item=65-726-89&toc=0&q=65-726-89
Perfect spacing to just jam it in there behind the terminal.
This all still depends on however I manage to program these little suckers, but it's nice to know what to do with them if I manage.
Thanks a lot!
*edit* Thanks for the link, now I know why to put it there!
At least I understand the voltage drop thing, I don't really know much about ripples and noise.
-
I had a look at the ArduinoISP sketch and it's written using directly the SPI registers instead of a high level library, so it'll be a pain to port to digispark.
You'd also need a serial to ttl converter and use software serial to talk to the pc.
-
Yeah, sorry.. I didn't understand much of that at all...
In this link http://elabz.com/arduino-shrunk-how-to-use-attiny13-with-arduino-ide/
it sounds rather simple to program a attiny 13 with an arduino, altho with 5 I/Os... but I haven't finished reading all of it properly yet.
-
That's nice, they explain how to build software for tiny13 using the arduino environment.
But you still need a programmer to send the software into the tiny13.
Sorry for the mumbo jumbo, what I meant is they used low level instructions that are not compatible with digispark in the ArduinoISP sketch.
-
But can't the digispark be the programmer? I mean, if they are using another Arduino to do it, shouldn't it still work?
Uhm, ok. Well I'll have to research all this a bit more, I'm still confused about all the tinys and how it fits and doesn't fit with the arduino stuff.
-
theoretically, it can, the problem is the programming arduino software was written using specific atmega instructions that won't work as is on a digispark.
Also the pc is sending/reading data through a serial line to/from the arduino, serial emulation via USB is not working on a digispark so you'd need an external TTL to Serial converter.