Skip to content

Commit 138e362

Browse files
committed
Add support for the 36v8. Change version number to 1.1.0.
1 parent 879629e commit 138e362

File tree

6 files changed

+42
-14
lines changed

6 files changed

+42
-14
lines changed

HighPowerStepperDriver.h

+26-2
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,29 @@ class HighPowerStepperDriver
381381
void setCurrentMilliamps36v4(uint16_t current)
382382
{
383383
if (current > 8000) { current = 8000; }
384+
setCurrentMilliamps36v8(current);
385+
}
386+
387+
/// Sets the current limit for a High-Power Stepper Motor Driver 36v8.
388+
///
389+
/// The argument to this function should be the desired current limit in
390+
/// milliamps.
391+
///
392+
/// WARNING: The 36v4 can supply up to about 8 A per coil continuously;
393+
/// higher currents might be sustainable for short periods, but can eventually
394+
/// cause the MOSFETs to overheat, which could damage them. See the driver's
395+
/// product page for more information.
396+
///
397+
/// This function allows you to set a current limit of up to 16 A (16000 mA),
398+
/// but we strongly recommend against using a current limit higher than 8 A
399+
/// (8000 mA) unless you are careful to monitor the MOSFETs' temperatures
400+
/// and/or restrict how long the driver uses the higher current limit.
401+
///
402+
/// This function takes care of setting appropriate values for ISGAIN and
403+
/// TORQUE to get the desired current limit.
404+
void setCurrentMilliamps36v8(uint16_t current)
405+
{
406+
if (current > 16000) { current = 16000; }
384407

385408
// From the DRV8711 datasheet, section 7.3.4, equation 2:
386409
//
@@ -390,11 +413,12 @@ class HighPowerStepperDriver
390413
//
391414
// TORQUE = (256 * ISGAIN * Risense * Ifs) / 2.75 V
392415
//
393-
// The 36v4 has an Risense of 30 milliohms, and "current" is in milliamps,
394-
// so:
416+
// The 36v4 and 36v8 have an Risense of 30 milliohms, and "current" is
417+
// in milliamps, so:
395418
//
396419
// TORQUE = (256 * ISGAIN * (30/1000) ohms * (current/1000) A) / 2.75 V
397420
// = (7680 * ISGAIN * current) / 2750000
421+
// = (768 * (ISGAIN/40) * current) / 6875
398422
//
399423
// We want to pick the highest gain (5, 10, 20, or 40) that will not
400424
// overflow TORQUE (8 bits, 0xFF max), so we start with a gain of 40 and

README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# High-Power Stepper Motor Driver library for Arduino
22

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

75
## Summary
86

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

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

8887
## Version history
8988

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

9292
[a-star]: https://www.pololu.com/a-star
@@ -95,4 +95,5 @@ HighPowerStepperDriver class reference.
9595
[doc]: https://pololu.github.io/high-power-stepper-driver-arduino/
9696
[github]: https://github.com/pololu/high-power-stepper-driver-arduino/releases
9797
[hpsd-36v4]: https://www.pololu.com/product/3730
98+
[hpsd-36v8]: https://www.pololu.com/product/3731
9899
[spi]: http://www.arduino.cc/en/Reference/SPI

examples/BasicStepping/BasicStepping.ino

+3-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ void setup()
4848
sd.setDecayMode(HPSDDecayMode::AutoMixed);
4949

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

5455
// Set the number of microsteps that correspond to one full step.
@@ -103,4 +104,4 @@ void setDirection(bool dir)
103104
delayMicroseconds(1);
104105
digitalWrite(DirPin, dir);
105106
delayMicroseconds(1);
106-
}
107+
}

examples/BasicSteppingSPI/BasicSteppingSPI.ino

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// functions.
77
//
88
// Since SPI is used to trigger steps and set the direction, connecting the
9-
// driver's STEP and DIR pins is optional for this example. However, note that
9+
// driver's STEP and DIR pins are not needed for this example. Note that
1010
// using SPI control adds some overhead compared to using the STEP and DIR pins.
1111
// In addition, since the library caches SPI register values, SPI control is
1212
// more likely to re-enable the driver with the wrong settings (e.g. current
@@ -49,7 +49,8 @@ void setup()
4949
sd.setDecayMode(HPSDDecayMode::AutoMixed);
5050

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

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

8384
// Wait for 300 ms.
8485
delay(300);
85-
}
86+
}

keywords.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ getDirection KEYWORD2
2626
step KEYWORD2
2727
setStepMode KEYWORD2
2828
setCurrentMilliamps36v4 KEYWORD2
29+
setCurrentMilliamps36v8 KEYWORD2
2930
setDecayMode KEYWORD2
3031
readStatus KEYWORD2
3132
clearStatus KEYWORD2
3233
readFaults KEYWORD2
33-
clearFaults KEYWORD2
34+
clearFaults KEYWORD2

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=HighPowerStepperDriver
2-
version=1.0.0
2+
version=1.1.0
33
author=Pololu
44
maintainer=Pololu <[email protected]>
55
sentence=High-Power Stepper Motor Driver library for Arduino

0 commit comments

Comments
 (0)