├── .gitattributes ├── .gitignore ├── Firmware └── MonsterMoto_Shield_Example_Sketch │ └── MonsterMoto_Shield_Example_Sketch.ino ├── Hardware ├── MonsterMoto-Shield-v12.brd └── MonsterMoto-Shield-v12.sch └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## SparkFun Useful stuff 3 | ################# 4 | 5 | ## AVR Development 6 | *.eep 7 | *.elf 8 | *.lst 9 | *.lss 10 | *.sym 11 | *.d 12 | *.o 13 | *.srec 14 | *.map 15 | 16 | ## Notepad++ backup files 17 | *.bak 18 | 19 | ## BOM files 20 | *bom* 21 | 22 | ################# 23 | ## Eclipse 24 | ################# 25 | 26 | *.pydevproject 27 | .project 28 | .metadata 29 | bin/ 30 | tmp/ 31 | *.tmp 32 | *.bak 33 | *.swp 34 | *~.nib 35 | local.properties 36 | .classpath 37 | .settings/ 38 | .loadpath 39 | 40 | # External tool builders 41 | .externalToolBuilders/ 42 | 43 | # Locally stored "Eclipse launch configurations" 44 | *.launch 45 | 46 | # CDT-specific 47 | .cproject 48 | 49 | # PDT-specific 50 | .buildpath 51 | 52 | 53 | ############# 54 | ## Eagle 55 | ############# 56 | 57 | # Ignore the board and schematic backup files 58 | *.b#? 59 | *.s#? 60 | 61 | 62 | ################# 63 | ## Visual Studio 64 | ################# 65 | 66 | ## Ignore Visual Studio temporary files, build results, and 67 | ## files generated by popular Visual Studio add-ons. 68 | 69 | # User-specific files 70 | *.suo 71 | *.user 72 | *.sln.docstates 73 | 74 | # Build results 75 | [Dd]ebug/ 76 | [Rr]elease/ 77 | *_i.c 78 | *_p.c 79 | *.ilk 80 | *.meta 81 | *.obj 82 | *.pch 83 | *.pdb 84 | *.pgc 85 | *.pgd 86 | *.rsp 87 | *.sbr 88 | *.tlb 89 | *.tli 90 | *.tlh 91 | *.tmp 92 | *.vspscc 93 | .builds 94 | *.dotCover 95 | 96 | ## TODO: If you have NuGet Package Restore enabled, uncomment this 97 | #packages/ 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opensdf 104 | *.sdf 105 | 106 | # Visual Studio profiler 107 | *.psess 108 | *.vsp 109 | 110 | # ReSharper is a .NET coding add-in 111 | _ReSharper* 112 | 113 | # Installshield output folder 114 | [Ee]xpress 115 | 116 | # DocProject is a documentation generator add-in 117 | DocProject/buildhelp/ 118 | DocProject/Help/*.HxT 119 | DocProject/Help/*.HxC 120 | DocProject/Help/*.hhc 121 | DocProject/Help/*.hhk 122 | DocProject/Help/*.hhp 123 | DocProject/Help/Html2 124 | DocProject/Help/html 125 | 126 | # Click-Once directory 127 | publish 128 | 129 | # Others 130 | [Bb]in 131 | [Oo]bj 132 | sql 133 | TestResults 134 | *.Cache 135 | ClientBin 136 | stylecop.* 137 | ~$* 138 | *.dbmdl 139 | Generated_Code #added for RIA/Silverlight projects 140 | 141 | # Backup & report files from converting an old project file to a newer 142 | # Visual Studio version. Backup files are not needed, because we have git ;-) 143 | _UpgradeReport_Files/ 144 | Backup*/ 145 | UpgradeLog*.XML 146 | 147 | 148 | ############ 149 | ## Windows 150 | ############ 151 | 152 | # Windows image file caches 153 | Thumbs.db 154 | 155 | # Folder config file 156 | Desktop.ini 157 | 158 | 159 | ############# 160 | ## Python 161 | ############# 162 | 163 | *.py[co] 164 | 165 | # Packages 166 | *.egg 167 | *.egg-info 168 | dist 169 | build 170 | eggs 171 | parts 172 | bin 173 | var 174 | sdist 175 | develop-eggs 176 | .installed.cfg 177 | 178 | # Installer logs 179 | pip-log.txt 180 | 181 | # Unit test / coverage reports 182 | .coverage 183 | .tox 184 | 185 | #Translations 186 | *.mo 187 | 188 | #Mr Developer 189 | .mr.developer.cfg 190 | 191 | # Mac crap 192 | .DS_Store 193 | -------------------------------------------------------------------------------- /Firmware/MonsterMoto_Shield_Example_Sketch/MonsterMoto_Shield_Example_Sketch.ino: -------------------------------------------------------------------------------- 1 | /* MonsterMoto Shield Example Sketch 2 | date: 10/7/19 3 | code by: Jim Lindblom & Dennis Irrgang 4 | hardware by: Nate Bernstein 5 | SparkFun Electronics 6 | 7 | This is really simple example code to get you some basic 8 | functionality with the MonsterMoto Shield. The MonsterMote uses 9 | two VNH2SP30 high-current full-bridge motor drivers. 10 | 11 | Use the motorGo(uint8_t motor, uint8_t mode, uint8_t speed) 12 | function to control the motors. Available options are CW, CCW, 13 | BRAKEVCC, or BRAKEGND. Use motorOff(uint8_t motor) to turn a specific motor off. 14 | 15 | The motor variable in each function should be a Motor enum, alternatively 0 or a 1. 16 | pwm in the motorGo function should be a value between 0 and 255. 17 | 18 | This code is beerware; if you see the authors (or any SparkFun employee) at the 19 | local, and you've found our code helpful, please buy us a round! 20 | 21 | Distributed as-is; no warranty is given. */ 22 | 23 | #define BRAKEVCC 0 24 | #define CW 1 25 | #define CCW 2 26 | #define BRAKEGND 3 27 | 28 | #define MOTOR_A 0 29 | #define MOTOR_B 1 30 | 31 | const uint8_t PWM_MAX = 255; 32 | const uint8_t PWM_HALF = PWM_MAX / 2; 33 | 34 | const int currentSensingThreshhold = 100; 35 | 36 | /* Voltage controlled input pins with hysteresis, CMOS compatible. These two pins 37 | control the state of the bridge in normal operation according to the truth table (brake 38 | to VCC , brake to GND, clockwise and counterclockwise). 39 | 40 | Table 1. Truth table in normal operating conditions 41 | +------+-----+------+-----+-------+-------+---------------------+------------------------+ 42 | | INA | INB | ENA | ENB | OUTA | OUTB | CS | MODE | 43 | +------+-----+------+-----+-------+-------+---------------------+------------------------+ 44 | | 1 | 1 | 1 | 1 | H | H | High Imp. | Brake to VCC | 45 | | 1 | 0 | 1 | 1 | H | L | I_Sense = I_OUT / K | Clockwise (CW) | 46 | | 0 | 1 | 1 | 1 | L | H | I_SENSE = I_OUT / K | Counterclockwise (CCW) | 47 | | 0 | 0 | 1 | 1 | L | L | High Imp. | Brake to GND | 48 | +------+-----+------+-----+-------+-------+---------------------+------------------------+ 49 | For more information, see the VNH2SP30-E motor driver datasheet */ 50 | const int inAPin[2] = {7, 4}; 51 | const int inBPin[2] = {8, 9}; 52 | 53 | /* Voltage controlled input pins with hysteresis, CMOS compatible. Gates of low side 54 | FETs are modulated by the PWM signal during their ON phase allowing speed 55 | control of the motors. */ 56 | const int pwmPin[2] = {5, 6}; 57 | 58 | /* When pulled low, disables the half-bridge of the VNH2SP30-E of the motor. In case of 59 | fault detection (thermal shutdown of a high side FET or excessive ON state voltage drop 60 | across a low side FET), this pin is pulled low by the device. 61 | 62 | Table 2. Truth table in fault conditions (detected on OUTA) 63 | +------+-----+------+-----+-------+-------+------------+ 64 | | INA | INB | ENA | ENB | OUTA | OUTB | CS | 65 | +------+-----+------+-----+-------+-------+------------+ 66 | | 1 | 1 | 1 | 1 | OPEN | H | High Imp. | 67 | | 1 | 0 | 1 | 1 | OPEN | L | High Imp. | 68 | | 0 | 1 | 1 | 1 | OPEN | H | I_OUTB / K | 69 | | 0 | 0 | 1 | 1 | OPEN | L | High Imp. | 70 | | X | X | 0 | 0 | OPEN | OPEN | High Imp. | 71 | | X | 1 | 0 | 1 | OPEN | H | I_OUTB / K | 72 | | X | 0 | 0 | 1 | OPEN | L | High Imp. | 73 | +------+-----+------+-----+-------+-------+------------+ 74 | For more information, see the VNH2SP30-E motor driver datasheet */ 75 | const int enPin[2] = {0, 1}; 76 | 77 | /* Analog current sense input. This input senses a current proportional to the motor 78 | current. The information can be read back as an analog voltage. */ 79 | const int csPin[2] = {2, 3}; 80 | 81 | // On-Board LED used as status indication 82 | const int statPin = 13; 83 | 84 | 85 | void setup() 86 | { 87 | Serial.begin(9600); 88 | 89 | motorSetup(); 90 | } 91 | 92 | void loop() 93 | { 94 | while (true) 95 | { 96 | motorGo(MOTOR_A, CW, PWM_MAX); 97 | motorGo(MOTOR_B, CCW, PWM_MAX); 98 | delay(5000); 99 | 100 | motorOff(MOTOR_A); 101 | motorOff(MOTOR_B); 102 | delay(1000); 103 | 104 | motorGo(MOTOR_A, CCW, PWM_MAX); 105 | motorGo(MOTOR_B, CW, PWM_MAX); 106 | delay(5000); 107 | 108 | if ((analogRead(csPin[0]) < currentSensingThreshhold) && (analogRead(csPin[1]) < currentSensingThreshhold)) 109 | { 110 | digitalWrite(statPin, HIGH); 111 | } 112 | else 113 | { 114 | digitalWrite(statPin, LOW); 115 | break; 116 | } 117 | } 118 | motorOff(MOTOR_A); 119 | motorOff(MOTOR_B); 120 | } 121 | 122 | void motorSetup() 123 | { 124 | pinMode(statPin, OUTPUT); 125 | 126 | // Initialize digital pins as outputs 127 | for (int i = 0; i < 2; i++) 128 | { 129 | pinMode(inAPin[i], OUTPUT); 130 | pinMode(inBPin[i], OUTPUT); 131 | pinMode(pwmPin[i], OUTPUT); 132 | } 133 | // Initialize with brake applied 134 | for (int i = 0; i < 2; i++) 135 | { 136 | digitalWrite(inAPin[i], LOW); 137 | digitalWrite(inBPin[i], LOW); 138 | } 139 | } 140 | 141 | void motorOff(uint8_t motor) 142 | { 143 | // Initialize brake to Vcc 144 | for (int i = 0; i < 2; i++) 145 | { 146 | digitalWrite(inAPin[i], LOW); 147 | digitalWrite(inBPin[i], LOW); 148 | } 149 | analogWrite(pwmPin[motor], 0); 150 | } 151 | 152 | /* motorGo() will set a motor going in a specific direction 153 | the motor will continue going in that direction, at that speed 154 | until told to do otherwise. 155 | 156 | motor: this should be either MOTOR_A (0) or MOTOR_B (1), will select 157 | which of the two motors to be controlled. Invalid values are ignored. 158 | 159 | mode: Should be one of the following values 160 | BRAKEVCC (0): Brake to VCC 161 | CW (1): Turn Clockwise 162 | CCW (2): Turn Counter-Clockwise 163 | BRAKEGND (3): Brake to GND 164 | 165 | speed: should be a value between 0 and PWM_MAX (255), higher the number, the faster 166 | */ 167 | void motorGo(uint8_t motor, uint8_t mode, uint8_t speed) 168 | { 169 | 170 | if (motor == MOTOR_A || motor == MOTOR_B) 171 | { 172 | switch (mode) 173 | { 174 | case BRAKEVCC: // Brake to VCC 175 | digitalWrite(inAPin[motor], HIGH); 176 | digitalWrite(inBPin[motor], HIGH); 177 | break; 178 | case CW: // Turn Clockwise 179 | digitalWrite(inAPin[motor], HIGH); 180 | digitalWrite(inBPin[motor], LOW); 181 | break; 182 | case CCW: // Turn Counter-Clockwise 183 | digitalWrite(inAPin[motor], LOW); 184 | digitalWrite(inBPin[motor], HIGH); 185 | break; 186 | case BRAKEGND: // Brake to GND 187 | digitalWrite(inAPin[motor], LOW); 188 | digitalWrite(inBPin[motor], LOW); 189 | break; 190 | 191 | default: 192 | // Invalid mode does not change the PWM signal 193 | return; 194 | } 195 | analogWrite(pwmPin[motor], speed); 196 | } 197 | return; 198 | } 199 | -------------------------------------------------------------------------------- /Hardware/MonsterMoto-Shield-v12.brd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sparkfun/Monster_Moto_Shield/0cc320981caf554b5b359a62a0d8ff98512941fe/Hardware/MonsterMoto-Shield-v12.brd -------------------------------------------------------------------------------- /Hardware/MonsterMoto-Shield-v12.sch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sparkfun/Monster_Moto_Shield/0cc320981caf554b5b359a62a0d8ff98512941fe/Hardware/MonsterMoto-Shield-v12.sch -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Monster Moto Shield 2 | =================== 3 | 4 | [![Monster Moto Shield](https://cdn.sparkfun.com//assets/parts/4/4/9/1/10182-01.jpg "Monster Moto Shield")](https://www.sparkfun.com/products/10182) 5 | 6 | This motor shield contains a pair of VNH2SP30 full-bridge motor drivers, pitched for the 5mm screw terminals. 7 | 8 | Features 9 | ------------------- 10 | * Voltage max: 16V 11 | * Maximum current rating: 30 A 12 | * Practical Continuous Current: 14 A 13 | * Current sensing available to Arduino analog pin 14 | * MOSFET on-resistance: 19 mΩ (per leg) 15 | * Maximum PWM frequency: 20 kHz 16 | * Thermal Shutdown 17 | * Undervoltage and Overvoltage shutdown 18 | 19 | 20 | Repository Contents 21 | ------------------- 22 | * **/Firmware** - Example Arduino sketch 23 | * **/Hardware** - All Eagle design files (.brd, .sch) 24 | 26 | 27 | 28 | License Information 29 | ------------------- 30 | The hardware is released under [Creative Commons ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). 31 | The code is beerware; if you see the authors (or any SparkFun employee) at the local, and you've found our code helpful, please buy us a round! 32 | 33 | Distributed as-is; no warranty is given. 34 | --------------------------------------------------------------------------------