Skip to content

Commit 7e65e51

Browse files
Merge pull request #182 from arturohernandez10/master
Typo in pin assignment configuration for 4PWM
2 parents d3aee2b + f2b6b90 commit 7e65e51

File tree

8 files changed

+255
-72
lines changed

8 files changed

+255
-72
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: "[BUG]"
5+
labels: possible bug
6+
assignees: ''
7+
8+
---
9+
10+
This is a simplified template, feel free to change it if it does not fit your case.
11+
12+
**Describe the bug**
13+
A clear and concise description of what the bug is.
14+
15+
**Describe the hardware setup**
16+
For us it is very important to know what is the hardware setup you're using in order to be able to help more directly
17+
- Which motor
18+
- Which driver
19+
- Which microcontroller
20+
- Which position sensor
21+
- Current sensing used?
22+
23+
**IDE you are using**
24+
- Arduino IDE
25+
- Platformio
26+
- Something else
27+
28+
**Tried the Getting started guide? - if applicable**
29+
Have you tried the getting started guide and at which step are you blocked in
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: "[FEATURE]"
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
Description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
Description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
Description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

CODE_OF_CONDUCT.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
info@simplefoc.com.
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122+
enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
[homepage]: https://www.contributor-covenant.org
125+
126+
For answers to common questions about this code of conduct, see the FAQ at
127+
https://www.contributor-covenant.org/faq. Translations are available at
128+
https://www.contributor-covenant.org/translations.

README.md

Lines changed: 73 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,46 @@ Therefore this is an attempt to:
1919
- See also [@byDagor](https://github.com/byDagor)'s *fully-integrated* ESP32 based board: [Dagor Brushless Controller](https://github.com/byDagor/Dagor-Brushless-Controller)
2020

2121

22-
> NEXT RELEASE 📢: <span class="simple">Simple<span class="foc">FOC</span>library</span> v2.2.2
23-
> - GenericCurrentSense bugfix and testing
24-
> - bugfix leonardo #170
25-
> - bugfix - no index search after specifying natural direction
26-
> - Odrive example code see `examples/hardware_specific/odrive_example`
27-
> - Low level API restructuring
28-
> - Driver API
29-
> - Current sense API
30-
> - New debugging interface
31-
> - Static class SimpleFOCDebug
32-
> - Low-side current sensing
33-
> - ESP32 generic support for multiple motors
34-
> - Added low-side current sensing support for stm32 - only one motor
35-
> - f1 family
36-
> - f4 family
37-
> - g4 family
38-
> - New handling of current limit using voltage
39-
> - Support for motor KV rating - back emf estimation
40-
> - Using motor phase resistance
41-
4222

23+
<blockquote class="info">
24+
<p class="heading">NEW RELEASE 📢: <span class="simple">Simple<span class="foc">FOC</span>library</span> v2.2.2 <a href="https://github.com/simplefoc/Arduino-FOC/releases/tag/v2.2.2">see release</a></p>
25+
<ul>
26+
<li>GenericCurrentSense bugfix and testing</li>
27+
<li>bugfix leonardo #170</li>
28+
<li>bugfix - no index search after specifying natural direction</li>
29+
<li>Low level API restructuring
30+
<ul dir="auto">
31+
<li>Driver API</li>
32+
<li>Current sense API</li>
33+
</ul>
34+
</li>
35+
<li>New debugging interface - <a href="https://docs.simplefoc.com/debugging">see in docs</a>
36+
<ul dir="auto">
37+
<li>Static class SimpleFOCDebug</li>
38+
</ul>
39+
</li>
40+
<li>CurrentSense API change - added method <code class="highlighter-rouge">linkDriver()</code> - <a href="https://docs.simplefoc.com/current_sense">see in docs</a></li>
41+
<li>Low-side current sensing - <a href="https://docs.simplefoc.com/low_side_current_sense">see in docs</a>
42+
<ul dir="auto">
43+
<li>ESP32 generic support for multiple motors</li>
44+
<li>Added low-side current sensing support for stm32 - only one motor
45+
<ul dir="auto">
46+
<li>f1 family</li>
47+
<li>f4 family</li>
48+
<li>g4 family</li>
49+
</ul>
50+
</li>
51+
</ul>
52+
</li>
53+
<li>New appraoch for current estimation for torque control using voltage - <a href="https://docs.simplefoc.com/voltage_torque_mode">see in docs </a>
54+
<ul dir="auto">
55+
<li>Support for motor KV rating - back emf estimation</li>
56+
<li>Using motor phase resistance</li>
57+
</ul>
58+
</li>
59+
<li>KV rating and phase resistance used for open-loop current limiting as well - <a href="https://docs.simplefoc.com/open_loop_motion_control">see in docs </a> </li>
60+
</ul>
61+
</blockquote>
4362

4463
## Arduino *SimpleFOClibrary* v2.2
4564

@@ -51,58 +70,43 @@ Therefore this is an attempt to:
5170

5271
This video demonstrates the *Simple**FOC**library* basic usage, electronic connections and shows its capabilities.
5372

54-
5573
### Features
56-
- **Arduino compatible**:
57-
- Arduino library code
58-
- Arduino Library Manager integration
74+
- **Easy install**:
75+
- Arduino IDE: Arduino Library Manager integration
76+
- PlatformIO
5977
- **Open-Source**: Full code and documentation available on github
78+
- **Goal**:
79+
- Support as many [sensor](https://docs.simplefoc.com/position_sensors) + [motor](https://docs.simplefoc.com/motors) + [driver](https://docs.simplefoc.com/drivers) + [current sense](https://docs.simplefoc.com/current_sense) combination as possible.
80+
- Provide the up-to-date and in-depth documentation with API references and the examples
6081
- **Easy to setup and configure**:
61-
- Easy hardware configuration
62-
- Easy [tuning the control loops](https://docs.simplefoc.com/motion_control)
63-
- **Modular**:
64-
- Supports as many [sensors, BLDC motors and driver boards](https://docs.simplefoc.com/supported_hardware) as possible
65-
- Supports multiple [MCU architectures](https://docs.simplefoc.com/microcontrollers):
66-
- Arduino: UNO, MEGA, any board with ATMega328 chips
67-
- STM32 boards: [Nucleo](https://www.st.com/en/evaluation-tools/stm32-nucleo-boards.html), [Bluepill](https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill.html) ...
68-
- ESP32
69-
- Teensy boards
70-
- **Plug & play**: Arduino <span class="simple">Simple<span class="foc">FOC</span>Shield</span>
82+
- Easy hardware configuration
83+
- Each hardware component is a C++ object (easy to understand)
84+
- Easy [tuning the control loops](https://docs.simplefoc.com/motion_control)
85+
- [*Simple**FOC**Studio*](https://docs.simplefoc.com/studio) configuration GUI tool
86+
- Built-in communication and monitoring
87+
- **Cross-platform**:
88+
- Seamless code transfer from one microcontroller family to another
89+
- Supports multiple [MCU architectures](https://docs.simplefoc.com/microcontrollers):
90+
- Arduino: UNO, MEGA, DUE, Leonardo ....
91+
- STM32
92+
- ESP32
93+
- Teensy
94+
- many more ...
7195

7296
<p align=""> <img src="https://docs.simplefoc.com/extras/Images/uno_l6234.jpg" height="170px"> <img src="https://docs.simplefoc.com/extras/Images/hmbgc_v22.jpg" height="170px"> <img src="https://docs.simplefoc.com/extras/Images/foc_shield_v13.jpg" height="170px"></p>
7397

74-
## Arduino *SimpleFOCShield* v2.0.4
75-
<p align="">
76-
<a href="https://youtu.be/G5pbo0C6ujE">
77-
<img src="https://docs.simplefoc.com/extras/Images/foc_shield_video.jpg" height="320px">
78-
</a>
79-
</p>
80-
81-
### Features
82-
- **Plug & play**: In combination with Arduino *Simple**FOC**library* - [github](https://github.com/simplefoc/Arduino-FOC)
83-
- **Low-cost**: Price of €15 - [Check the pricing](https://www.simplefoc.com/shop)
84-
- **In-line current sensing**: Up to 3Amps/5Amps bidirectional
85-
- configurable: 3.3Amps - 3.3V adc, 5Amps - 5V adc
86-
- **Integrated 8V regulator**:
87-
- Enable/disable by soldering pads
88-
- **Max power 120W** - max current 5A, power-supply 12-24V
89-
- Designed for Gimbal motors with the internal resistance >10 Ωs.
90-
- **Stackable**: running 2 motors in the same time
91-
- **Encoder/Hall sensors interface**: Integrated 3.3kΩ pullups (configurable)
92-
- **I2C interface**: Integrated 4.7kΩ pullups (configurable)
93-
- **Configurable pinout**: Hardware configuration - soldering connections
94-
- **Arduino headers**: Arduino UNO, Arduino MEGA, STM32 Nucleo boards...
95-
- **Open Source**: Fully available fabrication files - [how to make it yourself](https://docs.simplefoc.com/arduino_simplefoc_shield_fabrication)
9698

97-
<p align=""><img src="https://simplefoc.com/assets/img/v2.jpg" height="180px"> <img src="https://simplefoc.com/assets/img/v1.jpg" height="180px"> <img src="https://docs.simplefoc.com/extras/Images/simple_foc_shield_v13_small.gif" height="180x"></p>
99+
## Documentation
100+
Full API code documentation as well as example projects and step by step guides can be found on our [docs website](https://docs.simplefoc.com/).
98101

102+
![image](https://user-images.githubusercontent.com/36178713/168475410-105e4e3d-082a-4015-98ff-d380c7992dfd.png)
99103

100104

101105
## Getting Started
102106
Depending on if you want to use this library as the plug and play Arduino library or you want to get insight in the algorithm and make changes there are two ways to install this code.
103107

104108
- Full library installation [Docs](https://docs.simplefoc.com/library_download)
105-
- Minimal project builder [Docs](https://docs.simplefoc.com/minimal_download)
109+
- PlatformIO [Docs](https://docs.simplefoc.com/library_platformio)
106110

107111
### Arduino *SimpleFOClibrary* installation to Arduino IDE
108112
#### Arduino Library Manager
@@ -125,14 +129,19 @@ git clone https://github.com/simplefoc/Arduino-FOC.git
125129
```
126130
- Reopen Arduino IDE and you should have the library examples in `File > Examples > Simple FOC`.
127131

128-
### *SimpleFOClibrary* minimal project builder
132+
## Community and contributing
133+
134+
For all the questions regarding the potential implementation, applications, supported hardware and similar please visit our [community forum](https://community.simplefoc.com) or our [discord server](https://discord.gg/kWBwuzY32n).
135+
136+
It is always helpful to hear the stories/problems/suggestions of people implementing the code and you might find a lot of answered questions there already!
137+
138+
### Github Issues & Pull requests
129139

130-
For those willing to experiment and to modify the code I suggest using the minimal project builder [minimal branch](https://github.com/simplefoc/Arduino-FOC/tree/minimal).
131-
> This code is completely independent and you can run it as any other Arduino Sketch without the need for any libraries.
140+
Please do not hesitate to leave an issue if you have problems/advices/suggestions regarding the code!
132141

133-
All you need to do is:
134-
- Go to [minimal branch](https://github.com/simplefoc/Arduino-FOC/tree/minimal)
135-
- Follow the tutorial in the README file and choose only the library files that are necessary for your application.
142+
Pull requests are welcome, but let's first discuss them in [community forum](https://community.simplefoc.com)!
143+
144+
If you'd like to contribute to this porject but you are not very familiar with github, don't worry, let us know either by posting at the community forum , by posting a github issue or at our discord server.
136145

137146
## Arduino code example
138147
This is a simple Arduino code example implementing the velocity control program of a BLDC motor with encoder.
@@ -206,9 +215,6 @@ Here are some of the *Simple**FOC**library* and *Simple**FOC**Shield* applicatio
206215
</p>
207216

208217

209-
## Documentation
210-
Find out more information about the Arduino SimpleFOC project in [docs website](https://docs.simplefoc.com/)
211-
212218

213219
## Arduino FOC repo structure
214220
Branch | Description | Status

src/drivers/hardware_specific/atmega2560_mcu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void* _configure4PWM(long pwm_frequency,const int pin1A, const int pin1B, const
8686
_pinHighFrequency(pin2A);
8787
_pinHighFrequency(pin2B);
8888
GenericDriverParams* params = new GenericDriverParams {
89-
.pins = { pin1A, pin2A, pin2A, pin2B },
89+
.pins = { pin1A, pin1B, pin2A, pin2B },
9090
.pwm_frequency = pwm_frequency
9191
};
9292
return params;

src/drivers/hardware_specific/atmega328_mcu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void* _configure4PWM(long pwm_frequency,const int pin1A, const int pin1B, const
8181
_pinHighFrequency(pin2A);
8282
_pinHighFrequency(pin2B);
8383
GenericDriverParams* params = new GenericDriverParams {
84-
.pins = { pin1A, pin2A, pin2A, pin2B },
84+
.pins = { pin1A, pin1B, pin2A, pin2B },
8585
.pwm_frequency = pwm_frequency
8686
};
8787
return params;
@@ -170,4 +170,4 @@ void _writeDutyCycle6PWM(float dc_a, float dc_b, float dc_c, void* params){
170170
_setPwmPair(((GenericDriverParams*)params)->pins[4], ((GenericDriverParams*)params)->pins[5], dc_c*255.0, ((GenericDriverParams*)params)->dead_zone*255.0);
171171
}
172172

173-
#endif
173+
#endif

src/drivers/hardware_specific/atmega32u4_mcu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void* _configure4PWM(long pwm_frequency,const int pin1A, const int pin1B, const
8989
_pinHighFrequency(pin2A);
9090
_pinHighFrequency(pin2B);
9191
GenericDriverParams* params = new GenericDriverParams {
92-
.pins = { pin1A, pin2A, pin2A, pin2B },
92+
.pins = { pin1A, pin1B, pin2A, pin2B },
9393
.pwm_frequency = pwm_frequency
9494
};
9595
return params;

0 commit comments

Comments
 (0)