(Edit: November 2016: This is an updated (and corrected) version of the original parts creation howto. This version corrects some suggestions (mostly saving Inkscape files as optimized svg which turns out to cause other problems) with the first version and expands the section on parts testing. While there doesn’t appear to be a lot of interest in this subject I’ll make at least this update so the information is as correct as I can get it.)
This is a description of how I made the Valor PM6078-004 5 Volt to 9 Volt DC-DC converter available in parts submit:
Following these steps should result in an identical part to the one posted (if not please post, as that would mean these instructions are unclear / wrong!). Initial knowledge assumptions basically none, when I started this several months ago I’d been a Fritzing user for about a week and had heard of but never used xml and had never even heard of an svg file. So you will have to work at it to be more ignorant than me. This is not anywhere near all my own work, both steelgoose and Old_Grey as well as other members of the forum have been a tremendous help.
- programs to load:
Fritzing (version 0.9.3)
Inkscape https://inkscape.org/en/download/ (version 0.91)
7zip Download (version 16.02)
gerbv http://gerbv.geda-project.org/ (version 2.6A)
- Download the Fritzing fonts from:
http://fritzing.org/learning/tutorials/creating-custom-parts/download-fonts-and-templates/
unzip the fonts from the zip file and install them by double clicking on them or executing them.
-
Assuming you are unfamiliar with Inkscape, go through the Inkscape tutorial to get at least somewhat familiar with running Inkscape. Its complex and bites without warning, and is vindctive and remembers settings you don’t know how you set (and thus can’t clear). I’ve had to uninstall and reinstall it (remembering to delete the Inkscape directory in AppData\Roaming\Inkscape which the uninstall does not delete as well!) to clear some errors I have made.
-
Do some intial configuration on Inkscape for use with Fritzing (other than the grid settings this is less useful than it seems as Inkscape usually ignores it).
Inkscape has some default settings I don’t like, so I changed them. To do the same:
right click on the Inkscape desktop icon and click “run as administrator” (needed to write to program files on Windows). The default Inkscape window comes up full screen (Which I don’t like!) so
edit->preferences->Interface->windows from maximize to large
edit->preferences->Interface->Grids
(px are 90 dpi (dots per inch) set by the svg standard and in is inches for sensible people)
Grid units px to in
Spacing x: .01
Spacing y: .01
Major grid line every 10 (so at .1 inch)
At low magnifications the grid will be .1 inch at higher magnifications it will switch to .01 inch to allow you to check alignment more closely. Change to suit your tastes.
Then exit preferences as we are finished here.
view->page grid
this will enable grid lines, which by default are not displayed (which I find annoying).
edit->xml editor
this starts xml editer in a right hand window which I always want present.
Now we want to save this as the default settings to directory
c:\Program Files\Inkscape\share\templates
file->save as->(drawing) default.svg
In this one case save the file as the default Inkscape svg in case it keeps more of the settings (I don’t know if this makes any difference though)
- Start Fritzing to create the new part.
a) Select generic IC from core and drag it to the breadboard.
b) Click on the IC icon to select it in Inspector (on the right of the Fritzing display)
c) In Inspector set:
chip label (IC) PM6078-004
pin spacing (300mil) 600 mil
pins (8) 24
(note: you must do this one before the edit pin labels below to set the number of pins first!)
Part # () PM6078-004
click edit pin labels:
In Pin label editor which comes up set:
9 (pin9) +5V
12 (pin12) +9V
13 (pin13) 9V GND
16 (pin16) GND
leaving all the other pins as is is fine. Note we have put the labels for pins 1 and 24 on pins 9 and 16 instead because we are going to delete most of the pins in schematic view (where this applies) and this way the labels are on the pins we are keeping making fewer changes necessary.
then click save to save the changes and go back to Inspector
- Right click on the IC in breadboard view and click on “Edit (new parts editor)” to start the parts editor. A new window (the parts editor) opens, click on the icon tab at the top of the screen. Then with the Icon view (currently an 8 pin IC) selected, click file->Reuse Breadboard image to change to the 24 pin IC which should be labeled PM6078-004. Now we are only interested in the tab (currently off the screen to the right) called metadata so click the left arrow in the top tool bar until the metadata tab (next to icon) appears. Then click on the metadata tab and the metadata window comes up. Set:
Title: (DIP - 24 pins) VALOR PM6078-004 DC-DC Converter
Author (Fritzing Part-o-matic) Peter Van Epp
Description (replacing “A DIP stand-in part for whatever IC you want. With 24 pins on a 600mil dual inline package (DIP) footprint.”):
The description will be turned in to html which is why the description text is being entered as one long line, and why it is being done in parts editor (as at least I can’t write html in a text editor, making this the easier way.)
right click the part and Edit (new parts editor)
tab icon
file-> reuse breadboard image
Meta data
(the metadata will be turned in to html which is why the description text is being entered as one long line)
Valor PM6078-004 5 Volt to 9 Volt Regulated DC-DC converter
Since the data sheet is no longer available:
pin 1 +5V in
pin 24 +5V ground
pin 12 +9V regulated
pin 13 +9V ground (as noted isolated from +5V ground).
It needs some load to regulate with no load it is about 16V out) at up to 30ma of output current and with 2500V of isolation from the 5V input. Fits in a 24 pin 600 mil DIP IC socket although only 4 pins are actually used on the socket. Obsolete, but available surplus cheap while they last ($.30US at present) from:
http://www.bgmicro.com/pm6078-004.aspx
Useful when you need to isolate grounds between two systems via optocouplers (this will power the optocoupler that connects to the remote system from your local power source) and for powering the cheap digital volt and ammeters available on Ebay so you can use them the same as a multimeter at any point in a circuit. Without the converter meter measurement ground is also system ground which can be a problem.
(end of description)
label (IC) U
family (Generic IC) DC-DC Converter
Properties:
chip label (IC) PM6078-004 (should already be set)
part number PM6078-004 (should already be set)
(leave everything else as is)
Tags
(Note: when you enter a value and there is no new box to enter the next, just click anywhere in the window and a new box will appear.)
DIP
(Fritzing core) fritzing user
DC-DC Converter
contrib
ground isolation
isolated power
Valor
PM6078-004
5V to 9V
file->save as new part-> filename prefix-> Valor_pm6078_004_dip24_600mil
a new entry of an 24 pin IC should appear in the mine parts bin in Fritzing.
exit parts editor
At this point you have two choices:
A) The new part is currently in the fritzing user directories (by default on Windows in /Users/(windows_username)/My Documents/Fritzing/parts/svg/user/for the svg files) and you can edit the svg files there (which is what I recommended in the first version of this howto). A reason not to do that is that if you screw up the editing you can hang Fritzing and need to delete the user directories to recover. The second option below is I think a better one however with less chance of impacting Fritzing (which may disrupt other projects you are doing at the same time) and thus is the new recommendation.
B) Export the part from the mine parts bin as an fzpz file by:
In the Fritzing Parts window (on the right of the screen) click on parts bin mine(it may be already selected from the previous parts edit). A note here if you click on the bin name in the left side of the part window and drag it up or down you can rearrange the order of the bins. I move mine from the bottom to just below the search icon.
You should see the 24 pin IC (with PM6078-004 as a label) in the parts bin. Right click on it.click “export part” and a new window appears pointing to a directory
(F:\Fritzing_backup\fpz_create currently in my case) with a default file name of VALOR PM6078-04 DC-DC Converter.fzpz which is the title of the part that we set in parts editor. It isn’t however that good a file name as it has blanks in it so I change it to something more readable such as
“Valor_pm6078_004_dip24_600mil.fzpz”
then click save to write the file. Now we are finished in Fritzing for now, so exit Fritzing without saving anything (we have saved the created part elsewhere above!). So answer don’t save to the sketch, Don’t save to the changes to my parts which gets you out of Fritzing with no changes to Fritzing which is desirable. At this point I’m going to assume that you have chosen option 2 (the fzpz file) above and proceed on that basis. If you have chosen option 1, then you don’t need to do the unzip steps that follow as the files are already in the directories but you will need to adjust the paths of the files referenced to match yours.
- change in to the directory that you saved the fzpz file in (F:\Fritzing_backup\fpz_create in my case). The only item in the directory should be Valor_pm6078_004_dip24_600mil.fzpz (if it isn’t its best to move either to an empty directory or move the other files somewhere else). Right click on the Valor_pm6078_004_dip24_600mil.fzpz icon and in the menu that comes up click on 7zip->extract here and the following files should appear (unzipped by 7zip from the fzpz file):
part.Valor_pm6078_004_dip24_600mil_766a5a9dfb32684eb468b6b9b833baa7_2.fzp
svg.breadboard.Valor_pm6078_004_dip24_600mil_766a5a9dfb32684eb468b6b9b833baa7_2_breadboard.svg
svg.icon.Valor_pm6078_004_dip24_600mil_766a5a9dfb32684eb468b6b9b833baa7_2_icon.svg
svg.pcb.Valor_pm6078_004_dip24_600mil_766a5a9dfb32684eb468b6b9b833baa7_2_pcb.svg
svg.schematic.Valor_pm6078_004_dip24_600mil_766a5a9dfb32684eb468b6b9b833baa7_2_schematic.svg
along with
Valor_pm6078_004_dip24_600mil.fzpz
which was already here. These are the svg files and the fzp file that make up the part ready for editingi (without disturbing Fritzing).
- Lets start with the breadboard view svg so in the directory containing the files above click on:
svg.breadboard.Valor_pm6078_004_dip24_600mil_766a5a9dfb32684eb468b6b9b833baa7_2_breadboard.svg
The drawing comes up with correct size but without grids and units in px so click
view->Page Grid
to enable the grid. First item of business it to adjust the viewbox. The view box contains (except for parts with bendable leads) all the elements of the part (I believe other than bendable leads, anything outside the viewbox won’t be rendered by Fritzing). We want to move the part so that the pins are aligned on the .1 inch grid. to do that we need the view box to be larger by at least .1 inch on all sides of the part. In addition while the rulers on the edges indicate that coordinate 0 0 is the bottom left corner of the drawing, in actual fact the origin is the left top corner of the view box. Thae means we want that coordinate to be exactly on a .1 inch boundary so the coordinates of the part will be (or can be moved to at least) exact .1 inch boundaries. To modify the viewbox first open the xml editor (it may already be open as we did open it in the default template file, but if not edit->xml editor will open it in a right side window). If in the xml editor window you click on <svg:svg id=“svg2”> in the right hand window of xml editor you should see a set of attributes appear. The first attribute should be height, currently 0.63in we want to change that to 0.8in so click on height and the window just below where you clicked in xml editor should change to height (with a box marked set on the end of that line) and below that should be the value 0.63in. Change the 0.63in to 0.8in and press the set button beside height. That should change the height to 0.8in after several more attibutes (id, inkscapeversion, sodipodidocname, version) should be an attribute called viewbox. We want to select this and change it from
0 0 1200 630
to
0 0 1300 800
and then click set to set it. This is the coordinates of the diagonal corners of the view box. The 0 0 is the bottom left and the 1200 630 is the top right (in units of 1/1000 of an inch, thus the current view box is .63 inches high and 1.2 inches long). You will note it is currently just beyond the edges of the part (and that the .630 coordinate is not on a .1 inch boundary.) Then select width and change the current 1.2in to 1.3in and click set to set it. When all those are done the main drawing should have a view box .8in high and 1.3in wide with the IC crowded up against the top left corner of the view box. We now want to move he entire IC down until pin 1 is centered on the grid line at .1in .1in (i.e. one grid line right of the bottom left corner and one grid line up from the bottom left corner.) To do that select the entire part via edit->select all, then left click on the body of the part and drag it until it is roughly aligned with pin 1 in the indicated first grid line. Now we are going to zoom in on pin 1 and decrease our grid size by a bit to get the alignment exact. So start by selecting the zoom tool and zooming in on pin 1 until it occupies most of the screen (and the .01 grid lines appear). If you scroll up to pin 24 you will see that the end to end size is about 0.630 inches meaning that the bottom of pin 1 should be on a 0.915 grid line. So you could try and adjust its position by eye to half way between the .01 grid lines, but a better way is to reduce the grid size to .005 and then align it exactly on the grid line. To do that
file->Document properties->grids
spacing x and y is currently .010 change that to .005 for both and you will see that if pin 1 is 3 grid lines below the major grid line, that pin 24 will be 3 grid lines above the major grid line on the top and the center of each pin will be exactly on a .1 inch grid line (the y values are probably out as well but the same thing applies, you want to move the entire IC until the center of the pin is exactly on a .1 .1 grid intersection. To do that again edit-select all to select the entire IC then left click on the body and drag it until pin 1 is properly aligned and then release it. To verify you have the correct alignment, in xml editor select item connector0terminal and check the x and y coordinates. In my case they are x 35 y 600 to check the pin spacing is correct, select item connector1terminal. In my case that is x 135 y 600 indicating that pin 1 is .1 inches (exactly) along in x and the same position in y as pin 0 which is correct. If this wasn’t the case you would want to change the x and/or y coordinates of pin 1 (and all the rest of the pins too) to be exactly .1 spaced. On some of the parts you may need to do this if the original part wasn’t carefully enough made. Now in document properties->grids change back to .01 .01 grid size as we no longer need the very fine resolution.
-
Having aligned the part correctly, we are now going to delete the unneeded pins. The Valor only has 4 pins, on pins 1, 12, 13 and 24 so we need to (at least in the breadboard view where we are) delete all the other pins. The xml editor provides the easiest way to do that. There is one oddity, while the pins are numbered 1 to 24, the connectors start at 0 so pin1 corresponds to connector0pin/terminal so we want to delete everything associated with connector1 to connector10 (pins 2 to 11) and connector13 to connector22 (pins 14 to pin 23). There are three elements to delete for each pin, as an example for pin2 we want to delete connector1pin, connector1terminal, and polygon77. To do so in xml editor select the element (such as connector1pin) and press the delete key. Assuming you are in select mode in the main window, the element will be highlighed in a box of arrows and when you hit the delete key will be erased. At the end of this you should be left with only the 4 pins on each corner of the IC.
-
Now we are going to change the color of the pin 1 marker from its current black to white to match the Valor. To do so control left mouse click on the circle above pin 1 (you may have to zoom in to see it as it is black on black!). The cntrl left click selects elements (such as this one) that are part of a group. You should see a small square with white arrows on all sides, and in xml editor should see an element called svgcircle id=“circle16” selected. In the data window in xml editor look for and then select the element called style with value fill:#212121 this is the color setting of the element. We want to change the #212121 (blackish) to #ffffff (white). When you do so the dot should change from black to white
-
Now on to adjusting the text. As with most things there are several ways to do this. It is possible to use the text tool (after setting the appropriate font and font size) to add text. However the text is created in group root and thus you have to move it in to the appropriate group (breadboard in this case). While this is possible, in this case because we already have text (with the correct font, font size and group already set) it is easier to just duplicate the existing text and change only the text. To do so Control left mouse click on the text “PM6078-004” then with it selected, right click and click duplicate. Nothing will appear to happen as Inkscape has created the duplicate on top of the original. So left click on the text of PM6078-004 and drag it up toward the top of the IC. Another copy of the text will appear under the one you just dragged. That is the original copy and the one you moved is the duplicate. In this case that is important, because the original copy is the chip label, and changes made in the svg file will be ignored by Fritzing so the original text needs to remain PM6078-004 and only the duplicates can be changed to other text. So that said, again right click on the duplicated text (the top one) and duplicate it twice more. Move the first duplicate to just below the original PM6078-004, then control left mouse click to select on the top PM5078-004 and move the final dup to the bottom of the IC. In the end you should have 4 copies of the text PM6078-004 on 4 rows down the IC. Now to modify the text. Control left click to select the top copy of PM6078-004 then with that selected change to text tool (the A icon on the left tool bar or text->text and font in the top tool bar) That should cause a blinking line cursor to appear on the end of the top line of text. Use the backspace key to erase the existing text and then type VALOR which should replace the text using the same font and size. Now skip over the original PM6078-004 (which is staying the same) and select the PM6078-004 on the third line. Again backspace over all the characters then type 5V To 9V (which will appear as 5VTo9V and you will need to move back with the arrow keys and add the 2 spaces as Inkscape apparently won’t add blanks if there is not yet a following character). Finally change the bottom PM6078-004 to PHILLIPINES. At this point you should have:
VALOR
PM6078-004
5V To 9V
PHILLIPINES
on the top of the IC. Go back to select tool(the arrow on the top of the left toolbar) and select (control left mouse click) the PM6078-004 text. In xml editor check that this text is associated with svg: text id=“label”, if it isn’t you have used the wrong version of the text, so change this one to PM6078-004 (by clicking on the text in xml editor just below the id=“label” line). Then find the other copy of PM6078-004 and change it to be whatever the text that you replaced with PM6078-004 with. Now in the main drawing window move the text around til it looks like the list above. Now select each line of text in turn and drag it to be centered in the IC box (the center up arrow in the select box should align with the 6th grid line past pin 24 and the horizontal arrow should align with a horizontal grid line.) We are now finished with the breadboard svg file so we need to save it. Unfortunatly there isn’t (as far as I know) an Inkscape save format that is compatable with Fritzing. The original copy of this document recommended using Optimised SVG. Unfortuntatly the optimization breaks some parts of gerber file creation in Fritzing. Saving as plain SVG breaks bendable pins in breadboard (not an issue here, as this part doesn’t have bendable legs). In all cases Inkscape appends a px to font sizes to support the CSS standard. Fritzing doesn’t support CSS and will set the font size to 0 (making very small text) when edited with the parts editor. So we are going to save this (and all) svg file as plain svg and after all the svgs are edited we are going to run a perl script called Inkscape_post.pl which will convert the style commands that break bendable legs in Fritzing from the CSS format to plain XML and remove the px from any of the font commands to keep Fritzing happy. To that end we now want to save this file as plain svg by
file->save as
and select from Save as type (second line down at the bottom) the second entry
Plain svg *.svg
then save
and answer “replace” to the “file exists, replace it?” dialog.
Now quit Inkscape and answer “close without saving” when it wants to overwrite the plain svg file we just wrote with the Inkscape formatted version or proceed to load the schematic file and when it is loaded do the above with the breadboard file.
- When the schematic is open you have a 24 pin image of which we only need 4, and it will in the end be much too large. So we are going to start by deleting unused pins Starting with pin 1 (as pin 9 will become pin 1!). So open the xml editor if it isn’t already open and click on the + beside schematic to expamd the group. Now click on item <svg:line id='line12" and the line out from pin1 should highlight. Press the delete key to delete it. Do the same with connector0pin, connector0terminal (which won’t highlight anything as it is zero length, but delete it anyway!), text7 (the text pin1), and text1 (the pin number “1”). Repeat this til connector7pin. You should now be at connector8pin which is labeled +5V. Select connector8pin in xml editor and in the right window select id which will put connector8pin in the bottom window. Change connector8pin to connector0pin (to make this pin 1) and press set. Do the same for connector8terminal to connector0terminal. Now label8 is correct (+5V) from parts editor but text73 needs to be expanded by clicking in the + in xml editor and then selecting the “9” that will appear and change it to “1” as this is now pin 1. Then delete connector9pin and connector10pin as above leaving connector11 pin as is. Now delete connector23pin through connector16pin as above. At connector15pin we again need to change the connector ids from 15 to 23 to make this pin 24 and then change the pin number from 16 to 24 as above. Then delete connector14 and connector13 and we are done. You should end up with only 4 pins left marked 1, 24 12, and 13 and with connector0, connector11, connector12, and connector23 as the terminal ids and an overly tall box and a label PN6078-004 that is too high. So control left click the text OM6078-004 and drag it down to be centered in in the 4 pins. That done we are going to reduce the height of the rectangle to be just below the grid line above pins 1 and 24. To do that control left click on the rectangle to select it then in xml editor select y (at present 6.25) and change it to 810 which pushes the entire rectangle down to just below the major grid line above pins 1 and 24. Now select height which is currently set to 1287.5 and change it to 480 which moves the bottom of the rectangle to just above the major grid line below pins 12 and 13. Now all we need to do is resize the view box to more closely match the new size of the drawing. To do so select the top item in xml editor svg:svg id=“svg2” and then height which is currently 1.3in set that to 0.5in. Then select viewbox currently 0 0 900 1300 and set that to 0 0 900 500 to set the correct size of the view box. Unfortunatly that moves the image well out of the view box, so select edit->select all and move the entire image back in to the view box. Then we are finished with schematic so file->save as and save as plain svg answering replace to the prompt.
(out of space, continued in next post!).