Skip to content

Commit 8ef3425

Browse files
author
Vitaly Puzrin
committed
First commit
0 parents  commit 8ef3425

23 files changed

+2040
-0
lines changed

.eslintrc.yml

+180
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
env:
2+
node: true
3+
browser: true
4+
es6: true
5+
6+
parserOptions:
7+
ecmaVersion: '2017'
8+
sourceType: module
9+
10+
rules:
11+
accessor-pairs: 2
12+
array-bracket-spacing: [ 2, "always", { "singleValue": true, "objectsInArrays": true, "arraysInArrays": true } ]
13+
block-scoped-var: 2
14+
block-spacing: 2
15+
brace-style: [ 2, '1tbs', { "allowSingleLine": true } ]
16+
# Postponed
17+
#callback-return: 2
18+
comma-dangle: 2
19+
comma-spacing: 2
20+
comma-style: 2
21+
computed-property-spacing: [ 2, never ]
22+
# Postponed
23+
#consistent-return: 2
24+
consistent-this: [ 2, self ]
25+
# ? change to multi
26+
curly: [ 2, 'multi-line' ]
27+
# Postponed
28+
# dot-notation: [ 2, { allowKeywords: true } ]
29+
dot-location: [ 2, 'property' ]
30+
eol-last: 2
31+
eqeqeq: 2
32+
func-style: [ 2, declaration ]
33+
# Postponed
34+
#global-require: 2
35+
guard-for-in: 2
36+
handle-callback-err: 2
37+
38+
# Postponed
39+
indent: [ 2, 2, { VariableDeclarator: { var: 2, let: 2, const: 3 }, SwitchCase: 1 } ]
40+
41+
# key-spacing: [ 2, { "align": "value" } ]
42+
keyword-spacing: 2
43+
linebreak-style: 2
44+
max-depth: [ 1, 3 ]
45+
max-nested-callbacks: [ 1, 5 ]
46+
# string can exceed 80 chars, but should not overflow github website :)
47+
max-len: [ 2, 120, 1000 ]
48+
new-cap: 2
49+
new-parens: 2
50+
# Postponed
51+
#newline-after-var: 2
52+
no-alert: 2
53+
no-array-constructor: 2
54+
no-bitwise: 2
55+
no-caller: 2
56+
#no-case-declarations: 2
57+
no-catch-shadow: 2
58+
no-cond-assign: 2
59+
no-console: 1
60+
no-constant-condition: 2
61+
no-control-regex: 2
62+
no-debugger: 1
63+
no-delete-var: 2
64+
no-div-regex: 2
65+
no-dupe-args: 2
66+
no-dupe-keys: 2
67+
no-duplicate-case: 2
68+
no-else-return: 2
69+
# Tend to drop
70+
# no-empty: 1
71+
no-empty-character-class: 2
72+
no-empty-pattern: 2
73+
no-eq-null: 2
74+
no-eval: 2
75+
no-ex-assign: 2
76+
no-extend-native: 2
77+
no-extra-bind: 2
78+
no-extra-boolean-cast: 2
79+
no-extra-semi: 2
80+
no-fallthrough: 2
81+
no-floating-decimal: 2
82+
no-func-assign: 2
83+
# Postponed
84+
#no-implicit-coercion: [2, { "boolean": true, "number": true, "string": true } ]
85+
no-implied-eval: 2
86+
no-inner-declarations: 2
87+
no-invalid-regexp: 2
88+
no-irregular-whitespace: 2
89+
no-iterator: 2
90+
no-label-var: 2
91+
no-labels: 2
92+
no-lone-blocks: 1
93+
no-lonely-if: 2
94+
no-loop-func: 2
95+
no-mixed-requires: [ 1, { "grouping": true } ]
96+
no-mixed-spaces-and-tabs: 2
97+
# Postponed
98+
#no-native-reassign: 2
99+
no-negated-in-lhs: 2
100+
# Postponed
101+
#no-nested-ternary: 2
102+
no-new: 2
103+
no-new-func: 2
104+
no-new-object: 2
105+
no-new-require: 2
106+
no-new-wrappers: 2
107+
no-obj-calls: 2
108+
no-octal: 2
109+
no-octal-escape: 2
110+
no-path-concat: 2
111+
no-proto: 2
112+
no-redeclare: 2
113+
# Postponed
114+
#no-regex-spaces: 2
115+
no-return-assign: 2
116+
no-self-compare: 2
117+
no-sequences: 2
118+
# Postponed
119+
#no-shadow: 2
120+
no-shadow-restricted-names: 2
121+
no-sparse-arrays: 2
122+
# Postponed
123+
#no-sync: 2
124+
no-trailing-spaces: 2
125+
no-undef: 2
126+
no-undef-init: 2
127+
no-undefined: 2
128+
no-unexpected-multiline: 2
129+
no-unreachable: 2
130+
no-unused-expressions: 2
131+
no-unused-vars: 2
132+
no-use-before-define: 2
133+
no-void: 2
134+
no-with: 2
135+
object-curly-spacing: [ 2, always, { "objectsInObjects": true, "arraysInObjects": true } ]
136+
operator-assignment: 1
137+
# Postponed
138+
#operator-linebreak: [ 2, after ]
139+
semi: 2
140+
semi-spacing: 2
141+
space-before-function-paren: [ 2, { "anonymous": "always", "named": "never" } ]
142+
space-in-parens: [ 2, never ]
143+
space-infix-ops: 2
144+
space-unary-ops: 2
145+
# Postponed
146+
#spaced-comment: [ 1, always, { exceptions: [ '/', '=' ] } ]
147+
strict: [ 2, global ]
148+
quotes: [ 2, single, avoid-escape ]
149+
quote-props: [ 1, 'as-needed', { "keywords": true } ]
150+
radix: 2
151+
use-isnan: 2
152+
valid-typeof: 2
153+
yoda: [ 2, never, { "exceptRange": true } ]
154+
155+
#
156+
# es6
157+
#
158+
arrow-body-style: [ 1, "as-needed" ]
159+
arrow-parens: [ 1, "as-needed" ]
160+
arrow-spacing: 2
161+
constructor-super: 2
162+
generator-star-spacing: [ 2, {"before": false, "after": true } ]
163+
no-class-assign: 2
164+
no-confusing-arrow: [ 1, { allowParens: true } ]
165+
no-const-assign: 2
166+
#no-constant-condition: 2
167+
no-dupe-class-members: 2
168+
no-this-before-super: 2
169+
# Postponed
170+
#no-var: 2
171+
object-shorthand: 1
172+
# Postponed
173+
#prefer-arrow-callback: 1
174+
# Postponed
175+
#prefer-const: 1
176+
#prefer-reflect
177+
#prefer-spread
178+
# Postponed
179+
#prefer-template: 1
180+
require-yield: 1

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.pioenvs
2+
.piolibdeps
3+
.clang_complete
4+
.gcc-flags.json
5+
node_modules/
6+
package-lock.json
7+
8+
.vscode/.browse.c_cpp.db*
9+
.vscode/c_cpp_properties.json
10+
.vscode/launch.json
11+
.vscode/settings.json

