So I’ll do little experiment. The goal of this experiment is to update the schematic from the 2N to the MMBT variant without removing the original schematic symbol because that would mess up the connection between Eeschema & Pcbnew. (component placement and such).
Please make a backup first if you want to follow along.
In Eeschema press A for Add and type in “3904” in the search box. This gives me 8 different transistors, including the “2N” and MMBT variants.
Then I placed the 2N3904 on the schematic and pressed [F8] to get it on the PCB. Ah, forgot annotation, so that pops up in between. It’s a fully specified symbol, so I get a TO92 on the PCB.
Back to the schematic: Hover & press C for Copy, and place a copy of the 2n3904 next to the previous one. F8] again, and also place it next to the other one on the PCB.
Back to the schematic, hover over the right 2N2904 and press E for Edit. In the symbol properties window, click on the bookcase right from the entry field for “Library Reference:”
Type in “3904” in the search box (you could have placed that string on the clipboard) and select the MMBT variant.
Back in the schematic, bot transistors now look like 2N3904, but the pin assignment is different:
Back to Edit the right transistor:
Now I’ve broken coherency. The footprint is still a TO-92 package, but the pin assignment for that package is not correct.
Hmmm, slightly annoying, how can we fix this?
Ah: I see a button with [ Update Fields from Library ] That sounds promising. I click on it and I get this:
The “Value” field was not selected, and I also want to update that, so I also select it and then click on [ OK ]
In the symbol properties, the value changed to the MMBT variant, Footprint also changed to SOT-23.
Looks good, so I press [ OK ] in the Symbol Properties window. Now I have both an 2N3904 and a MMT3904 in the schematic:
[F8] and I have now both transistors and in the same locations as they were before, so placement is preserved.
So this works, but having to do this for 100’s of components is boring work. It seems to be reasonably save, If you forget a few transistors, they will stay in TO92 package and you see that quickly on the PCB.
But still… How can this be improved?
We need some stuff to work with, so first copy the 2N… a few times and also put them on the PCB:
Aaahhrrggg, this is slightly annoying. I was hoping I could change the Library Reference from within Eeschema / Tools / Edit Symbol Fields
In Symbol Fields I can single click on the value field of the MMBT3904, Copy it, and then paste the value field to Q101, Q103-Q105 The trouble is we do not want to do this with the “value” field, but with the “Library Reference” field. And the “Library Reference” is not in the Symbol Fields spreadsheet.
A short trip to CvPcb, but it seems unlikely I can change the Library references here, so it was a short trip.
Bit of good ol’ browsin’ through the menu’s and I find:
Eeschema / Tools / Edit Symbol Library References That sounds promising…
So I click on the “Transistor_BJT:MMBT3904” text in the Current Library Reference column, and paste the text into the New Library Reference column for transistors “Q101, Q103, Q104, Q105”. I have to fiddle a bit with the text here, because I pasted a long string starting with the text "Q102 and ending with a carriage return. I only want the text from the Library reference. So after editing that single line of text it looks like:
Then I press on [ Apply ] and [ OK] to go back to Eeschema, and nothing seems to have changed. The base of the 4 old transistors still seems to be connected to pin2, while it should have changed to pin 1. As soon as I move or change any of the old 2N transistors, the pin assignment reflects the changes I just made. To me this looks like a Bug in KiCad V5.1.5 Is this still in the nightlies? I do not have 5.99 installed.
Saving the schematic, then exit Eeschema and restart Eeschema from the project manager fixes it. It was just the graphics that were not updated.
The last step to fix this would be to click on the [ Update Fields from Library…] in the “Symbol Properties” dialog for all the transistors in one go. Bit of the good ol’ browsin’.
Eeschema / Edit / Update Fields from Library, also select the “Value” field and [ OK ]
And Voila, I’ve now got 5 MMBT3904 transistors on my schematic:
There is only one problem with this. It works for the transistors, but it also resets the value fields of all your capacitors and resistors. That is of course the reason why the “( )Value” is not checked by default when doing Eeschema / Edit / Update Fields from Library.
So I think I’ve found another bug in Eeschema V5.1.5
The text and the tooltip of Eeschema / Edit / Update Fields from Library… / Options / Reset fields which are empty in library contradict each other:
The wanted behavior here (for me) is to set the value fields of the transistors from 2N3904 to MMBT3904, but preserve the value fields of all resistors and capacitors. No matter whether I check the checkbox for [ ] Reset fields which are empty in library the value fields of the resistors and capacitors always get reset.
Can someone please confirm this? To me it looks like a good reason to make KiCad V5.1.6.