Closed Bouni closed 2 years ago
Maybe this gets solved with #55
I think I've found something really helpful!
A get request to https://cart.jlcpcb.com/shoppingCart/smtGood/getComponentDetail?componentCode=C2286
Gives back a nice JSON object with all sorts of helpful data.
Here's the full response:
{
"code":200,
"data":{
"assemblyMode":"smtWeld",
"assemblyProcess":"SMT",
"attributes":[
{
"attribute_name_en":"Illumination Color",
"attribute_value_name":"Red"
},
{
"attribute_name_en":"Dominant Wavelength / Coordinate rank",
"attribute_value_name":"615~630nm"
},
{
"attribute_name_en":"Luminous Intensity (IF=20mA)",
"attribute_value_name":"100~120mcd"
},
{
"attribute_name_en":"Correlated Color Temperature - CCT(K)",
"attribute_value_name":"-"
},
{
"attribute_name_en":"Mounting Type",
"attribute_value_name":"Surface Mount"
},
{
"attribute_name_en":"Lens Color",
"attribute_value_name":"-"
},
{
"attribute_name_en":"Luminous Flux/Radiant Flux",
"attribute_value_name":"-"
},
{
"attribute_name_en":"Color Rendering Index(CRI)",
"attribute_value_name":"-"
},
{
"attribute_name_en":"Vf - Forward Voltage",
"attribute_value_name":"1.9~2.2V"
},
{
"attribute_name_en":"Size / Dimension",
"attribute_value_name":"1.6mm x 0.8mm"
},
{
"attribute_name_en":"Height (Max)",
"attribute_value_name":"0.7mm"
},
{
"attribute_name_en":"Operating Temperature",
"attribute_value_name":"-40℃ ~ +85℃"
}
],
"canPresaleNumber":290199,
"componentBrandEn":"Hubei KENTO Elec",
"componentCode":"C2286",
"componentDesignator":"D",
"componentImageUrl":"https://assets.lcsc.com/images/lcsc/900x900/20180914_Hubei-KENTO-Elec-KT-0603R_C2286_front_10.jpg",
"componentLibraryType":"base",
"componentModelEn":"KT-0603R",
"componentName":"Hubei KENTO Elec KT-0603R",
"componentPresaleType":"buy",
"componentSource":"jlc",
"componentSpecificationEn":"LED_0603",
"componentStatus":"yes",
"componentTypeEn":null,
"dataManualUrl":"https://datasheet.lcsc.com/lcsc/1810231112_Hubei-KENTO-Elec-KT-0603R_C2286.pdf",
"describe":"Red 615~630nm 1.9~2.2V 0603 Light Emitting Diodes (LED) RoHS",
"encapsulationNumber":4000,
"encapsulationUnit":"PCS",
"erpComponentName":"LED_灯_红_Iv=100-120_λd=615-630",
"firstTypeNameEn":"Optocouplers & LEDs & Infrared",
"initialPrice":0.0030,
"jlcPrices":[
{
"componentCode":"C2286",
"createTime":null,
"deleted":false,
"endNumber":199,
"jlcComponentPriceAccessId":null,
"jlcComponentPriceKeyId":null,
"lcscComponentId":null,
"productPrice":0.0076,
"startNumber":1,
"updateTime":null
},
{
"componentCode":"C2286",
"createTime":null,
"deleted":false,
"endNumber":-1,
"jlcComponentPriceAccessId":null,
"jlcComponentPriceKeyId":null,
"lcscComponentId":null,
"productPrice":0.0030,
"startNumber":200,
"updateTime":null
}
],
"lcscComponentId":2659,
"lcscGoodsUrl":"https://lcsc.com/product-detail/Light-Emitting-Diodes-LED_Hubei-KENTO-Elec-KT-0603R_C2286.html/?href=jlc-SMT/?href=jlc-SMT",
"leastNumber":20,
"leastNumberPrice":0.1520,
"lossNumber":5,
"matchedPartDetail":"Hubei KENTO ElecRed 615~630nm 1.9~2.2V 0603 Light Emitting Diodes (LED) RoHS",
"minImage":"https://assets.lcsc.com/images/lcsc/96x96/20180914_Hubei-KENTO-Elec-KT-0603R_C2286_front_10.jpg",
"minPresaleNumber":4000,
"minPresalePrice":null,
"minPurchaseNum":4000,
"overseasStockCount":399792,
"preMinPurchaseNum":null,
"prices":null,
"secondTypeNameEn":"Light Emitting Diodes (LED)",
"stockCount":399792,
"storyGoods":true,
"warehouseCode":"sz",
"warehouseName":"深圳"
},
"message":null
}
I implemented the use of the API and it works but does not line up with what JLC's Website calculates for some reason:
Dummy PCB, 1 LED (C2286), 40 Resistors (C25804)
The leastnumber for both is 20 so the led gets the leastprice of 0.152, the resistors the regular price of 0.0025
5 Assembled PCBs should calculate like this:
1x 0.152 + 40x 0.0025 = 0.152 + 0.1 = 0.252 x 5 = 1.26
But JLC's Website gives me totally wrong number for the parts count and a much lower parts cost for some unknown reason:
20x LED seems ok, because thats the least number and the price of 0.152 fits also 206x Resistor does not fit at all, we have just 200 Resistors, but their price for the 206 fits with 0.5150
Oh man, it just made click!
I cannot simply multiply the price for one pcb by 5 because the leastnumber
for the led is 20 which is < the led count on 5 PCBs so we get the leastprice
just once and not 5 times 🤦🏽♂️
What do you guys mean, should we always calculate the price for 5 assembled pcbs to get a correct sum?
Edit:
I did just that and the price lines up with the website (if they fix their part count issue):
We could also calculate the cost for the SMT assembly:
The number of solder joints is available from the database 😀
It makes sense to calculate for the 5PCBs since you can't order fewer, but then you can also present that number divided by 5 to show how much it's per board.
@arturo182 Indeed, that sound right!
I've implemented the solderjoint x partcount x 0.0015 x 5
calculation as well, but again, I get a different result that is correct in my eyes 😕
LED: 2 x 1 x 0.0015 = 0.003 x 5 = 0.015
Resistors: 2 x 40 x 0.0015 = 0.12 x 5 = 0.60
I guess the calculate the assembly fee even if the parts are not populated. 20 LEDs are charged, but just 5 are really mounted, so I guess thats where the difference comes from ...
Ouch, so you're paying them for throwing out the extra LEDs :sweat_smile:
I'll close this for now as its unrealistic to get this right without proper API access.
At the moment we calculate the component costs by multiplying the partcount x part price and even take price graduation into account. But if you upload the BOM / CPL you will get a completely different price. This is caused by the JLCPCB pricing where you have to buy a minimum number of a cirtain component.
For example you have a PCB with just 1 LED on it, a 0603. We select the LCSC number C2286 which has a cost of $0.007384615 per piece for 1 up to 199 pieces according to the CSV file.
The website already shows a slightly different price:
You would think ok, $0.007384615 x 5 = $0.036923075 so approximately $0.04 If you uplad the Gerbers + BOM + CPL the website tells you
"For qty≤20,charges a fixed fee $0.1520"
This important piece of information however is not included in the CSV 😕
So all the calculated prices are wrong until we somehow can optain this information for the calculation.