bartebor / eggbot_extensions

Modifications of official EggBot Inkscape extension to support EggDuino
5 stars 2 forks source link

Erros with serial port recognition with EggDuino in Inkscape extention #1

Closed BramImke closed 8 years ago

BramImke commented 9 years ago

After a lot of reading I can't find the source of errors in Inkscape after installing this extention. I have the Bartebor sketch in a Arduino Nano (both with FTD chip or CH340G chip and two Easydrivers controlling the steppers. When using the serial monitor the setup runs perfectly on the EBB commands. Movement is very smooth.

But when using the Inkscape extention I get a set or error regarding eggbot.py.

Please help because Easter is comming :-)

Error from InkScape:

Traceback (most recent call last): File "eggbot.py", line 1436, in e.affect() File "C:\Program Files\Inkscape\share\extensions\inkex.py", line 268, in affect self.effect() File "eggbot.py", line 329, in effect self.EggbotOpenSerial() File "eggbot.py", line 1324, in EggbotOpenSerial self.serialPort = self.getSerialPort() File "eggbot.py", line 1386, in getSerialPort for strComPort in eggbot_scan.findEiBotBoards(): File "C:\Program Files\Inkscape\share\extensions\eggbot_scanwin32.py", line 6, in findEiBotBoards hKey = _winreg.OpenKey( hReg, r"SYSTEM\CurrentControlSet\Enum\USB\VID_04D8&PID_FD92" ) WindowsError: [Error 2] The system cannot find the file specified

bartebor commented 9 years ago

Hi!

Looks like you are using Windows and I am on Linux, but let's try to get you going :)

Your traceback says that there is problem with autodetecting original eggbot board. As I understand the VID/PID pair is used by original EbiBoard and since you have an arduino it does not match. Autodetection is performed in eggbot_scanwin32.py. There are two methods - one for original EbiBoard which fails and the other, scanning available serial ports. Let's comment out failing method and see if this helps. Open eggbot_scanwin32.py and near the end of file comment out three lines:

if __name__ == '__main__':
#        print "Looking for EiBotBoards"
#        for port in findEiBotBoards():
#               print "  ", port

        print "Looking for COM ports"
        for port in findPorts():
                print "  ", port

Reload inkscape and check if it works. If it does not, you can try Cocktail Yogi's solution, where autodetection is completely bypassed. Let me know of your progress - maybe I will be able to fix the code or at least update the docs.

Happy Easter!

BramImke commented 9 years ago

Hi Bartebor,

Many many thanks for trying to help us. I'm building the EggDuino with my Son Bram (11y) and it's a bit frustrating since we don't master Python and we can control the Eggbot from the serial monitor in the Arduino IDE.

I did the modifications you suggested but with the same response form Inkscape. The original EggDuino extension doesn't run also. Wouldn't it possible to fix the extension to a fixed com port nr. ? Maybe a stupid suggestion ....

Kind regards,

Frank and Bram

bartebor commented 9 years ago

Today I booted Windows in the hope of solving your issue :) I installed various versions of inkscape and eggbot extensions, but I could not get it working at all. There are no logs or warning messages so I am much further from the target then you are I suppose.

Nevertheless I have two more modifications for you to try.

First, comment out following lines in file eggbot.py (1386-1390 in my version):

        # Try any devices which seem to have EBB boards attached
#       for strComPort in eggbot_scan.findEiBotBoards():
#           serialPort = self.testSerialPort( strComPort )
#           if serialPort:
#               self.svgSerialPort = strComPort
#               return serialPort

I hope this time it will work. If it does not, let's try to bypass autodetection. Check your COM port name in Device Manager or Arduino IDE (my board appears as COM51) and change one line in eggbot.py (1381) like so:

        # Before searching, first check to see if the last known
        # serial port is still good.

#       serialPort = self.testSerialPort( self.svgSerialPort )
        serialPort = self.testSerialPort( "COM51" )
        if serialPort:
            return serialPort

By the way send me some details of your setup (windows version, inkscape version, extensions folder location), so I could compare that with mine.

Good luck for you both!

BramImke commented 9 years ago

Hi Bartebor,

Well, still no luck but the response from Inkscape changed. That counts for something ;-)