.travis.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Continuous Integration (CI) is the practice, in software
2+
# engineering, of merging all developer working copies with a shared mainline
3+
# several times a day < http://docs.platformio.org/page/ci/index.html >
4+
#
5+
# Documentation:
6+
#
7+
# * Travis CI Embedded Builds with PlatformIO
8+
# < https://docs.travis-ci.com/user/integration/platformio/ >
9+
#
10+
# * PlatformIO integration with Travis CI
11+
# < http://docs.platformio.org/page/ci/travis.html >
12+
#
13+
# * User Guide for `platformio ci` command
14+
# < http://docs.platformio.org/page/userguide/cmd_ci.html >
15+
#
16+
#
17+
# Please choice one of the following templates (proposed below) and uncomment
18+
# it (remove "# " before each line) or use own configuration according to the
19+
# Travis CI documentation (see above).
20+
#
21+
22+
23+
#
24+
# Template #1: General project. Test it using existing `platformio.ini`.
25+
#
26+
27+
# language: python
28+
# python:
29+
# - "2.7"
30+
#
31+
# sudo: false
32+
# cache:
33+
# directories:
34+
# - "~/.platformio"
35+
#
36+
# install:
37+
# - pip install -U platformio
38+
# - platformio update
39+
#
40+
# script:
41+
# - platformio run
42+
43+
44+
#
45+
# Template #2: The project is intended to by used as a library with examples
46+
#
47+
48+
# language: python
49+
# python:
50+
# - "2.7"
51+
#
52+
# sudo: false
53+
# cache:
54+
# directories:
55+
# - "~/.platformio"
56+
#
57+
# env:
58+
# - PLATFORMIO_CI_SRC=path/to/test/file.c
59+
# - PLATFORMIO_CI_SRC=examples/file.ino
60+
# - PLATFORMIO_CI_SRC=path/to/test/directory
61+
#
62+
# install:
63+
# - pip install -U platformio
64+
# - platformio update
65+
#
66+
# script:
67+
# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N

