cocktailyogi / eggduino Goto Github PK
View Code? Open in Web Editor NEWArduino Firmware for Spherebot / Eggbot integration in Inkscape
License: MIT License
Arduino Firmware for Spherebot / Eggbot integration in Inkscape
License: MIT License
Hi i want to apologize that i am creating this as an issue.
But i have a question. I am trying to use your firmware (from master branch), with small modification (changed only PINs and small modification in initHardware function), because only CNC shield what i have at home was Ramps 1.4, but i was not able to have it up and running. Inkscape is comunicating with Arduino, i am able to get Firmware version, i have using motors X and Z and servo0 on Ramps, i have placed all 3 jumpers under each driver to setup microsteps. This is my pin configuration:
EggDuino.ino
//Rotational Stepper Z (Egg):
#define step1 Z_STEP_PIN // 46
#define dir1 Z_DIR_PIN // 48
#define enableRotMotor Z_ENABLE_PIN // 62
#define rotMicrostep 16 //MicrostepMode, only 1,2,4,8,16 allowed, because of Integer-Math in this Sketch
//Pen Stepper X:
#define step2 X_STEP_PIN // 54
#define dir2 X_DIR_PIN // 55
#define enablePenMotor X_ENABLE_PIN // 38
#define penMicrostep 16 //MicrostepMode, only 1,2,4,8,16 allowed, because of Integer-Math in this Sketch
#define servoPin SERVO0_PIN //Servo - Pin 11
For initHardware()
i tried both options, first i tried to have SPMCSR &= ~SPMEN;
instead of ~SELFPRGEN
, then i tried to remove both definitions.
Helper_Functions.ino
void initHardware(){
// enable eeprom wait in avr/eeprom.h functions
//SPMCSR &= ~SELFPRGEN;
//SPMCSR &= ~SPMEN;
...
But when i am trying to send any command from inkscape to Eggbot, nothing happens, servo or motors is not moving :(
My Setup is:
Any idea how i can debug and follow further?
Thanks for any advice!
I had the Problem hat I want to reverse the servo.
So I change the code in setPen --> Change Case0 to Case 1 und Case 1 to Case 0
void setPen(){
int cmd;
int value;
char *arg;
moveToDestination();
arg = SCmd.next();
if (arg != NULL) {
cmd = atoi(arg);
switch (cmd) {
case 1:
penServo.write(penUpPos);
penState=penUpPos;
break;
case 0:
penServo.write(penDownPos);
penState=penDownPos;
break;
default:
sendError();
}
}
char *val;
val = SCmd.next();
if (val != NULL) {
value = atoi(val);
sendAck();
delay(value);
}
if (val==NULL && arg !=NULL) {
sendAck();
delay(500);
}
// Serial.println("delay");
if (val==NULL && arg ==NULL)
sendError();
}
I can compile and upload the firmware to my old s3v3(168p) and nano(168p) !
I disable the auto-reset as the boards needed
I followed the https://www.youtube.com/watch?v=5CmjB4WF5XA to test the A4988 with s3v3&nano both work find
But I can never get any respond form termite-3.2 when typing v or anything else ,but the led on board did blink
I tried OS under win10,7,xp and there were no responded
can you tell me that this old Arduino can run this firmware or not , thanks alot
Hi,
this is my setup now:
ATmega328 on a breadboard, 16MHz
USB serial coverter with reset pin not conneted to ATmega
Eggduino in my ATmega
Inkscape extension 2.7.1
The problem:
Every time I try to plot or check version with Inkscape extension, the error is "Failed to connect to EggBot. :("
What I tried to do:
Traceback (most recent call last):
File "eggbot.py", line 1154, in
e.affect()
File "/usr/share/inkscape/extensions/inkex.py", line 268, in affect
self.effect()
File "eggbot.py", line 189, in effect
self.serialPort = ebb_serial.openPort()
File "/home/stefano/.config/inkscape/extensions/ebb_serial.py", line 85, in openPort
foundPort = findPort()
File "/home/stefano/.config/inkscape/extensions/ebb_serial.py", line 49, in findPort
if port[1].startswith("EiBotBoard"): #EiBotBoard
AttributeError: 'NoneType' object has no attribute 'startswith'
nothing happened, the errors are the same explained above.
I noticed that the serial tx rx LEDs on Arduino or USB-serial converter don't blink when I try to send commands so I think that the problem is a bad assignation of serial port
I cant find a 2.1 Inkscape extension so I cant try with the patch suggested by cocktailyogi.
Now I don't know what to do so I'm asking here is someone have some suggestions.
Thanks in advance
Alternative workaround:
Go to your Inkscape-Installationfolder and navigate to subfolder .\App\Inkscape\share\extensions open File "eggbot.py" in texteditor and search for: "self.svgSerialPort" around row 1348
Replace "self.svgSerialPort" in "line serialPort = self.testSerialPort( self.svgSerialPort )" with your COM-port-number.
COM1 is 0
COM2 is 1
COM3 is 2 etc....
example:
So if your arduino / eggduino is located at COM3 it should look like:
"line serialPort = self.testSerialPort(2)"
Had an issue where the motors would always spin in the one direction, regardless of sign of the move parameter passed. To make it work I had to remove the "abs" function in the speed calculations in "prepareMove".
Am using an AdaFruit motor shield, and amended code to initialise the AccelSteper library by passing in the step forward and step back functions from the Adafruit library.
Am still having an issue with the steps being too large, even though I am in micro step mode (can get smooth movement if I manually sent command).
Great job on the firmware!
I was wondering if you will implement servo rate(speed) and engraver commands? I am trying to do some engravings and the pen down speed can not be controlled, I looked the arduino sketch but can't find any implementation of rate adjustment!
Also I have built a micro engraver with a small rc plane esc/motor and would like to have a way to turn it on and off and control the speed with a pwm pin!
I am a RC enthusiast and have been for many years! I also am an electronics tech!
If you have any questions that I might be able to help you with configuring the firmware just let me know!
I wish my arduino code skills were as equal to my electronic skills! I praise people who can write code like you do!
Sincerely,
Greg
I've been having an issue getting the servo to respond. So far, I just haven't been able to get any movement out of it unless I upload different arduino code to test with, and I'm hoping you might be able to offer some insight.
I'm using this shield. I had initially been using it on A), but I thought that might have been getting a conflict. So I changed it to D10, but I haven't been able to get a successful move out of it.
This leads me to think that something in my settings must be off. When I have the eggduino firmware, should SP,1 or 0 move the servo? Same with TP? I know when I type them into the terminal, I get an OK, or the pen position (always 1).
If those commands should work, then maybe I have other settings that are off... It doesn't look like it, but in the EggDuino file, I see these variables....
// Variables... be careful, by messing around here, everything has a reason and crossrelations... int penMin=0; int penMax=0; int penUpPos=5; //can be overwritten from EBB-Command SC int penDownPos=20; //can be overwritten from EBB-Command SC
Should I start experimenting with them? If I should, do you have any advice on how much or little I should be adjusting them?
I've done very very little work with servos in the past, but have been able to get some working tests with separate code. So I'm not too sure what's causing the issues with this code yet. Like I said, any advice you can give me, I would hugely appreciate it.
Hello everyone.
I just graduate with this software and on my repository you can find a working version (2018) with inkscape plugin download.
I don't think there is a bug with the extensions, isn't just trying to find an EiBotBoard?
As we are using something else I tried to change the VID/PID number at line 6 of eggbot_scanwin32.py file to FTDI vendor ID and product ID as I am using arduino nano and it does the job:
hKey = _winreg.OpenKey( hReg, r"SYSTEM\CurrentControlSet\Enum\USB\VID_0403&PID_6001")
For Linux I just had to change from "ttyACM" to "ttyUSB" at line 28 of eggbot_scanlinux.py file.
BTW, great firmware thanks for sharing.
I use an Arduino Uno & Linux 15.10.
The fact is that the ebb_serial.py script is looking for a serial port which is named 'EiBotBoard'.
But with an Arduino, my port is named 'Arduino Uno'.
To solve this, i've replaced
if port[1].startswith("EiBotBoard"):
by if port[1].startswith("Arduino Uno"):
in egg_serial.py
Arduino no longer handles inline functions the same.
To make this code work, I had to add the following to the EggDuino.ino
// Function prototypes
void sendAck(void);
void sendError(void);
void loadPenPosFromEE(void);
void storePenUpPosInEE(void);
void storePenDownPosInEE(void);
Hi Cocktailyogi,
do you think that it's possible to use an l293d motor shield for this project?
I think that this shield is perfect: 2 stepper, servo ports and it's incredibily cheap on ebay...
Thank you!
I got many of these messages, to solve it i commented these lines in eggbot.py
if strButton[0] == '0':
pass #button not pressed
else:
#mdeudon 20 juin 2016 disabled
#self.svgNodeCount = self.nodeCount;
#if strButton[0] == 'O' : inkex.errormsg('Ceci est un O et non un 0') #mdeudon
#inkex.errormsg('PrgButton value=' + strButton[0])
#inkex.errormsg( 'Plot paused by button press after node number ' + str( self.nodeCount ) + '.' )
#inkex.errormsg( 'Use the "resume" feature to continue.' )
#self.penUp() # Should be redundant...
#self.engraverOff()
#self.bStopped = True
return
Explanation : I've noticed that sometime the software received an 'O' even if the prg button is disabled. I don't know why ?
I was able to compile and upload sketch, but when i try to send "v" (or anything else) by IDE SerialMonitor i do not get any responce. ( I have ch340g clone of arduino, but when i was doodling with it on my simple sketches SerialMonitor accepted commands and gave responces) Anyone could give at leat a clue what could be a problem?
Tried this with eggbot Inkscape plugins version 2.2.6 with no joy. Made changes in eggbot.py as shown (on a different line# )
What version plugins did you use?
Thanks for your great work on this.
So is it normal for the pen arm to jerk around? I can't seem to get a nice fluid movement. I'm using 16th micro steps on my cnc shield and tried running my timings are 300, 200 and 100 but nothing really helps. I've also adjusted my motor current and that didn't improve anything either. I'm wondering how people are able to get nice smooth lines without the "stepping". Running version 1.6a with inkscape .92
Hi, I try use adafruit motor shield for eggduino, make some changes like this:
// two stepper motors one on each port
AF_Stepper rotAFMotor(200, rotMotorNumber);
AF_Stepper penAFMotor(200, penMotorNumber);
// you can change these to DOUBLE or INTERLEAVE or MICROSTEP!
// wrappers for the first motor!
void forwardstepRot() {
rotAFMotor.onestep(FORWARD, SINGLE);
//rotAFMotor.step(1, FORWARD, SINGLE);
}
void backwardstepRot() {
rotAFMotor.onestep(BACKWARD, SINGLE);
//rotAFMotor.step(1, BACKWARD, SINGLE);
}
// wrappers for the second motor!
void forwardstepPen() {
penAFMotor.onestep(FORWARD, SINGLE);
//penAFMotor.step(1, FORWARD, SINGLE);
}
void backwardstepPen() {
penAFMotor.onestep(BACKWARD, SINGLE);
//penAFMotor.step(1, BACKWARD, SINGLE);
}
//make Objects
AccelStepper rotMotor(forwardstepRot, backwardstepRot);
AccelStepper penMotor(forwardstepPen, backwardstepPen);
but it move motor in one direction
I remove abs in lines like that:
rotMotor.setSpeed( abs( (float)rotStepsEBB * (float)1000 / (float)duration ) );
and change motorsOn and motorsOff functions
void motorsOff() {
rotAFMotor.release();
penAFMotor.release();
//digitalWrite(enableRotMotor, HIGH);
//digitalWrite(enablePenMotor, HIGH);
motorsEnabled = 0;
}
void motorsOn() {
//digitalWrite(enableRotMotor, LOW) ;
//digitalWrite(enablePenMotor, LOW) ;
motorsEnabled = 1;
}
But it not work correctly, I looking to AccelStepper, how it work and I think motor rotation need deeply change for adafruit motor shield because pin mode and func mod is very different
// 0 pin step function (ie for functional usage)
void AccelStepper::step0(long step)
{
if (_speed > 0)
_forward();
else
_backward();
}
in this case _speed >0 allways true (need remove abs)
// 1 pin step function (ie for stepper drivers)
// This is passed the current step number (0 to 7)
// Subclasses can override
void AccelStepper::step1(long step)
{
// _pin[0] is step, _pin[1] is direction
setOutputPins(_direction ? 0b10 : 0b00); // Set direction first else get rogue pulses
setOutputPins(_direction ? 0b11 : 0b01); // step HIGH
// Caution 200ns setup time
// Delay the minimum allowed pulse width
delayMicroseconds(_minPulseWidth);
setOutputPins(_direction ? 0b10 : 0b00); // step LOW
}
So, do you have any ideas?
Line 24 in Functions.ino is:
if (penState=penUpPos)
Should be:
if (penState==penUpPos)
Hi,
i got all the errors when i try to compile the code.
Arduino: 1.6.8 (Windows 7), Board: "Arduino/Genuino Uno"
E:\Downloads\EggDuino\Functions.ino: In function 'void queryPen()':
Functions:29: error: 'sendAck' was not declared in this scope
sendAck();
^
E:\Downloads\EggDuino\Functions.ino: In function 'void queryButton()':
Functions:34: error: 'sendAck' was not declared in this scope
sendAck();
^
E:\Downloads\EggDuino\Functions.ino: In function 'void queryLayer()':
Functions:40: error: 'sendAck' was not declared in this scope
sendAck();
^
E:\Downloads\EggDuino\Functions.ino: In function 'void setLayer()':
Functions:50: error: 'sendAck' was not declared in this scope
sendAck();
^
Functions:53: error: 'sendError' was not declared in this scope
sendError();
^
E:\Downloads\EggDuino\Functions.ino: In function 'void queryNodeCount()':
Functions:58: error: 'sendAck' was not declared in this scope
sendAck();
^
E:\Downloads\EggDuino\Functions.ino: In function 'void setNodeCount()':
Functions:69: error: 'sendAck' was not declared in this scope
sendAck();
^
Functions:72: error: 'sendError' was not declared in this scope
sendError();
^
E:\Downloads\EggDuino\Functions.ino: In function 'void nodeCountIncrement()':
Functions:77: error: 'sendAck' was not declared in this scope
sendAck();
^
E:\Downloads\EggDuino\Functions.ino: In function 'void nodeCountDecrement()':
Functions:82: error: 'sendAck' was not declared in this scope
sendAck();
^
E:\Downloads\EggDuino\Functions.ino: In function 'void stepperMove()':
Functions:93: error: 'sendError' was not declared in this scope
sendError();
^
Functions:97: error: 'sendAck' was not declared in this scope
sendAck();
^
E:\Downloads\EggDuino\Functions.ino: In function 'void setPen()':
Functions:129: error: 'sendError' was not declared in this scope
sendError();
^
Functions:136: error: 'sendAck' was not declared in this scope
sendAck();
^
Functions:140: error: 'sendAck' was not declared in this scope
sendAck();
^
Functions:145: error: 'sendError' was not declared in this scope
sendError();
^
E:\Downloads\EggDuino\Functions.ino: In function 'void togglePen()':
Functions:161: error: 'sendAck' was not declared in this scope
sendAck();
^
E:\Downloads\EggDuino\Functions.ino: In function 'void enableMotors()':
Functions:190: error: 'sendAck' was not declared in this scope
sendAck();
^
Functions:196: error: 'sendError' was not declared in this scope
sendError();
^
Functions:203: error: 'sendAck' was not declared in this scope
sendAck();
^
Functions:209: error: 'sendError' was not declared in this scope
sendError();
^
E:\Downloads\EggDuino\Functions.ino: In function 'void stepperModeConfigure()':
Functions:228: error: 'storePenDownPosInEE' was not declared in this scope
storePenDownPosInEE();
^
Functions:229: error: 'sendAck' was not declared in this scope
sendAck();
^
Functions:232: error: 'storePenUpPosInEE' was not declared in this scope
storePenUpPosInEE();
^
Functions:248: error: 'sendError' was not declared in this scope
sendError();
^
E:\Downloads\EggDuino\Functions.ino: In function 'void unrecognized(const char*)':
Functions:259: error: 'sendError' was not declared in this scope
sendError();
^
E:\Downloads\EggDuino\Functions.ino: In function 'void ignore()':
Functions:263: error: 'sendAck' was not declared in this scope
sendAck();
^
E:\Downloads\EggDuino\Helper_Functions.ino: In function 'void initHardware()':
Helper_Functions:5: error: 'loadPenPosFromEE' was not declared in this scope
loadPenPosFromEE();
^
exit status 1
'sendAck' was not declared in this scope
In Eggduino.ino the microstepping is already set to 16 microstepping.
I also have pulled all three MSx pins high on my breadboard. Still I get very jittery and stepped vertical lines. I use A4988 drivers and common 200 steps motors found in 3D printers.
I don't want to misuse the 'issues' system here for support requests but I don't know where to go else to get information directly from the creator of this firmware
@cocktailyogi
Even after the fix in eggbot.py I still get this error.
Am I supposed to have serial access without Inkscape? Using the Arduino Serial Monitor or Putty I am not able to get any connection. Still the servo runs hot. 55°C.
[SOLVED]
I have found that hardcoding the USB VID into eggbot_scanwin32.py make everything working!
You have to replace in line 6 in eggbot_scanwin32.py:
hKey = _winreg.OpenKey( hReg, r"SYSTEM\CurrentControlSet\Enum\USB\VID_2341&PID_0043" )
//this line above has already been modified with my Arduino Hardware ID
with your Arduino VID which can be obtained from Device Manager - Arduino - Details - Hardware ID
How to set parameters to adapt to different stepping motors with reduction ratio
Hello,
could you upload a read Hex-File for this application.
I don't want to install the hole arduino framework, because I'm using the atmel-studio.
Thank's
In the egg duino, I'm not sure what pins should be associated with enableRotMotor and enablePenMotor. Im using a motorshield for the A3967 Driver on This Shield. I can see the pins for the step and direction, but the enable pins have me a bit thrown. And help you can pass my way would be really appreciated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.