farmbot / farmbot-arduino-firmware Goto Github PK
View Code? Open in Web Editor NEWArduino firmware that executes g-code like commands over a serial line to move the FarmBot and operate the tool mount
License: MIT License
Arduino firmware that executes g-code like commands over a serial line to move the FarmBot and operate the tool mount
License: MIT License
Hi,
Did some research after our discussion in the comments last night.
Turns out that analogWrite cannot be used for servos, as the pulse widths and duty cycles are incompatible.
http://forum.arduino.cc/index.php/topic,5701.0.html
So I had a look around at how the merlin 3d printer firmware does it. They simply use the arduino servo library:
https://github.com/ErikZalm/Marlin/blob/Marlin_v1/Marlin/Marlin_main.cpp#L495
Servo servos[NUM_SERVOS];
servos[0].attach(SERVO0_PIN);
The Gcode they use is:
Do you reckon we can add this?
PS: What timers on the arduino are already used?
Use microstep and steps per mm settings to calculate step and distance parameter values. This will allow the firmware to accept parameters in step and mm units and will require fewer changes to other parameters when microstep settings change.
Parameter | old unit | new unit |
---|---|---|
MOVEMENT_STEP_PER_MM | microsteps per mm | steps per mm |
ENCODER_MISSED_STEPS_MAX | microsteps | steps |
ENCODER_SCALING | microsteps per encoder line | steps per encoder line |
ENCODER_MISSED_STEPS_DECAY | microsteps | steps |
MOVEMENT_STEPS_ACC_DEC | microsteps | mm |
MOVEMENT_MIN_SPD | microsteps per second | mm per second |
MOVEMENT_HOME_SPEED | microsteps per second | mm per second |
MOVEMENT_MAX_SPD | microsteps per second | mm per second |
MOVEMENT_AXIS_NR_STEPS | microsteps | mm |
when i send F21 216
(the param id doesn't matter) it returns R21 P0 V1
(the P<id>
part is always 0)
If z-axis is running smooth using high quality grease, the z-axis moves down due to gravity.
The stepper motors usually (CNC, 3d-printer) can be disabled and enabled. Have a look at http://reprap.org/wiki/G-code
In the disabled state, they can be moved freely, wherever in the enabled state, they are blocking. This seems to be a software issue as the enabled state should be the correct one. Several users are facing the issue in the Farmbot Europe community.
In standard g-code/CNC machines, there is usually support for arc commands that allow smooth circular movements. I think they're usually defined by a center coordinate and a radius.
This would be really nice for watering plants as they get bigger, in addition to watering at the center. Or for other operations such as weeding around a plant.
Could you tell us what process takes place in the calibration?
hi my friend bought a farmbot genesis, and found it moved too slow, well, if we replace the builtin arduino board to another one, they will become extreming fast, but lost acurracy.
currently i tried connect to that arduino directly with my pc and send gcode and other commands via serial console. the problem is they just act too slow while using G00 and G01.
i tried to add a duplicate PORTF |= B00000001;
in StepperControlAxis::setMotorStepWrite54
and it made the x axis moved faster twice, but it might not the a right solution, just need some technical expanation
The RAMPS shield does not provide pull up resistors for the limit switches so that needs to be done in software.
Currently, calibration is performed as: current position > find home > find max > go to home.
This should be changed to: current position > find max > find home. This will save time by eliminating one leg of the journey, which is significant for XL bots.
Currently, both our calibration and homing sequences "touch" the axis ends just a single time before turning around to go find the other axis end or calling the sequence complete.
Most 3D printers touch their axis ends multiple times during calibration and homing to maintain high precision without sacrificing speed: They move at full speed until an axis end is touched the first time, then they back up about a centimeter, and then they move towards and touch the axis end a second time at a slower speed. We could do the same thing.
More importantly though than improving precision and speed, this change would reduce the risk of a premature or erroneous stall causing FarmBot to incorrectly set the home position or axis length.
I suggest the following for both calibration and homing sequences:
This change would deprecate the Calibration Speed parameters in favor of max speed for the long legs and a percentage of max speed for the slower, second touches.
In the cnc world there is support to make an extra axis ..
To make a rotary tool in a flat bed cnc for example..
Would it be possible to add an extra axis to make it possible to travel between beds in the future?
Im thinking a carrige or similar that moves the gountry to another bed..
Regards
Marcus
it would be useful to know what causes a command failed
response
Hi i install new release and bot connect and disconect every 1 sec to api(log devise online, offline)
Previos version work normaly but more unhandled errors in logs
As there aren't any repositories for PCB design thought it would be best to open an issue in the repository which is closest.
Having version-controlled based repository may help certain users which want to test and build the PCBs in order to improve or adapt them to weird edge cases to have a repository specifically for PCBs which contain the source files (EAGLE, KiCad etc) and the Gerbers. That way users can use tools like kitspace to easily order components based on the BOM and Gerbers.
Existing CAD models can be found here but think that having a repository for will improve the update and development of PCB based designs from the community and may simplify your workload as well - https://genesis.farm.bot/v1.5/Extras/cad
Example repositories which do this well
Open source e-reader - here
Open source filament diameter checker - here
Would love to get your thoughts on this and would be happy to generate the Kitspace files if given Gerbers and an electronics BOM if any of the component suppliers you use are integrated into Kitspace.
My commands seem to be delayed by 30+ seconds. I tried rebuilding everything (rpi controller first, then Arduino) I was then getting the problems that these folks are having, where I can't successfully upload the sketch to the Arduino due to a timeout error. If I try pressing the reset button a few times and immedietely try uploading after, then it sometimes completes, but it still operates very slowly...
By that forum thread, it may be a issue with the bootloader in the Arduino, a clean power source problem, an issue with avrdude, or an FTDI driver issue.
The only other thing I can think of is that maybe the EEPROM got filled up and is causing errors? Does the arduino-controller currently clear the EEPROM on boot? http://arduino.cc/en/Tutorial/EEPROMClear
It seems like it would be nice if the G codes could be sent to the Arduino with the units in mm and for the Arduino to have a EEPROM stored configuration parameters with the conversion of mm to pulses with separate conversion factors for X, Y, and Z.
Perhaps I have just missed how this is all supposed to work as I am still getting up to speed on it.
Yesterday we found out that we will need a new Farmduino.
Searching for a solution about our Problem with getting our Farmbot started we got to this link:
There they are telling that you should buy a new Farmduino if you have such problems. Now I am searching for where to buy a new Farmduino. Maybe you can help me!
Will the new Farmduino be totally set up for using? Or this there further programming required?
The new soil sensor has an ICP-10111 i2c device required to measure temperature and pressure.
New GCODES could look something like
F85 P<sensor type>
for reading a sensor.
and
R85 P<sensor type> V<sensor value>
for the report from the firmware.
Types would be:
0 - temperature
1 - pressure
We may also need to add new params for Celsius and Fahrenheit.
param name | param number | param value | example |
---|---|---|---|
SENSOR_TEMPERATURE_UNITS |
224 | 0 for Celsius 1 for Fahrenheit | F22 P224 V0 |
F85 P0
R85 P0 V20.33
F85 P1
R85 P1 V101.35
I've only lightly tested the sensor but sending 0x68, 0x25
to i2c address 0x63 resulted in
2 bytes for temperature, 4-1 bytes for pressure.
The sensor also exposes calibration values. Maybe we need to implement this as well?
I saw that @fluffy reported this bug on the forum, but I thought this might be better discussed as a bug report rather than a general discussion. Here's the text of the post:
I went to https://my.farmbot.io/app/devices1 and changed the steps/mm from 500 to 2500. This seemed to send the system into and endless loops of bad GCodes. I just get a stead stream of errors on the the place on web where errors seem to go.
Any thoughts on what went wrong or ways to test it and log proper bugs?
An example of the errors look like
{
"id": 29092,
"message": "Farmbot got an unhandled gcode! {:unhandled_gcode, \"Q0\"}",
"meta": {
"x": -1,
"y": -1,
"z": -1,
"type": "info"
},
"channels": [],
"device_id": 250,
"created_at": "2016-12-27T23:58:58.968Z",
"updated_at": "2016-12-27T23:58:58.968Z"
},
{
"id": 29093,
"message": "Farmbot got an unhandled gcode! {:unhandled_gcode, \"Command: F21 P62d wh ode: : : : : V W:: : : : ecmd Q:2\"}",
"meta": {
"x": -1,
"y": -1,
"z": -1,
"type": "info"
},
"channels": [],
"device_id": 250,
"created_at": "2016-12-27T23:58:58.972Z",
"updated_at": "2016-12-27T23:58:58.972Z"
},
{
"id": 29094,
"message": "Farmbot got an unhandled gcode! {:unhandled_gcode, \"denu - \n0112and:21 62 Q0\r,\"}",
"meta": {
"x": -1,
"y": -1,
"z": -1,
"type": "info"
},
"channels": [],
"device_id": 250,
"created_at": "2016-12-27T23:58:58.976Z",
"updated_at": "2016-12-27T23:58:58.976Z"
},
{
"id": 29095,
"message": "Farmbot got a message from my arduino: Command with code: 121, X: 0.00, Y: 0.00, Z: 0.00, S: 0.00, P: 62, V: 0, W: 0, T: 0, E: 0, M: 0, Q: 0",
"meta": {
"x": -1,
"y": -1,
"z": -1,
"type": "info"
},
"channels": [],
"device_id": 250,
"created_at": "2016-12-27T23:58:58.982Z",
"updated_at": "2016-12-27T23:58:58.982Z"
},
{
"id": 29096,
"message": "Farmbot got an unhandled gcode! {:unhandled_gcode, \"exec cmd Q: 0\"}",
"meta": {
"x": -1,
"y": -1,
"z": -1,
"type": "info"
},
"channels": [],
"device_id": 250,
"created_at": "2016-12-27T23:58:58.989Z",
"updated_at": "2016-12-27T23:58:58.989Z"
},
{
"id": 29097,
"message": "Farmbot got an unhandled gcode! {:unhandled_gcode, \"c2\"}",
"meta": {
"x": -1,
"y": -1,
"z": -1,
"type": "info"
},
"channels": [],
"device_id": 250,
"created_at": "2016-12-27T23:58:58.992Z",
"updated_at": "2016-12-27T23:58:58.992Z"
},
{
"id": 29098,
"message": "Farmbot got an unhandled gcode! {:unhandled_gcode, \"c3: 121\"}",
"meta": {
"x": -1,
"y": -1,
"z": -1,
"type": "info"
},
"channels": [],
"device_id": 250,
"created_at": "2016-12-27T23:58:58.996Z",
"updated_at": "2016-12-27T23:58:58.996Z"
},
{
"id": 29099,
"message": "Farmbot got an unhandled gcode! {:unhandled_gcode, \"code Enum C - 121\"}",
"meta": {
"x": -1,
"y": -1,
"z": -1,
"type": "info"
},
"channels": [],
"device_id": 250,
"created_at": "2016-12-27T23:58:59.000Z",
"updated_at": "2016-12-27T23:58:59.000Z"
},
{
"id": 29100,
"message": "Farmbot got an unhandled gcode! {:unhandled_gcode, \"Q0\"}",
"meta": {
"x": -1,
"y": -1,
"z": -1,
"type": "info"
},
"channels": [],
"device_id": 250,
"created_at": "2016-12-27T23:58:59.003Z",
"updated_at": "2016-12-27T23:58:59.003Z"
},
{
"id": 29101,
"message": "Farmbot got an unhandled gcode! {:unhandled_gcode, \"Command: F21 P63 Q0\r,\"}",
"meta": {
"x": -1,
"y": -1,
"z": -1,
"type": "info"
},
"channels": [],
"device_id": 250,
"created_at": "2016-12-27T23:58:59.006Z",
"updated_at": "2016-12-27T23:58:59.006Z"
},
{
"id": 29102,
"message": "Farmbot got a message from my arduino: Command with code: 121, X: 0.00, Y: 0.00, Z: 0.00, S: 0.00, P: 63, V: 0, W: 0, T: 0, E: 0, M: 0, Q: 0",
"meta": {
"x": -1,
"y": -1,
"z": -1,
"type": "info"
},
"channels": [],
"device_id": 250,
"created_at": "2016-12-27T23:58:59.010Z",
"updated_at": "2016-12-27T23:58:59.010Z"
},
{
"id": 29103,
"message": "Farmbot got an unhandled gcode! {:unhandled_gcode, \"exec cmd Q: 0\"}",
"meta": {
"x": -1,
"y": -1,
"z": -1,
"type": "info"
},
"channels": [],
"device_id": 250,
"created_at": "2016-12-27T23:58:59.014Z",
"updated_at": "2016-12-27T23:58:59.014Z"
}
CC: @ConnorRigby
There is some weird stuff going on with the moments. Sometimes a command to move in one direction causes it to move a bit, then reverse for no reason, then move forward again. Its weird. Its like the direction pin on the RAMPS board is flipping inadvertently... This has been happening for a while, but I was never sure if it was weird stuff with the pi controller or the meshblu commands, etc. I think it has to do with the Arduino. Any ideas?
This has the potential to cause really hard to find bugs when another function call overwires the values.
Hi,
We used the last stable version "Version 2.0.0 (Biennial Bignonia)" to use the serial debugging tool to test the send instruction is valid, but the latest code to compile will not work, do not know why?
We will open the code of the log, found getCodeEnum () is always equal to CODE_UNDEFINED, what is the reason?
thank you very much!
Hello everyone,
my second motor on X-Axis is still not working at all. Using the newest firmware.
What I tried so far:
Uploading the dual motor version of fluffy helps out, but i think it may be outdated since its from mid December.
Is there anything needed to be done manually to get the X2 motor running? Or is it just activated by default?
Also there are sometimes messages from arduino, just like this:
but they appear for every axis.
I'm not sure what the build steps are doing, but it looke like:
wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python
Now drops a *.zip file into current directory, which must be extracted and CD'ed into before installation can continue.
When I use the web app to calibrate the parameters such as max-x-speed, the device no longer moves. Reflashing the Arduino fixes the issue.
The connection to my motor is good, the issue is that the Arduino doesn't seem to be sending any steps. This is what happens:
z=0
I send a command to move to z=1000
Pi receives the command
Bot does not move
Pi updates log with current location, which is still z=0
I receive the following error when I issue "ino build"
~/working/farmbot-arduino-firmware$ ino build
Searching for Board description file (boards.txt) ... /usr/share/arduino/hardware/arduino/boards.txt
Searching for Arduino lib version file (version.txt) ... /usr/share/arduino/lib/version.txt
Detecting Arduino software version ... 1.0.5 (1:1.0.5+dfsg2-2)
Searching for Arduino core library ... /usr/share/arduino/hardware/arduino/cores/arduino
Searching for Arduino variants directory ... /usr/share/arduino/hardware/arduino/variants
Searching for Arduino standard libraries ... /usr/share/arduino/libraries
Searching for make ... /usr/share/arduino/hardware/tools/avr/bin/make
Searching for avr-gcc ... /usr/share/arduino/hardware/tools/avr/bin/avr-gcc
Searching for avr-g++ ... /usr/share/arduino/hardware/tools/avr/bin/avr-g++
Searching for avr-ar ... /usr/share/arduino/hardware/tools/avr/bin/avr-ar
Searching for avr-objcopy ... /usr/share/arduino/hardware/tools/avr/bin/avr-objcopy
src/src.ino
Searching for Arduino lib version file (version.txt) ... /usr/share/arduino/lib/version.txt
Detecting Arduino software version ... 1.0.5 (1:1.0.5+dfsg2-2)
Scanning dependencies of src
Scanning dependencies of arduino
Scanning dependencies of EEPROM
Scanning dependencies of Servo
src/CurrentState.cpp
src/F41Handler.cpp
src/ParameterList.cpp
src/TimerOne.cpp
src/F44Handler.cpp
src/F82Handler.cpp
src/PinGuardPin.cpp
In file included from src/ParameterList.h:6:0,
from src/PinGuardPin.h:17,
from src/PinGuardPin.cpp:2:
src/PinGuard.h:35:2: error: ‘PinGuardPin’ does not name a type
PinGuardPin pinGuardPin[5];
^
make: *** [.build/mega2560/src/PinGuardPin.o] Error 1
Make failed with code 2_
What do you think? It might help differentiate it more from 'raspberry-pi-controller'
"It would be great to be able to set different motor settigns (speed, stepping, micro-stepping) for moving up or down the z-axis!!!"
I am developing this FarmBot and currently, I am buying the hardware parts. I will use Arduino Mega + RAMPS Shield + DRV8825, Drivers, instead of the Farmduino board, so any suggestion to use this Arduino+RAMPS combination???
I also want to know that can I skip the encoders and use the steppers in the open-loop mode. Would the FarmBot work without encoders?
It had a few issues when I first compiled. One was defining NULL and others were something about long ints? I had to change a few 0.0 to 0 to make it compile. Why was this?
I managed to make a few changes and now it compiles but I cant remember what I changed.
The Universal Tool Mounting System currently incorporates 4 electrical contacts (+12V, GND, and two for data from the Arduino [input or output]). These contacts connect with matching contacts on tools to support a variety of operations.
It will be important to verify that a tool has been mounted or dismounted correctly. This could be done by having an extra electrical contact that is an input to the Arduino. This extra connection could have a jumper on the tool to one of the data wires acting as a 5V output. When the tool is mounted, the extra contact will read 5V, when it is dismounted, it will read 0V.
Hmmm now that I think about it, we may not want a tool to become active (via the 5V on the data line) right when the tool is mounted. So maybe there should be two extra connections that are dedicated to detecting if tools are mounted?
What do you think @TimEvWw?
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.