Traceback (most recent call last): File "eggbot.py", line 1436, in e.affect() File "C:\Program Files\Inkscape\share\extensions\inkex.py", line 268, in affect self.effect() File "eggbot.py", line 329, in effect self.EggbotOpenSerial() File "eggbot.py", line 1324, in EggbotOpenSerial self.serialPort = self.getSerialPort() File "eggbot.py", line 1381, in getSerialPort serialPort = testSerialPort( "COM16" ) NameError: global name 'testSerialPort' is not defined

Maybe a bit late to mention but is it a problem I edit the .py files with Wordpad?

I'm using Arduino Nano original and the imitation with the other USB/serial chip with drivers. Autoreset still in place.

I'm using Windows 7 Home Premium SP1 with Inkscape 0.91 r13725

All Inkscape stuff extentions are in : C:\Program Files\Inkscape\share\extensions

Kind regards,

Frank and Bram

bartebor commented 9 years ago

Eggbot software version 2.4.0 is not compatible with Inkscape 0.91. You can try downgrading to 0.48.5, maybe this will help. I also recommend to start from scratch with fresh version of all eggbot python files - the error you provided makes no sense in our situation. The only thing that comes to my mind is you (or WorPad) changed indentation. In Python, it is very important to use proper whitespace and indentation - it is part of syntax. So it is best to edit those files with "safe" editor. You can try for example Notepad++ or Programer's Notepad - let's see what happens then.

BramImke commented 9 years ago

Hi Bartebor,

I've tried your modification on a Arduino Nano with your EggDuino version since I've at work late without the complete EggBot. But it seems to work. I can't check the any motors etc since I have non over here. I installed the older version off InkScape 0.48 and your extentions - No luck. Then installed the Eggbot driver EggBot_250a.exe - no luck. Again installed your extention and did the first modification to eggbot_scanwin32.py as described above, - no luck.

Then..... :-) suspense I installed the first part of your second suggestion in eggbot.py AND BINGO. I get response and also a version feedback. Can't wait to try it when I come home and tell my boy in the morning.

Fingers crossed.

Frank

bartebor commented 9 years ago

Hi guys,

Great news! I'm glad to hear that it finally worked. This is the first step, now you will have to try real plotting :-)

On the options page, along with others, you have two checkboxes specific to Arduino. Feel free to experiment and use settings that work best with your hardware.

I'm planning to update the code - fix Windows support and incorporate changes from version 2.5, but most probably I will not have enough free time before Easter. And I have to plot some eggs, too :-)

Remember to give feedback how it worked with hardware connected.

Best wishes, Bartek

BramImke commented 9 years ago

Sorry. It's going to take another day. I've blown the stepper drivers. :-( These EasyDrivers are 15Volts in stead of 30Volts.

Frank

BramImke commented 9 years ago

Bartek rules!! It's working perfectly.

Installed new drives and we produced a perfect egg right away. My son is over the moon.

Good that science connects people.

Many many thanks again,

Frank and Bram

bartebor commented 9 years ago

It's great we made it before holidays. Should you have any further problems feel free to contact me.

Have fun with your new toy tool ;-)

djinn5150 commented 8 years ago

So here I am approx 11 months later coming into this, as well shooting for an easter build, and having close to the same issue. It started the same as the OP. After following all suggestions I am now just getting "Unable to find an Eggbot on any serial port. :(" I can tell it's scanning the ports as I see the UNO reboot and attempt to communicate. If i connect via a terminal and send v or other commands I get responses so I know the board is flashed properly. I'm on Windows 10, using inkscape .48 and/or .91 in different installation directories. I also tried on a linux build machine with similar results. I am definately more fluent in windows but would prefer to get this running on my chromixium laptop

bartebor commented 8 years ago

Hi!

Since you observed that Uno is restarting it is possible that autoreset is main source of problems. You can try to connect 10uF capacitor between RESET and +5V (positive terminal to +5V). This should disable autoreset and make Uno respond to autodetection properly. Remember to disconnect capacitor while programming or board will not be recognized.

Hope this helps, Bartek

djinn5150 commented 8 years ago

I will now walk away shaking my head in shame, I should have caught that in the build notes. That did the trick, now to finalize my build. Thank you so much

bartebor commented 8 years ago

You are welcome :)

MrBancroft1 commented 6 years ago

