-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current position not working #2
Comments
I am forking this to work on an ESP32 with BT. It seems the error is in calculating targetInput in the main process() block:
This makes more sense: |
i have the same issue with no movement did any figure what issue is? |
I completely refactored it and dropped the pid methodology and made a custom variable acceleration one, using non-blocking loops. The esp32 will loop through this 4X per clock. I haven't finished it as the HF start circuit is blowing out the esp32 remote detector circuit - with HF Voltages in the >1KV range. The remote esp32 has a sim mode to simulate sudden voltage jumps to test the controller response. I was happy with the contollers response in simulator mode. main loop snippet: void setup() {
} Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2); stepper.setMaxSpeed(6 * Accel); //adjust to cnc table limits // This is the Arduino main loop function. while (Input >= threshold && isEnabled) {
}
} while (isEnabled == false) {
} |
I have tried to update the code and bring in a start function in order to run at every new job and give the plasma controller a feed back to show the home here is the code but still not getting the position on the HMI screen. */ // Check hardware #include <FastPID.h> // Include PID Library // Pin definitions const int dirPin = 2; // Direction pin for Z-axis motor (assumed direction pin for motor control) // Constants // The variables to be using be the code below #define PLASMA_INPUT_PIN A1 // Define a stepper driver and the pins it will use // Define Variables // Specify the links and initial tuning parameters FastPID THCPID(Kp, Ki, Kd, Hz, output_bits, output_signed); // Set EEPROM Addresses for Setpoint saving long defaultSetpoint = 10900; long SetpointPage1 = 0; long CurrentPageNumber = 0; // Movement Variables // State Management // The Setup function runs once when you press reset or power the board
} // The Loop function runs over and over again forever
} void runHomeSequence() {
} void moveZAxisDown() { void stopZAxis() { } void process() {
} void trigger0() { } void trigger1() {
} void trigger2() { void trigger3() {
} void trigger4() {
} void trigger5() {
} void trigger6() {
} void trigger7() {
} void trigger8() { void trigger9() { void trigger10() {
} void trigger11() {
} void trigger12() {
} void trigger13() {
} void trigger14() {
} void trigger15() {
} void trigger16() {
} void trigger17() {
} void trigger18() {
} void trigger19() {
} void trigger20() {
} void trigger21() {
} void trigger22() {
} void trigger23() {
} void trigger24() {
} void trigger25() {
} void trigger26() {
} void trigger27() {
} void trigger28() {
} void trigger29() { void trigger30() { void trigger31() {
} void trigger32() {
} void trigger33() { } void trigger34() {
} void trigger35() {
} void report() { void format() { // +++++++++++++ Helpers ++++++++++++++++
} String read_StringFromEEPROM(char add) {
} void writeIntIntoEEPROM(int address, int number) {
} int readIntFromEEPROM(int address) {
} void writeLongIntoEEPROM(int address, long number) {
} long readLongFromEEPROM(int address) {
} void writeFloatIntoEEPROM(int address, float num) {
} float readFloatFromEEPROM(int address) {
} |
here is how I set up the display. The Esp32 libs do not support the eeprom lib so I converted to the Preferences.h to store values to disk #include <NimBLEDevice.h> #define TORCH_ON_PIN 27 #define RXD2 16 #define _TB6600 /*_28BYJ */ #ifdef _TB6600 #ifdef _28BYJ static bool debug, sim, delayStart = true; #define Setpoint1 10000 static unsigned short tmp, CurrentPageNumber = 1; EasyNex THCNex(Serial2); static unsigned short threshold = 4096; //both low voltage lockout & upper control limit to calculate newPos static bool hSpeed = false; //high-low accelleration flag #define h_acel 4 // logic trigger delay to high accel tatic bool doConnect = false; void OpenSaved(bool open = true) { ... void startDisplay() { OpenSaved(true); HighLow = Saved.getFloat("HighLow", 2.2); steps_per_mm = Saved.getUShort("Steps", 160); Z = Saved.getUShort("Z", 8); maxZ = steps_per_mm * Z; threshold = Saved.getUShort("Threshold", 4096); CurrentPageNumber = Saved.getUShort("dp", 1); OpenSaved(false); THCNex.begin(9600); THCNex.writeStr("page " + String(CurrentPageNumber)); // For synchronizing Nextion page in case of reset to Arduino void write_bof() { ... the display routines: void report() //report plasma voltage and position void trigger0() //Set last page used on startup loaded event void trigger1() //update page and slider to stored values if (CurrentPageNumber <= 8) {
} if (CurrentPageNumber <= 6 && SetPoint >= threshold && SetPoint <= 18000) {
} void trigger4() //Move Z Up/Down void trigger5() //Adjust maxZ Up/Down void trigger7() //Adjust HighLow Up/Down void trigger10() { //Adjust Steps per mm the code is 750 lines in length, so I'm only posting snipets. I both simplified and added some reporting and debug inputs to the page displays. The 3 main while loops in the main code, control updating and reading the touch screen. |
Hello I've been watching your videos and want to say thank you I am learning alot.
I'm right now trying to build your torch height control for my home made cnc plasma cutter.
I cant get it to work I have tried the uno and the mega
The screen is there and it is talking to the arduino it reads the plasma voltage simulated by a potentiometer the set point reads 119.14
But my current position stays at zero no matter if I turn the potentiometer all the way up or down. The current position never moves
Can you please help me to figure out were im going wrong please
Thank you for your time
The text was updated successfully, but these errors were encountered: