Giter Site home page Giter Site logo

image2schematic's People

Contributors

amirmarsh avatar antios avatar obaidashraf avatar s39674 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

image2schematic's Issues

KiCAD chip database lacking info

Right now, in Dev - EasyOCR branch, we send the chip detected text to skidl search() to query KiCAD chip pinout database (more info: https://devbisme.github.io/skidl/#finding-parts). But that database often doesn't support medium-to-large chips like micro processors. Does anyone know of a good database that does have support for those chips and python can interact with it? Thanks!

Extracting pin information from datasheets

Currently, in branch: Dev_fetchViaHTTP_fix#15 we query www.octopart.com to get the chip's datasheet. In order to obtain the pin information, we need to analyze the pdf. Datasheets that have a dedicated pin table, like this:

https://datasheet.octopart.com/TC1427CPA-Microchip-datasheet-22875.pdf
drawing

Are quite easy to process using PyPDF2:

response = requests.get(FirstBestDataSheetUrl)
reader2 = PdfReader(io.BytesIO(response.content))
if len(reader2.pages) > 0:
    for page in reader2.pages:
        if "PIN FUNCTION TABLE" in page.extract_text():
            print(page.extract_text())
# print:
1 NC No connection.
2 IN A Control input A, TTL/CMOS compatible logic input.
3 GND Ground.
4 IN B Control input B, TTL/CMOS compatible logic input.
5 OUT B Output B, CMOS totem-pole output.
6V
DDSupply input, 4.5V to 16V.
7 OUT A Output A, CMOS totem-pole output.
8 NC No connection.

The problem is when we encounter PDFs that don't use a pin function table but instead use this form:
image
https://www.digchip.com/datasheets/download_datasheet.php?id=467924&part-number=MC74HC589A&type=pn2

Any ideas on how to deal with that?

Rotate image function

Does anyone know a function that will take an image, an angle, and will return the image rotated by that angle?

Better format for Points file

Right now the points file is not looking too good:

Point: [435,479] connected to: (191,171)
Point: [435,466] connected to: (191,144)
Point: [435,453] connected to: (191,117)
Point: [435,439] connected to: (191,91)
Point: [435,426] connected to: (191,64)
Point: [436,412] connected to: (191,37)
ATtiny841-S | 6/PA7/BIDIRECTIONA | [190,171] connected to: (435,479)
ATtiny841-S | 5/PB2/BIDIRECTIONA | [190,144] connected to: (435,466)
ATtiny841-S | 4/~{RESET}/PB3/BIDIRECTIONA | [190,117] connected to: (435,453)
ATtiny841-S | 3/XTAL2/PB1/BIDIRECTIONA | [190,90] connected to: (435,439)
ATtiny841-S | 2/XTAL1/PB0/BIDIRECTIONA | [190,64] connected to: (435,426)
ATtiny841-S | 1/VCC/POWER-I | [190,37] connected to: (435,406)

I want to run it through some function that will format it nicely, something like this:

Point: [435,479]                                       =>     connected to: (191,171)
Point: [435,466]                                       =>     connected to: (191,144)
Point: [435,453]                                       =>     connected to: (191,117)
Point: [435,439]                                       =>     connected to: (191,91)
Point: [435,426]                                       =>     connected to: (191,64)
Point: [436,412]                                       =>     connected to: (191,37)
ATtiny841-S | 6/PA7/BIDIRECTIONA | [190,171]           =>     connected to: (435,479)
ATtiny841-S | 5/PB2/BIDIRECTIONA | [190,144]           =>     connected to: (435,466)
ATtiny841-S | 4/~{RESET}/PB3/BIDIRECTIONA | [190,117]  =>     connected to: (435,453)
ATtiny841-S | 3/XTAL2/PB1/BIDIRECTIONA | [190,90]      =>     connected to: (435,439)
ATtiny841-S | 2/XTAL1/PB0/BIDIRECTIONA | [190,64]      =>     connected to: (435,426)
ATtiny841-S | 1/VCC/POWER-I | [190,37]                 =>     connected to: (435,406)

Any ideas?

ConnectionFinding.py error. Can't find KICAD environment variables

I am getting the below error when I try to execute ConnectionFinding.py with default conditions:

image

Below are the logs:

PS E:\Work\Image2schematic> & C:/Python310/python.exe e:/Work/Image2schematic/ConnectionFinding.py
WARNING: KICAD_SYMBOL_DIR environment variable is missing, so the default KiCad symbol libraries won't be searched. @ [E:\Work\Image2schematic<frozen importlib._bootstrap_external>:883=>E:\Work\Image2schematic<frozen importlib._bootstrap>:241]
looping over contours
Approx: 4
Area: 10143.0
found ic at: 114,37 to: 178,199
Chip name: MCU_Microchip_ATtiny
Pins:
right line x of Ic: 178
WARNING: Could not load KiCad schematic library "MCU_Microchip_ATtiny", falling back to backup library. @ [e:\Work\Image2schematic\ConnectionFinding.py:198]
Traceback (most recent call last):
File "e:\Work\Image2schematic\ConnectionFinding.py", line 209, in
while f"/{i}/" not in CurrentICqueryResult[i]:
IndexError: list index out of range
PS E:\Work\Image2schematic> & C:/Python310/python.exe e:/Work/Image2schematic/ConnectionFinding.py
WARNING: KICAD_SYMBOL_DIR environment variable is missing, so the default KiCad symbol libraries won't be searched. @ [E:\Work\Image2schematic<frozen importlib._bootstrap_external>:883=>E:\Work\Image2schematic<frozen importlib._bootstrap>:241]
looping over contours
Approx: 4
Area: 10143.0
found ic at: 114,37 to: 178,199
Chip name: MCU_Microchip_ATtiny
Pins:
right line x of Ic: 178
WARNING: Could not load KiCad schematic library "MCU_Microchip_ATtiny", falling back to backup library. @ [e:\Work\Image2schematic\ConnectionFinding.py:198]
Traceback (most recent call last):
File "e:\Work\Image2schematic\ConnectionFinding.py", line 209, in
while f"/{i}/" not in CurrentICqueryResult[i]:
IndexError: list index out of range

The error seems to be related with skidl package .. Is there any installation steps which I missed?

Thanks !!

Say hello, and this is a good idea if the project works well

Hi S39674:

This is really a good project which I'm seeking for .

I'm working on the same , but it is hard to find a good solution .

Your idea is very good , I there any progress on this project .

I'm looking forward for your progress ,Thanks ..

Counting IC pins

If we don't manage to obtain a datasheet for some chip, as a last fall back we should count how many pins the chip have. Can someone write a function that will take an IC image as an input and will output the number of pins in it?
example:
ic10

output: 16

Note: I have tried using color range but it didn't work well.

Thanks!

Switching to classes

I want to switch to using class so i will have better control over the link between IC and the points that are connected to it. Using classes also gives me the ability to save the IC/points info in a quicker and easier to work with format.

I started a new branch for this new and important step of this project, add added point.py and chip.py which include the minimum baseline.

Any suggestions?

Updating DetectICsSilk()

The function that finds ICs Silk screen, DetectICsSilk() has a very hard time finding ICs mainly because of a bad mask.

with the new example: Board9.png:

Original_Image_screenshot_

I get this mask:

mask_screenshot

I want the program itself to figure out the best mask based on the amount of ICs it found with each tested mask.

Any ideas?

Replace complicated find() with Regex

In PcbFunctions.py:

while(end_bracket_index != len(EBP_String)): # not really necessary
start_bracket_index = EBP_String.find("[", end_bracket_index)
middle_index = EBP_String.find(",", start_bracket_index)
# if not the +1 it would give the same position
end_bracket_index = EBP_String.find("]", end_bracket_index+1)
#print("start_bracket_index: ", start_bracket_index, " middle_index: ",
# middle_index, " end_bracket_index: ", end_bracket_index)
if (start_bracket_index == -1): # if not found
break
else:
EntireBoardPoints = np.append(
EntireBoardPoints, [[int(EBP_String[(start_bracket_index+1): (middle_index)]),
int(EBP_String[(middle_index+1): (end_bracket_index)])]], axis=0) # not sure why but this form works
return EBP_String, EntireBoardPoints

It basically just tries to find this form of text: [x,y]; Could someone write a simple regex to replace that?

Crop image function

Does anyone know a function that will take an image, two x and y coordinates and will return a croped image based on those coordinates?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.