Code Monkey home page Code Monkey logo

oilerlib's Introduction

Built using Arduino Compatible Cross Platform C++ Library Project : For more information see http://www.visualmicro.com
blog: http://www.visualmicro.com/post/2017/01/16/Arduino-Cross-Platform-Library-Development.aspx

This project is designed to build an oiler system for a metal lathe. A base solution using this library has one or more pump motors used to deliver oil. Each motor must have a feedback signal to indicate the oil drips being delivered. The library counts drips delivered per motor and idles the motor when a configurable target (per motor) is met. The motors are restarted when a restart event is triggered. In the base solution the restart is a time event (in elapsed seconds) after the motor starts idling.

The library optionally also supports two additional input signals designed to be fed by the lathe being oiled. These signals are a pulse every time the lathe completes a revolution and a signal that is held HIGH or LOW (as configured) whilst the lathe is powered on. These two signals can be used as motor restart triggers i.e. restart oiling after so many revolutions or so many seconds of being active (ie powered on).

The library has support for two types of motors one driven by a simple relay switch and the other a stepper motor. Multiple motors of each type can be configured in any combination. The limits are the number of pins available on the Uno and a software limit of 6 motors. Since each motor needs a feedback signal as described above each relay based motor will use 2 Uno pins and each stepper motor 5 pins (the code is written for a 4 pin stepper driver).

Whilst the original purpose of this library is oiling the code has no real knowledge of the actual purpose. It switches motors on based on a trigger event and off after it gets enough signals that the delivery is complete. As a result this can be used for other purposes.

Motors track when to start and stop independently so a slow motor will not impact other motors.

When a motor is deciding when to restart it compares the state of the oiler at the time it last started - not the time it last stopped. This is done to reduce the impact of  slow motor, e.g. if oiling every 30 seconds but a slow oiler takes 12 seconds to oil, it will restart the slow motor 30 seconds after it started. If it started counting 30 seconds from when the oiling finished it would result in the next 30 + 12 seconds between oiling not 30 seconds. One side effect of this is that is a slow motor takes longer than the 30 seconds set in this example then it will stop on completing oiling and immediately restart trying to oil as it has already exceeded the target oil interval. 

Depending upon the programming skill of the library user there are different options to get going:

Limited programming experience:

Automated sketch builder

There is a folder under examples called OilerBuilder In here is a windows executable - OilerBuilder.exe. This allows a user to fill in details about the number (max 6) and types of motors to be used in the implementation. Pins can be assigned and features can be enabled. At the end it will auto generate an arduino sketch that can be used as the start point for an implementation.

Familiar with coding arduino projects

There are a number of example arduino sketches that show how to use the library to build different oiler solutions. The GitHub Wiki documents all the library calls.

Software developer

The src library has all the code that can be amended or extended. The library is designed to use interrupts to monitor pin state changes and timed events. The goal is that any library user can configure the library and start it going without any need for calling the library in a loop to ensure it is getting cpu time to keep the system running. As such the code has underlying functions to support PCI interrupt handling and system timers. The Oilerlibrary functional code uses these to manipulate c++ objects representing motors and the machine being oiled. The motor object is inherited to represent the different type of motor and these are manipulated using an internal state table.

To use the Oilerbuilder download the release and install it. Then run the Oilerbuilder.exe from the directory in which it is located.

oilerlib's People

Contributors

naylom avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

oilerlib's Issues

Allow user to switch target machine power input signal level

Currently the system expects the optional input signal from the machine being oiled that indicates the oiled machine is powered on to be held HIGH when the machine has power and LOW when not. Allow the user to switch to LOW = power on and HIGH = powered off if needed.

Enable pump sensor pin to have PULLUP enabled or not

Each configured motor has an associated sensor which indicates when the pump has delivered output (i.e. a drip of oil). This sensor is attached to a pin and the code defaults to enabling the arduino internal pullup resistors. Allow the user to overridde this behavior if desired.

Allow user to change the motor output signal debounce programatically

Currently each motor has an associated sensor that detects output (oil drips). To prevent one drip being seen as multiple drips the code implements a debounce logic that requires a set time to pass before a subsequent signal is recognised. This time is fixed at compile time and applies to all sensors. The enhancment is to allow the user to specify the debounce vlaue through a function call and to allow a different value for each sensor if required.

Not supporting more than 2 motors

The system only handles up to a max of two input signals indicating a motor has delivered oil yet the MAX-MOTORS is defined as 6.

Enable user to choose Alert signal state

Currently when an Alert is generated a HIGH signal is held on the configured pin. Add feature to allow user to have this inverted i.e. LOW when active, HIGH when not.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.