PC817 Optocoupler


#1

Optocoupler_pc817_smt_pcb

I’m learning how to make parts and have made PCB layouts for two PC817 surface mount packages which are missing from fritzing. My issue is that the sizing is as per the datasheet in Inkscape but seem off when imported into fritzing.

I have my limit of one linked and I was hoping someone could tell me what I am doing wrong :slight_smile:


#2

I’ll see if I can help.

The first thing I notice is you have all the Inkscape labels set and that is not needed. It will not hurt anything but Fritzing only looks at the ID which you have also set. You don’t even have to set the copper pad names at all if you are using the parts editor in Fritzing to assign the connections.

I also notice everything is set to px and unless you are using the correct px per mm the scaling will be wrong. If you go into the document properties (under the file menu) you can set the document to mm (or inches). Then in the main window when you are using the selection tool you can also set the units to mm (or inches) at the top where you adjust the location and dimensions of an object. Once you have set those can you confirm they are the right dimensions? I get 2.2mm x 1.7mm for each pad and they are 8.2mm apart which is correct according to the datasheet I checked. Once saved it should always open as mm after changing the document properties.

The next thing I notice is you have all the copper and silkscreen groups inside another group and that group has a transform which could be the issue. If you select the entire thing and press ctrl+shift+g it will ungroup them into 2 groups (silkscreen and copper1) and remove the extra transform.

The last thing is save as a plain svg not an Inkscape svg as they contain extra data that Fritzing does not want/need.

Here is the file after doing the above. I have not tried building a part with it but it should be easy for you to try changing the svg. I hope this helps and I hope one of them is the cause of the issue. If it still has the issue how are you checking the dimensions after building the part?
7b225814bd909c0b32caf56af48401a4e69acd16


#3

Optocoupler_pc817_smt_pcb


#4

thanks for the response.

I tried what you said but it still screwed up. I can save the graphic as plain svg with the document set to mm and it reloads in px.

I am new to inkscape but I can’t see why it is doing what its doing.


#5

But again why are you assuming the part is the wrong size? From what I checked the file is the correct size so when is it you are seeing something wrong?


#6

If you are only looking at Inkscape, then that’s normal. Inkscape always saves in px, the other units in the gui are translated from px. By default it starts and displays in px as well. Does the Fritzing part not work in some manner? If so post the part (7th button from the left in the reply tool bar) and one of us will have a look at it and tell you what is wrong.

Peter


#7

The pads look too big in fritzing.

part


#8

I assume that is a rendering from Ailser and what you are seeing around the pads is the solder resist making it look larger than it is. Check the copper only layer or as Vanepp said upload the part or sketch so we can check it out.


#9

I’m using the original sketch. just changing the PCB graphic which I uploaded.


#10

First SMT variant

Sharp PC817.fzpz (13.3 KB)


#11

I played with your SVG awhile and could never find the exact reason it was scaling wrong. I found many places it had transforms and viewbox scaling, some in inches some in metric some in px etc which implies to me that you edited an existing svg to make this one and from my experience that almost never goes well.

So I tried remaking your svg as it is only 5 squares and 1 circle and it worked the first time.

drawing you will have to assign the connections in the parts editor as they are not defined in the svg.

Or try this one I exported from Fritzing.
Sharp PC817.fzpz (13.9 KB)

I should say also my inkscape is always in MM and my svg dimensions in Inkscape show as mm no px. When I open a new project in Inkscape it shows mm everywhere.


As you can see in the xml editor on the right the height is 1.7 which is mm and the width is 2.2 which is also the correct mm. Not px.

To set up your Inkscape like mine check this thread.

I should also add to my tips and tricks to always start a new drawing yourself and not to try and alter existing svgs unless you have parts creation down pat already.


#12

Awesome, thanks. I did import stuff from another svg. I’m new to all this. I didn’t realize there were so many constants.

I guess I have to do a new part file and pcb.svg for each PCB layout?


#13

For each new part footprint you create not each new pcb you make. But most parts out there have an equivalent footprint available and in that case you would only be changing labels. Like recently someone was looking for an Atmega1284 tqfp which is not in Fritzing but if you search for tqfp you will find some other part with a different name. In that case you open the part you found in the editor, save as a new part and change all the names and labels but leave the SVGs as they are (with the possible exception of the schematic which you may want to change the labels in the SVG). This is the case with most footprints you will be looking for. In your case there are no easy to find SMD gul wing 4 pad parts existing so making your own SVG was the only solution.

I do not believe you did anything wrong simply that each time you edit an SVG it gets more transforms and if someone else made the SVG it could have had the wrong PPI so they then scaled it and then you edit it and use the correct PPI but their scaling now makes yours wrong etc.


#14

I just edited the footprint you fixed and have the wide SMT version also now.

I may be able to use an existing footprint for the THT footprint.

I’ll upload them all when I’m done. You guys are very helpful here. Good show.


#15

@Troy1967 No problem we are here to help. When you know the SVG is clean or you created it yourself I think editing it is ok.

If you check the SVG i uploaded http://forum.fritzing.org/uploads/default/original/2X/9/95c85f93f54554dfb087e07e32e0a36f756cb0af.svg you will see each pad size is 1.7 by 2.2 which is mm so I do not believe you are correct that is always saves in px. The location is in px but not the size. If you start with a fresh SVG and have all the settings for the document set to mm the results are mm. If you start with an existing part it will be however the existing part was which I believe is one of the reasons they turn out wrong so often. I haven’t had issues since starting from scratch.

 <rect
       y="291.87598"
       x="8.9919996"
       height="1.7"
       width="2.2"
       id="rect1503"
       style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#f7bd13;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.15000004;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker:none;enable-background:accumulate" />
  </g>

You will also see in the SVG header it has mm

   height="6mm"
   width="12mm">

#16

That could well be correct, I never have figured out exactly what it saves in. Many things are always px (I believe due to CSS) but you may well be correct it depends on something (and I don’t know what something is) for what it saves in. I have also discovered it appears to be impossible to remove transforms from polygons automatically. None of the suggested fixes on line appear to work. The only success I have had is delete the transform with xml editor then edit the points again using xml editor to change the polygon (or polyline in this case) back to where it should be. That said progress is occurring. The above polyline came about in fixing the parts factory to output a correctly scaled schematic for headers. The current one (which I hadn’t noticed before) is scaled at .75 rather than the correct 10.41667 for 1px = 1 thou as the rest of the files are. I expect that is because of the issue of changing the polyline (since schematic is the only one not done). I just downloaded QT and Visual Studio to produce a head version on Windows as I have fixes for the two main file related annoyances (the crash and parts editor not deleting its files even when you tell it to).

Peter


#17

So I just got a parts update and the PC817 is there with a through hole PCB layout. Wondering if someone smarter than me can just add these SMT layouts to it?

Optocoupler_PC817XFP_pcbOptocoupler_PC817XI_pcb


#18

The only way to add to the core parts is to make a submission through Fritzings Part Repo on Github. Unless you are familiar with Github I would suggest for now you should just create your own parts and it will be in your “mine” parts bin for future use. You can also export those parts and upload them here to share with others looking for them.

If you are interested in learning how to submit a part to the core parts please read the following.


#19

I have to learn how to make one part have multiple pcb layouts first.


#20

At present in general you can’t. The ones that appear to do that in inspector are actually each individual parts with code in the source (which you can sometimes fool to add your parts) that does the selection between the parts.

Peter