Skip to content

Commit

Permalink
Add support for the 36v8. Change version number to 1.1.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidEGrayson committed Dec 7, 2024
1 parent 879629e commit 138e362
Showing 6 changed files with 42 additions and 14 deletions.
28 changes: 26 additions & 2 deletions HighPowerStepperDriver.h
Original file line number Diff line number Diff line change
@@ -381,6 +381,29 @@ class HighPowerStepperDriver
void setCurrentMilliamps36v4(uint16_t current)
{
if (current > 8000) { current = 8000; }
setCurrentMilliamps36v8(current);
}

/// Sets the current limit for a High-Power Stepper Motor Driver 36v8.
///
/// The argument to this function should be the desired current limit in
/// milliamps.
///
/// WARNING: The 36v4 can supply up to about 8 A per coil continuously;
/// higher currents might be sustainable for short periods, but can eventually
/// cause the MOSFETs to overheat, which could damage them. See the driver's
/// product page for more information.
///
/// This function allows you to set a current limit of up to 16 A (16000 mA),
/// but we strongly recommend against using a current limit higher than 8 A
/// (8000 mA) unless you are careful to monitor the MOSFETs' temperatures
/// and/or restrict how long the driver uses the higher current limit.
///
/// This function takes care of setting appropriate values for ISGAIN and
/// TORQUE to get the desired current limit.
void setCurrentMilliamps36v8(uint16_t current)
{
if (current > 16000) { current = 16000; }

// From the DRV8711 datasheet, section 7.3.4, equation 2:
//
@@ -390,11 +413,12 @@ class HighPowerStepperDriver
//
// TORQUE = (256 * ISGAIN * Risense * Ifs) / 2.75 V
//
// The 36v4 has an Risense of 30 milliohms, and "current" is in milliamps,
// so:
// The 36v4 and 36v8 have an Risense of 30 milliohms, and "current" is
// in milliamps, so:
//
// TORQUE = (256 * ISGAIN * (30/1000) ohms * (current/1000) A) / 2.75 V
// = (7680 * ISGAIN * current) / 2750000
// = (768 * (ISGAIN/40) * current) / 6875
//
// We want to pick the highest gain (5, 10, 20, or 40) that will not
// overflow TORQUE (8 bits, 0xFF max), so we start with a gain of 40 and
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# High-Power Stepper Motor Driver library for Arduino

Version: 1.0.0<br/>
Release date: 2019-06-04<br/>
[www.pololu.com](https://www.pololu.com/)

## Summary

This is a library for the Arduino IDE that helps interface with a [Pololu
High-Power Stepper Motor Driver 36v4][hpsd-36v4]. It uses the [Arduino
SPI][spi] library to communicate with the SPI interface (SCS, SCLK, SDATI, and
This is a library for the Arduino IDE that helps interface with a
[Pololu High-Power Stepper Motor Driver 36v4][hpsd-36v4] or
[Pololu High-Power Stepper Motor Driver 36v8][hpsd-36v8]. It uses the
[Arduino SPI][spi] library to communicate with the SPI interface (SCS, SCLK, SDATI, and
SDATO) of the driver.

## Supported platforms
@@ -87,6 +86,7 @@ HighPowerStepperDriver class reference.

## Version history

* 1.1.0 (2024-12-06): Added support for the [Pololu High-Power Stepper Motor Driver 36v8][hpsd-36v8].
* 1.0.0 (2019-06-04): Original release.

[a-star]: https://www.pololu.com/a-star
@@ -95,4 +95,5 @@ HighPowerStepperDriver class reference.
[doc]: https://pololu.github.io/high-power-stepper-driver-arduino/
[github]: https://github.com/pololu/high-power-stepper-driver-arduino/releases
[hpsd-36v4]: https://www.pololu.com/product/3730
[hpsd-36v8]: https://www.pololu.com/product/3731
[spi]: http://www.arduino.cc/en/Reference/SPI
5 changes: 3 additions & 2 deletions examples/BasicStepping/BasicStepping.ino
Original file line number Diff line number Diff line change
@@ -48,7 +48,8 @@ void setup()
sd.setDecayMode(HPSDDecayMode::AutoMixed);

// Set the current limit. You should change the number here to an appropriate
// value for your particular system.
// value for your particular system. If you are using a 36v8 board, call
// setCurrentMilliamps36v8 instead.
sd.setCurrentMilliamps36v4(1000);

// Set the number of microsteps that correspond to one full step.
@@ -103,4 +104,4 @@ void setDirection(bool dir)
delayMicroseconds(1);
digitalWrite(DirPin, dir);
delayMicroseconds(1);
}
}
7 changes: 4 additions & 3 deletions examples/BasicSteppingSPI/BasicSteppingSPI.ino
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
// functions.
//
// Since SPI is used to trigger steps and set the direction, connecting the
// driver's STEP and DIR pins is optional for this example. However, note that
// driver's STEP and DIR pins are not needed for this example. Note that
// using SPI control adds some overhead compared to using the STEP and DIR pins.
// In addition, since the library caches SPI register values, SPI control is
// more likely to re-enable the driver with the wrong settings (e.g. current
@@ -49,7 +49,8 @@ void setup()
sd.setDecayMode(HPSDDecayMode::AutoMixed);

// Set the current limit. You should change the number here to an appropriate
// value for your particular system.
// value for your particular system. If you are using a 36v8 board, call
// setCurrentMilliamps36v8 instead.
sd.setCurrentMilliamps36v4(1000);

// Set the number of microsteps that correspond to one full step.
@@ -82,4 +83,4 @@ void loop()

// Wait for 300 ms.
delay(300);
}
}
3 changes: 2 additions & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
@@ -26,8 +26,9 @@ getDirection KEYWORD2
step KEYWORD2
setStepMode KEYWORD2
setCurrentMilliamps36v4 KEYWORD2
setCurrentMilliamps36v8 KEYWORD2
setDecayMode KEYWORD2
readStatus KEYWORD2
clearStatus KEYWORD2
readFaults KEYWORD2
clearFaults KEYWORD2
clearFaults KEYWORD2
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=HighPowerStepperDriver
version=1.0.0
version=1.1.0
author=Pololu
maintainer=Pololu <[email protected]>
sentence=High-Power Stepper Motor Driver library for Arduino

0 comments on commit 138e362

Please sign in to comment.