4. RAMPS - maxosprojects/open-dobot GitHub Wiki
RAMPS board since version 1.2
open-dobot supportsPrerequisites
- RAMPS v1.4 board, like this.
- Two GY-521 boards based on MPU-6050 units (a.k.a. accelerometers), like this. Those are cheap, easy to mount and connect and reduce the hardware variations to support (so far no one has expressed interest in supporting accelerometers that come with Dobot v1.1 and v1.2 and maxosprojects has only access to v1.0)
- A bunch of ferrite beads, like this
- If you are planning to use servos (for tool rotation or gripper) then a 5V voltage regulator is required. RAMPS doesn't have one and using Arduino's 5V Vcc is not acceptable (Arduino will get reset randomly). Something like this or this should do.
Hooking up GY-521 accelerometer boards
There are two parts to hooking up GY-521 boards.
General GY-521 accelerometer hook up
The boards are hooked up as follows:
GY-521 rear arm | GY-521 front arm | RAMPS I2C connector pin |
---|---|---|
VCC | VCC | 5V |
GND | GND | GND |
SCL | SCL | 21 |
SDA | SDA | 20 |
Use this and this diagrams as guidelines.
GY-521 AD0 pin
GY-521 sits on I2C bus and has address 0x68 by default. When there is more than one unit on the bus the second unit (the one on the front arm in case of Dobot) must have a different address. This is achieved by pulling AD0 pin on GY-521 to 3.3V, which makes the unit get address 0x69. Pins VCC, SCL and SDA on GY-521 board are 5V tolerant, while pin AD0 is not. There are two options to get 3.3V to the second unit:
- Solder a wire to Arduino's 3.3V pin
- Make a voltage divider out of two resistors
Depending on the implementation of the units the indication of units having different addresses may be the color of the LED on them. It has been reported that this is not a hard requirements and while the LEDs are both the same color they can still have different addresses and function properly.
GY-521 units are an integral part of Dobot as the only sensor enabling estimation of the end effector's pose when program starts. Therefore, there many attempts to read the units are made in firmware which may lead to "Cannot get board version. Giving up" message when starting the program. This most likely means that there was a problem communicating with one of the units which makes the attempt to read the board version to time out.
Fixing interference
The way A4988 stepper motor drivers hold motors interfere with I2C bus (a lot of electromagnetic noise) and prevents readings from GY-521 modules.
In order to fix this issue use the ferrite beads mentioned in requirements above. Follow annotations here on where and how to apply them. Ignore the reference to the resistors on stepper drivers for now.
Checking out readings
To see the readings from the units in constant flow:
- Disconnect 12V power from RAMPS and USB from Arduino
- Short pin D23 on AUX-4 connector on RAMPS to ground (GND). Use a button if you like. That button would act as the
Sensor Calibration
button on original Dobot control box. - Connect Arduino to your PC via USB
- Push and hold the button described in item 2 if you connected one instead of shorting D23 directly
- Start
calibration-tool.py
You should see a flow of data on the console displaying raw data from the units, calculated angles and estimated height of the end effector.
When finished with calibration tool remove GND from D23 pin.
Mounting GY-521 units
The units can be mounted on the arms in many different ways. Here are a few:
- On top of existing accelerometers with a drop of hot glue. This is the default and assumed way and has been applied to existing "boxy" accelerometers on Dobot v1.0
- Under existing accelerometers with a piece of double-sided adhesive tape or a drop of hot glue
- On the side of each arm with a piece of double-sided adhesive tape or a drop of hot glue
Mounting the units with double-sided tape has not been tested for a prolonged period of time and may be not a good long-term solution.
Current open-dobot implementation assumes the units are mounted on top of existing accelerometers and the unit's connector holes (were the connector is soldered) looking at the back of the robot. Any other ways of mounting requires a change to the accel3DXToRadians()
function in DobotDriver.py
to account for the unit orientation. Please don't hesitate to create a feature request to support a different unit orientation.
Note: it is easier to mount the units when the connector is not soldered and wires soldered only on top, so that the bottom of the unit remains flat without anything sticking out.
Stepper motors
Stepper drivers must run in microstepping mode. To enable microstepping three jumpers per driver need to be installed. The connectors for the jumpers are located under each corresponding stepper driver on RAMPS. See wiring diagram for reference.
Stepper drivers should be installed and motor wires connected as shown on wiring diagram.
Power
You can use existing Dobot's power supply. Refer to the RAMPS diagram and connect power as follows:
Power supply wire | RAMPS MSTBA4 connector |
---|---|
GND | 5A - |
+12V | 5A + |
+12V | 11A + |
Keeping motors enabled between program restarts
By default RAMPS board does not apply anything to the ENABLE
pin on the stepper drivers. In order for the motors to get enabled firmware pull that pin to the ground (GND
). However, when the user program starts Arduino gets reset which resets the state of the pin to "floating" (neither GND
, nor Vcc
), which disables motors. It takes some time for Arduino to initialize and start firmware, during which the motors remain disabled. This is when you see the arm falling down.
There is a way to keep the motors enabled at all times. This requires soldering of one resistor (4.7k, 0.25W would be perfect) on each stepper driver between ENABLE
pin and GND
. This is depicted and annotated on this picture. Of course make the resistor leads shorter than on the picture so that they sit below the radiator height.