I am hoping that you can help solve my issue as well. I am using an Arduino Mega and I was having the same problem as Bramlmke, I installed the 4.8 version of inkscape I am running eggbot extensions version 2.3..4 and I got a similar error as Bramlmke. I made the modification to the extension code as you have listed above and now my error message has changed to "Unable to find an Eggbot on any serial port. :( Error reading serial data." I shut off my firewall but nothing. I also tested my hardware using the Arduino serial monitor. I am using the JJrobots brainshield if that makes a difference. Any guidence you can give would he helpful, I feel like I am so close.

Thanks in advance!

suculent commented 6 years ago

I had similar issue with following setup: MacBook Pro 2017 (with USB-C to USB-A converter) Inkscape 0.92

It could not find the device on USB. I've logged available ports in findport, and it appears, that the name (port[0]) equals to value in About This Mac > System Report > USB (USB2.0-Serial) as well as the VID/PID value ( Product ID: 0x7523, Vendor ID: 0x1a86).

I've made local change as follows in ebb_serial.py to make it work:

def findPort():
    #Find a single EiBotBoard connected to a USB port.
    try:
        from serial.tools.list_ports import comports
    except ImportError:
        comports = None
        return None
    if comports:
        comPortsList = list(comports())
        EBBport = None
        for port in comPortsList:
            if port[1].startswith("USB2.0-Serial"):
                EBBport = port[0]   #Success; EBB found by name match.
                break   #stop searching-- we are done.
        if EBBport is None:
            for port in comPortsList:
                if port[2].startswith("USB VID:PID=1A86:7523"):
                    EBBport = port[0] #Success; EBB found by VID/PID match.
                    break   #stop searching-- we are done.

Also, the device firmware responds "hi" on first request, instead of anything starting with "EBB", so I've also changed the line 70 from "EBB" to "hi". If course this could be done in the firmware as well, but I've left it untouched so far.

def testPort( comPort ):
    '''
    Return a SerialPort object
    for the first port with an EBB (EiBotBoard; EggBot controller board).
    YOU are responsible for closing this serial port!
    '''
    if comPort is not None:
        try:
            serialPort = serial.Serial( comPort, timeout=2.0 ) 
            serialPort.write( 'v\r' )
            strVersion = serialPort.readline()
            if strVersion and strVersion.startswith( 'hi' ): # change here
                return serialPort

            serialPort.write( 'v\r' )
            strVersion = serialPort.readline()
            if strVersion and strVersion.startswith( 'EBB' ):
                return serialPort
            serialPort.close()
        except serial.SerialException:
            pass
        return None
    else:
        return None
rhayader7 commented 2 years ago

Been trying to install upload the code from bartebor but it won't even compile. Getting the following error message on Arduino IDE running on windows 10. Any hints highly appreciated. Thank you.

Arduino: 1.8.16 (Windows 10), Board: "Arduino Uno"

EggDuino:112:37: error: 'doTogglePen' was not declared in this scope

Button penToggle(penToggleButton, doTogglePen);

                                 ^~~~~~~~~~~

EggDuino:113:37: error: 'toggleMotors' was not declared in this scope

Button motorsToggle(motorsButton, toggleMotors);

                                 ^~~~~~~~~~~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\EggDuino.ino:113:37: note: suggested alternative: 'rotMotor'

Button motorsToggle(motorsButton, toggleMotors);

                                 ^~~~~~~~~~~~

                                 rotMotor

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino: In function 'void queryPen()':

Functions:30:2: error: 'sendAck' was not declared in this scope

sendAck();

^~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino: In function 'void queryButton()':

Functions:36:2: error: 'sendAck' was not declared in this scope

sendAck();

^~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino: In function 'void queryLayer()':

Functions:41:3: error: 'sendAck' was not declared in this scope

sendAck();

^~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino: In function 'void setLayer()':

Functions:51:5: error: 'sendAck' was not declared in this scope

 sendAck();

 ^~~~~~~

Functions:54:4: error: 'sendError' was not declared in this scope

sendError();

^~~~~~~~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino:54:4: note: suggested alternative: 'perror'

sendError();

^~~~~~~~~

perror

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino: In function 'void queryNodeCount()':

Functions:59:2: error: 'sendAck' was not declared in this scope

