initial commit
This commit is contained in:
BIN
JGA25-370 draw2.webp
Normal file
BIN
JGA25-370 draw2.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
5
blinds/.gitignore
vendored
Normal file
5
blinds/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
10
blinds/.vscode/extensions.json
vendored
Normal file
10
blinds/.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"platformio.platformio-ide"
|
||||
],
|
||||
"unwantedRecommendations": [
|
||||
"ms-vscode.cpptools-extension-pack"
|
||||
]
|
||||
}
|
||||
39
blinds/include/README
Normal file
39
blinds/include/README
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
This directory is intended for project header files.
|
||||
|
||||
A header file is a file containing C declarations and macro definitions
|
||||
to be shared between several project source files. You request the use of a
|
||||
header file in your project source file (C, C++, etc) located in `src` folder
|
||||
by including it, with the C preprocessing directive `#include'.
|
||||
|
||||
```src/main.c
|
||||
|
||||
#include "header.h"
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Including a header file produces the same results as copying the header file
|
||||
into each source file that needs it. Such copying would be time-consuming
|
||||
and error-prone. With a header file, the related declarations appear
|
||||
in only one place. If they need to be changed, they can be changed in one
|
||||
place, and programs that include the header file will automatically use the
|
||||
new version when next recompiled. The header file eliminates the labor of
|
||||
finding and changing all the copies as well as the risk that a failure to
|
||||
find one copy will result in inconsistencies within a program.
|
||||
|
||||
In C, the usual convention is to give header files names that end with `.h'.
|
||||
It is most portable to use only letters, digits, dashes, and underscores in
|
||||
header file names, and at most one dot.
|
||||
|
||||
Read more about using header files in official GCC documentation:
|
||||
|
||||
* Include Syntax
|
||||
* Include Operation
|
||||
* Once-Only Headers
|
||||
* Computed Includes
|
||||
|
||||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
||||
46
blinds/lib/README
Normal file
46
blinds/lib/README
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
This directory is intended for project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link into executable file.
|
||||
|
||||
The source code of each library should be placed in a an own separate directory
|
||||
("lib/your_library_name/[here are source files]").
|
||||
|
||||
For example, see a structure of the following two libraries `Foo` and `Bar`:
|
||||
|
||||
|--lib
|
||||
| |
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
||||
| |
|
||||
| |--Foo
|
||||
| | |- Foo.c
|
||||
| | |- Foo.h
|
||||
| |
|
||||
| |- README --> THIS FILE
|
||||
|
|
||||
|- platformio.ini
|
||||
|--src
|
||||
|- main.c
|
||||
|
||||
and a contents of `src/main.c`:
|
||||
```
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
PlatformIO Library Dependency Finder will find automatically dependent
|
||||
libraries scanning project source files.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
||||
14
blinds/platformio.ini
Normal file
14
blinds/platformio.ini
Normal file
@@ -0,0 +1,14 @@
|
||||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter
|
||||
; Upload options: custom upload port, speed and extra flags
|
||||
; Library options: dependencies, extra library storages
|
||||
; Advanced options: extra scripting
|
||||
;
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:wemos_d1_mini32]
|
||||
platform = espressif32
|
||||
board = wemos_d1_mini32
|
||||
framework = arduino
|
||||
109
blinds/src/main.cpp
Normal file
109
blinds/src/main.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
/*
|
||||
* Author: Automatic Addison
|
||||
* Website: https://automaticaddison.com
|
||||
* Description: Calculate the angular velocity in radians/second of a DC motor
|
||||
* with a built-in encoder (forward = positive; reverse = negative)
|
||||
*/
|
||||
|
||||
// Motor encoder output pulses per 360 degree revolution (measured manually)
|
||||
#define ENC_COUNT_REV (500 * 11) //12rmp motor
|
||||
|
||||
// Encoder output to Arduino Interrupt pin. Tracks the pulse count.
|
||||
#define ENC_IN_RIGHT_A 2
|
||||
|
||||
// Other encoder output to Arduino to keep track of wheel direction
|
||||
// Tracks the direction of rotation.
|
||||
#define ENC_IN_RIGHT_B 4
|
||||
|
||||
// True = Forward; False = Reverse
|
||||
bool Direction_right = true;
|
||||
|
||||
// Keep track of the number of right wheel pulses
|
||||
volatile long right_wheel_pulse_count = 0;
|
||||
|
||||
// One-second interval for measurements
|
||||
int interval = 1000;
|
||||
|
||||
// Counters for milliseconds during interval
|
||||
long previousMillis = 0;
|
||||
long currentMillis = 0;
|
||||
|
||||
// Variable for RPM measuerment
|
||||
float rpm_right = 0;
|
||||
|
||||
// Variable for angular velocity measurement
|
||||
float ang_velocity_right = 0;
|
||||
float ang_velocity_right_deg = 0;
|
||||
|
||||
const float rpm_to_radians = 0.10471975512;
|
||||
const float rad_to_deg = 57.29578;
|
||||
|
||||
void setup() {
|
||||
|
||||
// Open the serial port at 9600 bps
|
||||
serial.begin(9600);
|
||||
|
||||
// Set pin states of the encoder
|
||||
pinMode(ENC_IN_RIGHT_A , INPUT_PULLUP);
|
||||
pinMode(ENC_IN_RIGHT_B , INPUT);
|
||||
|
||||
// Every time the pin goes high, this is a pulse
|
||||
attachInterrupt(digitalPinToInterrupt(ENC_IN_RIGHT_A), right_wheel_pulse, RISING);
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
// Record the time
|
||||
currentMillis = millis();
|
||||
|
||||
// If one second has passed, print the number of pulses
|
||||
if (currentMillis - previousMillis > interval) {
|
||||
|
||||
previousMillis = currentMillis;
|
||||
|
||||
// Calculate revolutions per minute
|
||||
rpm_right = (float)(right_wheel_pulse_count * 60 / ENC_COUNT_REV);
|
||||
ang_velocity_right = rpm_right * rpm_to_radians;
|
||||
ang_velocity_right_deg = ang_velocity_right * rad_to_deg;
|
||||
|
||||
Serial.print(" Pulses: ");
|
||||
Serial.println(right_wheel_pulse_count);
|
||||
Serial.print(" Speed: ");
|
||||
Serial.print(rpm_right);
|
||||
Serial.println(" RPM");
|
||||
Serial.print(" Angular Velocity: ");
|
||||
Serial.print(rpm_right);
|
||||
Serial.print(" rad per second");
|
||||
Serial.print("\t");
|
||||
Serial.print(ang_velocity_right_deg);
|
||||
Serial.println(" deg per second");
|
||||
Serial.println();
|
||||
|
||||
right_wheel_pulse_count = 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Increment the number of pulses by 1
|
||||
void right_wheel_pulse() {
|
||||
|
||||
// Read the value for the encoder for the right wheel
|
||||
int val = digitalRead(ENC_IN_RIGHT_B);
|
||||
|
||||
if(val == LOW) {
|
||||
Direction_right = false; // Reverse
|
||||
}
|
||||
else {
|
||||
Direction_right = true; // Forward
|
||||
}
|
||||
|
||||
if (Direction_right) {
|
||||
right_wheel_pulse_count++;
|
||||
}
|
||||
else {
|
||||
right_wheel_pulse_count--;
|
||||
}
|
||||
}
|
||||
11
blinds/test/README
Normal file
11
blinds/test/README
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
This directory is intended for PlatformIO Test Runner and project tests.
|
||||
|
||||
Unit Testing is a software testing method by which individual units of
|
||||
source code, sets of one or more MCU program modules together with associated
|
||||
control data, usage procedures, and operating procedures, are tested to
|
||||
determine whether they are fit for use. Unit testing finds problems early
|
||||
in the development cycle.
|
||||
|
||||
More information about PlatformIO Unit Testing:
|
||||
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html
|
||||
BIN
drv8871.pdf
Normal file
BIN
drv8871.pdf
Normal file
Binary file not shown.
BIN
hall-wires.jpg
Normal file
BIN
hall-wires.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 84 KiB |
BIN
jga25-370 draw.jpg
Normal file
BIN
jga25-370 draw.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 224 KiB |
BIN
jga25-370 spec.jpg
Normal file
BIN
jga25-370 spec.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 230 KiB |
18
jga25-spec.txt
Normal file
18
jga25-spec.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
DC12V 25GA370 Grote Koppel Speed Reductormotorgroep met Toerenteller Encoder
|
||||
Specificatie:
|
||||
Voltage: DC6V 12V 24V
|
||||
Onbelast Toerental: 12RPM, 16RPM, 35RPM, 60RPM, 77RPM, 130RPM, 170RPM, 280RPM, 620RPM, 1360RPM
|
||||
Fout: ± 5%
|
||||
Motor Diameter: 24.5mm
|
||||
Motor Lichaam Lengte: 40mm(ref)
|
||||
Uitgaande As Diameter: 4mm(D-type)
|
||||
Uitgaande As Lengte: ongeveer 9.5mm
|
||||
Versnellingsbak Diameter: 25mm
|
||||
Versnellingsbak Size Detal, zie de tabel
|
||||
Bedradingen:
|
||||
Rode Draad-positieve voeding van motor(+)(veranderen positieve en negatieve van motor de rotatie zal veranderen)
|
||||
Witte Draad-negatieve voeding van motor(-)(veranderen positieve en negatieve van motor de rotatie zal veranderen))
|
||||
Gele Draad-signaal feedback (motor een turn heeft 11 signalen)
|
||||
Groene Draad-signaal feedback (motor een turn heeft 11 signalen)
|
||||
Blauwe Draad-positieve van encoder voeding (+)(3.3-5V), kan niet worden verkeerde
|
||||
Zwarte Draad-negatieve van encoder voeding (-)(3.3-5V), kan niet worden verkeerde
|
||||
Reference in New Issue
Block a user