.vscode/extensions.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"platformio.platformio-ide"
6+
]
7+
}

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (c) 2018 by authors.
2+
3+
Permission is hereby granted, free of charge, to any person
4+
obtaining a copy of this software and associated documentation
5+
files (the "Software"), to deal in the Software without
6+
restriction, including without limitation the rights to use,
7+
copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the
9+
Software is furnished to do so, subject to the following
10+
conditions:
11+
12+
The above copyright notice and this permission notice shall be
13+
included in all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.

README.md

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
Grinder speed control with stable RPM
2+
=====================================
3+
4+
[![Gitter chat](https://badges.gitter.im/speedcontrols/ac_sc_grinder.svg)](https://gitter.im/speedcontrols/ac_sc_grinder)
5+
6+
__WORK IN PROGRESS !!!__
7+
8+
> Advanced speed control for grinder AC brushed motor. With RPM stabilization
9+
> via Back EMF measure. Replacement for default board.
10+
11+
Notes! Due size restrictions, it's impossible to create universal PCB.
12+
We prepeared PCB for `Hilda 180W` - it's very popular and cheap. Boards for
13+
other grinder models are left to volunteers.
14+
15+
16+
### Required components
17+
18+
1. [Hilda 180W](https://www.aliexpress.com/wholesale?SearchText=hilda+180w).
19+
Regulator is not restricted for this tool, but existing PCB layout is for
20+
this grinder model. Also, firmware config defaults are for it's motor's power.
21+
2. Go to [EasyEda project page](https://easyeda.com/speed/AC-speed-control-for-grinder)
22+
- Order PCB
23+
- Order details from BOM. We already prepeared links to LCSC for your
24+
convenience. It's not the cheapest in the wold, but good enougth. You
25+
may find nice to buy all details in one place and join delivery to
26+
single package.
27+
3. Get additional details, not included into BOM:
28+
- [Cheap stlink programmer](https://www.aliexpress.com/af/stlink-stm32.html?jump=afs)
29+
for stm32 devices (only 2$).
30+
- [Plastik 70 CRC](https://www.google.com/search?q=Plastik+70+CRC) or any
31+
other acrylic protective coating. We strongly recommend to protect PCB
32+
from aspirated dust
33+
- [male](https://www.aliexpress.com/item/100pcs-2-8-Inserts-Plug-Spring-Terminal-PCB-Solder-lug-thickness-0-8-one-legs-PCB/32702011692.html) &
34+
[female](https://www.aliexpress.com/item/100pcs-lot-2-8-insulated-terminal-with-0-5-0-8-male-insert-brass-color-connectors/32593170276.html) 2.8mm power terminals (optional - you can solder wires directly)
35+
4. Extract some components from native grinder board:
36+
- Speed potentiometer with wheel.
37+
- Terminal pins for motor contacts.
38+
- AC filtering capacitor (0.1uF 275v). It's not drawn on schematics, solder
39+
it after board assembly to AC power pins.
40+
41+
42+
## Building hardware
43+
44+
1. Assemble PCB.
45+
2. Flash firmware.
46+
3. Test that it works.
47+
4. Cover PCB with protective coating.
48+
49+
50+
## How to flash firmware
51+
52+
**WARNING! You MUST unplug power cord prior to flash firmware.** Turning power off
53+
via grinder switch is not enougth. If you plug programmator into computer
54+
while AC plug in power socket, your USB interface may be damaged!
55+
56+
1. Install PlatformIO IDE. Follow instructions [here](http://docs.platformio.org/en/latest/ide/pioide.html).
57+
We use PIO for Atom, but PIO for VSCode should be ok too.
58+
- Make sure you've [installed](http://docs.platformio.org/en/latest/installation.html#troubleshooting)
59+
udev rules (linux) or device drivers (windows).
60+
2. Clone this repo or download via zip archive.
61+
3. Optionally, edit defaults in `/src/config_map.h`, but defaults should be ok.
62+
We recommend to skip this step.
63+
4. Open this project in installed IDE.
64+
5. Open `PlatformIO` -> `Terminal` -> `New Terminal`
65+
66+
Now type this commands in terminat window:
67+
68+
```bash
69+
pio run --target upload
70+
```
71+
72+
73+
## Development
74+
75+
Everything is done in `PlatformIO`. If you wish to update conig and regenerate
76+
headers, you may need `node.js` and run `npm run config`.
77+
78+
Note, this PCB has no AC isolation! That's ok for normal operation, because
79+
board is placed inside isolated case. But if you plan to debug firmware via USB,
80+
you MUST use [USB isolator](https://ru.aliexpress.com/wholesale?SearchText=USB+isolator)
81+
module.
82+
83+
84+
## License
85+
86+
MIT.

0 commit comments

Comments
 (0)