Skip to content

Library including Hardware control classes for all components currently in use at QiTech

License

Notifications You must be signed in to change notification settings

QiTech-Industries/HardwareControl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Issues Last Commit GPL-3.0 License


Logo

Hardware Control Library

Diverse Library to control hardware ranging from PID Heater to Stepper Motor
Explore the docs »

Report Bug · Request Feature · Related Projects

Table of Contents
  1. About The Project
  2. Getting Started
  3. Roadmap
  4. Contributing
  5. License
  6. Contact

About The Project

The goal of this project is to become a universal, API consistent library to control all the hardware components you could ever wish for without needing to worry about complex control logic. Basically you must only include one file and ultimately gain access to debounced buttons, stepper motors, dc motors, hall sensors... Despite mircroservices and modules becoming popular, we believe that makers should not have to deal with inconsistent documentations and loads of imports just to get their project working. We are by no means close to such a holy grale yet but the library will grow as we discover new components at QiTech or you add them Contributing

(back to top)

Built With

Currently the following libraries are in use:

Library Info License
FastAccelStepper https://github.com/gin66/FastAccelStepper MIT
TMCStepper https://github.com/teemuatlut/TMCStepper MIT

(back to top)

Getting Started

To get a local copy up and running follow these simple steps.

Installation

These steps are only required if you want to develop the library. In case you just want to use it in one of your projects refer to Usage

  1. Install the PlatformIO extension in VsCode platformio.platformio-ide
  2. Clone the repo
    git clone https://github.com/QiTech-Industries/HardwareControl
  3. Upload the code to the ESP
    npm run dev

There is also a full mock server available to test the API interaction without having a connection to the Winder. To start it run:

  1. Install NPM packages
    cd mock && npm install
  2. Start the server on port 5001 in hot-reload mode
    npm run start

When reloading the webinterface a green toast should pop up notifying you that the socket connection was successful.

Usage

Heat Controller
// main.cpp
/**
* Example code for using 3 heat-controllers simultaneously
*/
#include <Arduino.h>
#include <HeatController.h>

HeatController heater1({
  .id = 1,
  .targetTemp = 200,
  .pinHeat = 26,
  .pinSensorSo = 16,
  .pinSensorCs = 17,
  .pinSensorSck = 25
});
HeatController heater2({
  .id = 2,
  .targetTemp = 200,
  .pinHeat = 27,
  .pinSensorSo = 13,
  .pinSensorCs = 12,
  .pinSensorSck = 14
});
HeatController heater3({
  .id = 3,
  .targetTemp = 200,
  .pinHeat = 5,
  .pinSensorSo = 18,
  .pinSensorCs = 19,
  .pinSensorSck = 23
});
HeatController controllerList[] = {heater1, heater2, heater3};
int controllerCount = 3;

void setup(){
  Serial.begin(115200);
  // Start controllers with valid configuration
  for(int i=0; i<controllerCount; ++i){
      if(controllerList[i].isReady()) controllerList[i].start();
  }

  // Make some of the controllers talk
  controllerList[0].setDebuggingLevel(WARNING);
  controllerList[controllerCount-1].setDebuggingLevel(INFO);
}

void loop(){
  for(int i=0; i<controllerCount; ++i){
      if(controllerList[i].isReady()) controllerList[i].handle();
  }
  delay(1); // Small delay to prevent message-flooding
}
Stepper Controller
// main.cpp
#include "./controller/stepper/Stepper.h"

stepperConfiguration_s stepperConfig = {.stepperId = "stepper",
                         .maxCurrent = 700,
                         .microstepsPerStep = 32,
                         .stepsPerRotation = 200,
                         .mmPerRotation = 10,
                        .gearRatio = 1,
                         .pins = {
                            .en = 12,
                            .dir = 14,
                            .step = 17,
                            .cs = 13,
                        }
};
FastAccelStepperEngine engine = FastAccelStepperEngine();
Stepper myStepper = Stepper(stepperConfig, &engine);

void setup() {
    SPI.begin();
    Serial.begin(115200);
    engine.init();
    myStepper.init();
    myStepper.setDebuggingLevel(INFO);
}

void loop() {
    // Issue command
    myStepper.movePosition(80, 100);

    // Let the handler do its magic
    while(true){
        myStepper.handle();
    };
}

(back to top)

Roadmap

The goal of this project is to become a universal library with options to control nearly all hardware components available for makers wih a unified API. Ideally with only a single import required.

There will definitely be some project restructuring involved and especially at this early stage a new breaking version will get released frequently.

To get an overview of what is planned to be implemented, check the issues where bugs ans feature requests are kept track of. See open issues for a full list. Feel free to report new issues or fix existing ones.

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please open a issue with the tag "enhancement" to discuss whether your idea is in line with our Roadmap and we can find the best way of implementing it.

Than:

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Check whether your code complies with the coding guidelines
  6. Open a Pull Request

(back to top)

License

Distributed under the GPL-3.0 License. See LICENSE for more information.

(back to top)

Contact

QiTech Industries - https://qitech.de/industries - contact@qitech.de

Project Link: https://github.com/QiTech-Industries/HardwareControl

(back to top)

About

Library including Hardware control classes for all components currently in use at QiTech

Resources

License

Stars

Watchers

Forks

Packages

No packages published