M
le spécialiste STM32 c'est @pailpoeje me suis procuré un st-link v2 + smt32F103C8T6 + hc-06.
bonjour . je dispose de ce type de règle que javais acheté sur aliexpress pour mon petit tour chinois , a la différence quelles sont brancher en direct ( pas d’USB ).
je me suis procuré un st-link v2 + smt32F103C8T6 + hc-06.
est-ce possible avec ce matos ou faut il que je me procure du matos autre ?
ps : jai deja flasher le smt32 et testé la liaison Bluetooth avec touch dro ( OK ) .
ouaip, car j'en suis toujours au même pointJe sèche juste sur un point: sur le github @pailpoe il est mentionné le codage de la vitesse de broche, mais je ne retrouve pas celà sur le schéma ni dans le code. J'ai regardé pour m'y coller, mais là ça dépasse gravement mes maîgres compétences.
Quelqu'un a-t-il réalisé ce câblage/codage de la vitesse de broche et pourrait le partager svp?
// ESP32_Touch_Tacho.h
#ifndef _ESP32_TOUCH_TACHO_h
#define _ESP32_TOUCH_TACHO_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#ifndef _ESP32TACHO_h
#define _ESP32TACHO_h
#endif
//#define MAX_ENCODERS 4
#include "ESP32_Quad_Encoder.h"
//enum pullupType { none, up, down };
class ESP32Tacho {
private:
unsigned long maxPulseInterval;
//int nopulseCount;
gpio_num_t tachoPinA;
enum pullupType puType;
void(setupPin(gpio_num_t pin));
public:
ESP32Tacho(int pinA, int pinB, float pulsePerRev, pullupType uip);
ESP32Tacho();
void attachTacho();
float get_ppm();
float pulsesPerRev;
float pulsesPerMinute;
volatile unsigned long timeOfLastPulse;
volatile unsigned long aggregateMicros;
unsigned long pulseInterval;
volatile int pulseCount;
bool running;
bool directionEnabled;
int direction;
gpio_num_t tachoPinB;
};
void IRAM_ATTR tacho_isr();
#endif
// ESP32_Touch_Tacho.cpp
/* Routines to add Tacho capability to TouchDRO Interface
Mates with ESP32Encoder as adapted by romeo
Prepared June 2020
*/
#include "ESP32_Touch_Tacho.h"
const int minRPM = 20; //RPM below which tacho will decide shaft is stopped
extern ESP32Tacho Tacho;
portMUX_TYPE TachoMux = portMUX_INITIALIZER_UNLOCKED; //despite vs squiggly line, compiles ok
const int32_t microsPerMinute = 60000000;
ESP32Tacho::ESP32Tacho() {
pulsesPerRev = 0;
}
ESP32Tacho::ESP32Tacho(int aP, int bP, float ppr, pullupType uip) {
tachoPinA = (gpio_num_t)aP;
tachoPinB = (gpio_num_t)bP;
pulsesPerRev = ppr;
puType = uip;
pulsesPerMinute = 0;
maxPulseInterval = microsPerMinute / (minRPM * pulsesPerRev);
directionEnabled = false;
}
void ESP32Tacho::attachTacho() {
setupPin(tachoPinA);
if (tachoPinB != 0 && tachoPinB != tachoPinA) {
setupPin(tachoPinB);
directionEnabled = true;
running = false;
}
attachInterrupt(tachoPinA, tacho_isr, RISING);
}
void ESP32Tacho::setupPin(gpio_num_t a) {
gpio_pad_select_gpio(a);
gpio_set_direction(a, GPIO_MODE_INPUT);
if (puType == down) {
gpio_pulldown_en(a);
}
else {
if (puType == up) {
gpio_pullup_en(a);
}
}
}
void IRAM_ATTR tacho_isr() {
unsigned long isr_micros = micros();
if (!Tacho.running) {
portENTER_CRITICAL_ISR(&TachoMux);
Tacho.running = true;
Tacho.pulseCount = 0;
Tacho.direction = digitalRead(Tacho.tachoPinB);
Tacho.timeOfLastPulse = isr_micros;
Tacho.aggregateMicros = 0;
portEXIT_CRITICAL_ISR(&TachoMux);
}
else {
portENTER_CRITICAL_ISR(&TachoMux);
Tacho.pulseCount++;
Tacho.aggregateMicros += (isr_micros - Tacho.timeOfLastPulse);
Tacho.direction = digitalRead(Tacho.tachoPinB);
Tacho.timeOfLastPulse = isr_micros;
portEXIT_CRITICAL_ISR(&TachoMux);
}
}
float ESP32Tacho::get_ppm() {
int temp_pulseCount;
unsigned long temp_aggregateMicros;
unsigned long temp_timeOfLastPulse;
if (!Tacho.running) {
return 0;
}
portENTER_CRITICAL(&TachoMux);
temp_pulseCount = pulseCount;
pulseCount = 0;
temp_aggregateMicros = aggregateMicros;
aggregateMicros = 0;
temp_timeOfLastPulse = timeOfLastPulse;
portEXIT_CRITICAL(&TachoMux);
if (temp_pulseCount == 0) { //if no actual pulses received, display an apparent slowdown in accordance with the report interval
pulseInterval = micros() - temp_timeOfLastPulse;
if (pulseInterval > maxPulseInterval) {
running = false;
direction = 0;
return 0;
}
temp_pulseCount = 1;
}
else {
pulseInterval = temp_aggregateMicros / temp_pulseCount;
}
return (microsPerMinute / pulseInterval);
}
if (++tachoReportCounter >= tachoReportInterval) {
tachoReportCounter = 0;
if (Tacho.direction == 0) {
outputString += ("t" + String((int)Tacho.get_ppm()) + ";");
}
else {
outputString += ("t-" + String((int)Tacho.get_ppm()) + ";");
}
}
j'ai fait une pause dans le placoje viens d'aller jeter un œil furtif sur le github de pailpoe... vais voir si j'arrive à y insérer l'idée du code que tu proposes, mais il faut commencer par épluché la datasheet du STM32F103C8T6 que je ne connais pas du tout
Bon ce week-end c'est plutôt placo, alors je vais éviter de céder à la tentation tout de suite sinon c'est mort
The frame format is :
Xaaa;Ybbb;Zccc;Wddd;Teee;
aaa : Step for X sensor ( example : -2563 or 4569)
bbb : Step for Y sensor ( example : -2563 or 4569)
ccc : Step for Z sensor ( example : -2563 or 4569)
ddd : Step for W sensor ( example : -2563 or 4569)
eee : spindle speed in RPM ( example : -800 or 2569)
Bonsoir,De retour avec mon besoin d’adapter le hard/soft de Pailpoe + application TouchDRO à un tour conventionnel (un Crouzet en l’occurrence) afin d’avoir la lecture de la positions des axes ET de la vitesse de broche dans l’application TouchDRO de Yuriy.
Après quelques réflexions nocturnes, je pense avoir identifié deux façons de procéder. Rien ne dit que les deux idées sont viables, ça reste de la théorie, mais j’explore et j’espère aboutir .
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?