These resistors are used all over my schematic for tying up signals to 15V. Ideally I need subparts so I can place each resistor where it is needed, but I’m not sure how to do this as all the subparts would share a common pin. I was wondering if a Net Label could be used as part of the subpart?
Has anything like this been done before? Any suggestions?
Thanks
I’m not aware of anyone doing this before (subparts have been fairly rare) and I’m not sure how to do it. You might try a netlabel and see if that works. I would suggest a bus, but buses and subparts are mutually exclusive (I am not sure why that is, but you can only have one or the other.) I also don’t know how to define a netlabel in a part which will likely be a problem (the netlabels may only be available in a sketch.)
I have done come experimenting with subparts. I started it for a DPDT relay, so the switch contacts and coil could be moved separately.
I saw a post that said the problem mixing sub-parts and buses has been fixed, but I have not tested it.
You “may” not need a bus to do this. There is only one physical pin that is common to all of the resistors in the SIP package. So in theory you could do this as 9 sub parts. One for each resistor, and one for the common. Not sure what a ‘single ended’ resistor would look and act like in a schematic though. To do this with bus plus sub part, you could create duplicate common pins that are bused together, then implement as 8 sub parts. In breadboard and pcb, the duplicate pins can be suppressed, or stacked on top of each other. Assuming the bus + subpart problem has been fixed.
I do not think parts editor has any way to work with sub-parts, so implementing would require manual editing of the fzp file to add the subpart section. See “Split schematic symbols” in the 2.1 Part file format article for the details. That is all I used as a reference. At a high level, it is not complicated. Each separate movable piece in the schematic is wrapped in a group (sometimes called layer) in the svg file, then each piece gets a matching block in the schematic-subparts section of the fzp. That id of the block matches the id in the svg, and it contains a list of all of the connectors that are to be included in the piece. That’s it.
The svg template in the referenced article is misleading. The subpart groups should not be nested inside of each other. This should be closer:
@microMerlin appears to be correct, on Fritzing 0.9.9 a quick test indicates buses are now allowed in subpart parts, so a bus for the connections would be the best bet I expect. On0.9.3b the part crashes Fritzing so the bug must have been fixed.
you set the pins you want in the bus as nodeMembers. Here is the test part I tried last night (it shorts the gate output and the input so isn’t a real part though!) out of a subpart part to see if this was fixed. That should give you most of what you need. The difficult part will likely be figuring out how to represent the bus part in the subparts. I expect something like a net label with “bus” in it at the top of the resistor will work best. The fzp file from this test part should give you everything you need.
By adding a couple more lines to your fzp joins together pins 3 & 4 on the second subpart too, but I notice that it doesn’t join all four pins together though. That would have made things very easy!
Here is a functional SPST relay part with 2 subparts and 2 buses. I had some cleanup planned for this part that I never got around to, but it seems to be working, and includes examples of all of the sections you should need.
@vanepp That is a direct paste of the svg image. I did not even resize it after upload. The forum software was updated a while ago, and now handles the small svg images with units of “in” and dimensions of less than 1 inch.
SPST-D31A-Relay_1.fzpz
I’m struggling to see how this part works, what is the purpose of pins 3 and 4? Is there a way to change this to a normally closed relay? It only opens as a normally open relay in Fritzing and pins 3 & 4 are hidden.
It doesn’t connect them together physically in the drawing, but does do so logically, so a connection to any pin is also a connection to all the rest. That is why I suggested that the bus pin in each resistor may need a net label type tag to indicate it is part of a bus. In schematic this has a consequence: if you have two pins in the same bus it will only connect to the bus once, so you may not be able to make a connection to an open pin if there is already another connection to that bus. The usual way this is handled is putting all the pins on top of each other in schematic (or as I usually do just remember that if a connection won’t complete it is already connected to that bus somewhere else!) So in the case of your sip resistor you can only connect the power source to one of the bus pins, it won’t accept a connection to any of the other 7 as there is already a connection so you need a way to indicate it is connected to a bus. Ideally you would be able to have a net label that took its name from the connected pin, but that functionality (AFAIK) doesn’t currently exist.
SPST-D31A-Relay_1.fzpz
Ok, I have just checked out the datasheet for the D31A and I can see that each side of the relay goes to two pins. I see why you (@microMerlin) want to common the pins now.
Ah yes, placing the part in schematic only a pair light up yellow, but I can see all four connecting in PCB view.
A strange thing I noticed is that if you connect any of the bussed pins to anything else, then the rats-nest doesn’t appear in PCB view unless you move one of the parts.
I will have a play with it over the weekend.
Thanks
I realized while I knew what I was suggesting, without a part/picture it wasn’t going to make much sense to anyone else. So a picture and a part of what I mean:
The “net label” is actually schematic text (with the size reduced to fit in the box.) The down side is that it doesn’t move with the subpart, if you move the subpart you have to manually move the label (which is a PITA!) but I don’t know any other way to do it. Here is the part that creates the above
it has the same moduleId as your posted part so you will need to delete that before you can load the new one. The 8 bused connections have 7 new connectors which are all overlaid on pin 1 and included in the bus (and the same happens in breadboard and pcb, 8 pins overlaid on pin 1) You probably don’t actually need the 7 overlaid pins in the bus, I expect this would work with just the image circled in red above and only one pin in the subpart definition although I haven’t tried that.
An Arduino can not drive that many LEDs from a single data pin. For a 5V Arduino, with red LEDs (about 2V drop), and the 220 Ohm resistors, that circuit would ATEMPT to draw about 122ma from the pin. Which is only capable of about 40ma. With the same assumptions, if you want to drive 9 LEDs directly from a single pin, increase the current limiting resistors to at least 675 Ohms.
The suggested relay would work, although even that might be too much for a digital pin to drive. It would need to have less than 40ma pull in current. Better (LED direct, or relay) would be to use a FET to drive the load. A BJT transistor works too, but is less efficient. Another driver option is an SCS (Silicon Controlled Switch)
If that code is suppose to use PWM to control the LED brightness, it needs to use AnalogWrite, not DigitalWrite. If it is just supposed to be simple on/off, then LEDval should be “True”.
Also for either case, setting the value only needs to be done once. If it does not need to change in the code, the appropriate write could be put in Setup()
You’re correct Arduino isn’t enough power to give full power to all 9 at full brightness.
Which is why I said you would need to add in a relay to the circuit to turn on the external power supply. I’m not using an external power supply on purpose. I wanted to know how the voltage would drop from one LED to the next. The point of my post was that the circuit works with one pin controlling multiple resistors. Thank you for the tip I need to use analogWrite. I have not learned about using “TRUE” yet, only 0-255 & HIGH or LOW.
Yes I agree mechanical relay is slow. What do you mean by digital options? A solid state relay? The other option is using an actual string of LED’s with IC’s instead of just one color. with that I have power +/- with a power supply feeding the string where needed and a data pin.
Either a power transistor or a power MOSFET driven from the data line on the micro will do the job in a simple manner. The string of LEDs with a chip will work fine, but has extra code requirements (there needs to be an assembler driver to meet the chip timing requirements.)