sendAck();

^~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino: In function 'void setNodeCount()':

Functions:70:3: error: 'sendAck' was not declared in this scope

sendAck();

^~~

Functions:73:3: error: 'sendError' was not declared in this scope

sendError();

^~~~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino:73:3: note: suggested alternative: 'perror'

sendError();

^~~~~

perror

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino: In function 'void nodeCountIncrement()':

Functions:78:2: error: 'sendAck' was not declared in this scope

sendAck();

^~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino: In function 'void nodeCountDecrement()':

Functions:83:2: error: 'sendAck' was not declared in this scope

sendAck();

^~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino: In function 'void stepperMove()':

Functions:92:5: error: 'sendError' was not declared in this scope

 sendError();

 ^~~~~~~~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino:92:5: note: suggested alternative: 'perror'

 sendError();

 ^~~~~~~~~

 perror

Functions:98:5: error: 'sendAck' was not declared in this scope

 sendAck();

 ^~~~~~~

Functions:103:3: error: 'sendAck' was not declared in this scope

sendAck();

^~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino: In function 'void stepperMoveQueryButton()':

Functions:112:5: error: 'sendError' was not declared in this scope

 sendError();

 ^~~~~~~~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino:112:5: note: suggested alternative: 'perror'

 sendError();

 ^~~~~~~~~

 perror

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino: In function 'void setPen()':

Functions:209:5: error: 'sendError' was not declared in this scope

 sendError();

 ^~~~~~~~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino:209:5: note: suggested alternative: 'perror'

 sendError();

 ^~~~~~~~~

 perror

Functions:218:5: error: 'sendAck' was not declared in this scope

 sendAck();

 ^~~~~~~

Functions:222:4: error: 'sendAck' was not declared in this scope

sendAck();

^~~~~~~

Functions:225:4: error: 'sendError' was not declared in this scope

sendError();

^~~~~~~~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino:225:4: note: suggested alternative: 'perror'

sendError();

^~~~~~~~~

perror

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino: In function 'void togglePen()':

Functions:240:3: error: 'sendAck' was not declared in this scope

sendAck();

^~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino: In function 'void enableMotors()':

Functions:268:16: error: 'sendAck' was not declared in this scope

            sendAck();

            ^~~~~~~

Functions:274:16: error: 'sendError' was not declared in this scope

            sendError();

            ^~~~~~~~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino:274:16: note: suggested alternative: 'perror'

            sendError();

            ^~~~~~~~~

            perror

Functions:281:16: error: 'sendAck' was not declared in this scope

            sendAck();

            ^~~~~~~

Functions:287:16: error: 'sendError' was not declared in this scope

            sendError();

            ^~~~~~~~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino:287:16: note: suggested alternative: 'perror'

            sendError();

            ^~~~~~~~~

            perror

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino: In function 'void stepperModeConfigure()':

Functions:326:16: error: 'storePenDownPosInEE' was not declared in this scope

            storePenDownPosInEE();

            ^~~~~~~~~~~~~~~~~~~

Functions:327:16: error: 'sendAck' was not declared in this scope

            sendAck();

            ^~~~~~~

Functions:330:16: error: 'storePenUpPosInEE' was not declared in this scope

            storePenUpPosInEE();

            ^~~~~~~~~~~~~~~~~

Functions:346:16: error: 'sendError' was not declared in this scope

            sendError();

            ^~~~~~~~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino:346:16: note: suggested alternative: 'perror'

            sendError();

            ^~~~~~~~~

            perror

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino: In function 'void unrecognized(const char*)':

Functions:357:3: error: 'sendError' was not declared in this scope

sendError();

^~~~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino:357:3: note: suggested alternative: 'perror'

sendError();

^~~~~

perror

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Functions.ino: In function 'void ignore()':

Functions:361:3: error: 'sendAck' was not declared in this scope

sendAck();

^~~

C:\Users\User\Desktop\EggDuino-master(3)\EggDuino\Helper_Functions.ino: In function 'void initHardware()':

Helper_Functions:5:3: error: 'loadPenPosFromEE' was not declared in this scope

loadPenPosFromEE();

^~~~

exit status 1

'doTogglePen' was not declared in this scope

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.